willfo
willfo

Reputation: 249

Using AudioFormatReader in Juce to load impulse responses

I am creating a convolution reverb plugin using Juce and I am having some trouble loading in the impulse response audio files.

I am using the AudioFormatReader Class. Here is the code I have implemented so far which is producing some errors:

std::ifstream irStream;
irStream.open("1 Halls 01 Large Hall L.wav");

AudioFormatReader(juce::InputStream irStream, const juce::String &WavAudioFormat);

This is just an attempt at loading one audio file, ultimately I would like many.

Here is a link to the AudioFormatReader Class documentation:

AudioFormatReader

Upvotes: 1

Views: 654

Answers (1)

OMGtechy
OMGtechy

Reputation: 8220

You can use AudioFormat::createReaderFor for this (note that this is pure virtual function, and you'll have to use one if its derived types such as WavAudioFormat) alongside File. For example...

File myFile ("myFile.wav");
AudioFormatReader* myFormatReader = WavAudioFormat().createReaderFor (myFile.createInputStream(), true);

Upvotes: 1

Related Questions