I’m using a ThreadedWriter to write out to an audio file. I changed from buffering the whole file to using ThreadedWriter. But now I get dropped samples in the output file.
I followed closely the example at https://github.com/julianstorer/JUCE/blob/0159102e100cd5c2f9ffb1027dedaee102c9d191/examples/Demo/Source/Demos/AudioRecordingDemo.cpp
Any ideas what might be happening? Realtime playback is fine. Got a bit more debugging to do just wondered if there was something obvious to check. Thanks.
My processBlock:
const ScopedLock sl (writerLock);
int numSamples = buffer.getNumSamples();
if (activeWriter != nullptr)
{
activeWriter->write (buffer.getArrayOfReadPointers(), numSamples);
filePosition += numSamples;
}
The dropouts are happening every 32768 samples, and the ThreadedWriter is setup with
threadedWriter = new AudioFormatWriter::ThreadedWriter (writer, backgroundThread, 32768);