Hello,
I just started using JUCE. I’m following the tutorials and I built the simple audio file player in the MainContentComponent using the AudioTransportSource class (exactly like in the tutorial). I want to build a standalone audio processing app. Now I want to simply add a filter to the audio source. I did a lot of research on the Internet, I understand what each class does, but I don’t understand how they are related to each other. I still don’t understand how to hook AudioTransportSource and IIRFilter/IIRFilterSource up together. All I get is a buzzing noise, like if my audio file source never really gets connected. Also, I tried to wrap up one audio source object in another object of that also inherits audio source, but there was always some problem.
All the examples I found were using AudioSampleBuffer (which requires small file input from what I read in the tutorial) or AudioProcessor (but I would like to try something simpler first). Very few were doing audio processing on existing audio files.
For now, I’m doing this:
void MainContentComponent::prepareToPlay (int samplesPerBlockExpected, double sampleRate)
{
transportSource.prepareToPlay (samplesPerBlockExpected, sampleRate);
IIRCoefficients ic = IIRCoefficients::makePeakFilter(sampleRate, centreFrequency, Q, gainFactor);
filterL->setCoefficients(ic);
filterR->setCoefficients(ic);
}
and this:
void MainContentComponent::getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill)
{
jassert (bufferToFill.buffer->getNumChannels() == 2);
if (readerSource == nullptr)
{
bufferToFill.clearActiveBufferRegion();
return;
}
else
{
transportSource.getNextAudioBlock (bufferToFill);
}
filterL->processSamples (bufferToFill.buffer->getWritePointer (0, bufferToFill.startSample),
bufferToFill.numSamples);
filterR->processSamples (bufferToFill.buffer->getWritePointer (1, bufferToFill.startSample),
bufferToFill.numSamples);
}
Can anyone give me a hint on why this is not working? Thanks!