I am trying to modify the tutorial that reads and plays back a WAV file. I would like to be able to apply a filter eventually, but I am having trouble accessing the audio data.
This is the code in the tutorial for reading the next block of audio
void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) override
{
if (readerSource == nullptr)
{
bufferToFill.clearActiveBufferRegion();
return;
}
transportSource.getNextAudioBlock (bufferToFill);
}
Based on other tutorials, I thought I could write to the audio data with the following line placed in getNextAudioBlock(), then do a for loop to edit each sample in the buffer.
float* const channelData = bufferToFill.buffer->getWritePointer (chan, bufferToFill.startSample);
This does not give me any errors, but it also is not effecting the audio output.
Is there a way to do this by modifying the tutorial, or is there an alternate route that would be easier?