In an AudioProcessorGraph, I need an AudioProcessor that captures the audio stream and saves it to a file, while passing the input stream unchanged to the next AudioProcessor in the render chain. I want to use this to bounce live performances of my host to disk.
So far I found the Juce Demo code and AudioFormatWriter::ThreadedWriter, but unfortunately it only takes float** as the argument to write(), which an AudioSampleBuffer can not deliver. I tried a dirty hack with casting AudioSampleBuffer::getSampleData(0) to float**, but that crashed on me.
It would be great if AudioSampleBuffer also had writeFromAudioSampleBuffer(). Would that be possible, or do I miss something?
Sorry for all the noise. I got ot to work now. The AudioProcessor was not initialized properly (channel count), because I added it to the graph too early, before the AudioProcessorPlayer it is hooked into was configured.
In case anyone is interested, here’s how I did it: Basically I copied the recorder from the Juce Demo, made it inherit from AudioProcessor, removed the writeLock member and used the getCallbackLock() instead, and implemented these members: