Doubt in Audio streaming


I have a query in the audioDeviceIOCallback.


In the below code, during the audio device callback, im doing (recording and streaming). The file is recorded properly. But the streaming of data from input to output is not working. I am just copying the input buffer to the output buffer. Dont know what I am missing.

void AudioRecorder::audioDeviceIOCallback (const float** inputChannelData, int /*numInputChannels*/,
                                float** outputChannelData, int numOutputChannels, int numSamples)
    const ScopedLock sl (writerLock);

    if (activeWriter != nullptr)
        activeWriter->write (inputChannelData, numSamples);

    // In my case, both input and output channels are in indices 0 and 1. So the if condition shouldnt be a problem
    for (int i = 0; i < numOutputChannels; ++i)
        memcpy (outputChannelData[i], inputChannelData[i], sizeof (float) * (size_t) numSamples);



You've definitely got 2 ins and 2 outs? Even if that's the case, you should always write code that checks the number of channels.

And what is activeWriter? Maybe it modifies the data you pass into it? Try copying your data before calling it?