Manipulating WAV file in real-time


#1

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?


#2

Can you send us a snippet of your complete getNextAudioBlock function with your changes? Also in which class is this getNextAudioBlock defined?