Writting AudioProcessorGraph output to file


Hi All,

I am able to get the Graph to output to speakers using the following setup

ScopedPointer<AudioDeviceManager> devMan = new AudioDeviceManager();
ScopedPointer<AudioProcessorGraph> graph = new AudioProcessorGraph();
ScopedPointer<AudioProcessorPlayer> p = new AudioProcessorPlayer();

AudioProcessorGraph::AudioGraphIOProcessor* out = new AudioProcessorGraph::AudioGraphIOProcessor(AudioProcessorGraph::AudioGraphIOProcessor::audioOutputNode);

// .... Setup the graph ....


However, when I try to render this to a file, I just get silence.

ScopedPointer<WavAudioFormat> wafmt = new WavAudioFormat();
ScopedPointer<AudioFormatWriter> writer = wafmt->createWriterFor(new FileOutputStream(f), 48000, 2, 32, nullptr, 0);
int64 samplesRemaining = length;
ScopedPointer<AudioBuffer<float> > buff = new AudioBuffer<float>(2, 512);

while (samplesRemaining > 0) {
    out->processBlock(*buff, *midiBuff);
    writer->writeFromAudioSampleBuffer(*buff, 0, 512);
    samplesRemaining -= 512;

What addition steps should I be taking? Should I be calling "processBlock" on the output or the graph?

Many thanks,



It looks like the buffer is not being updated, check if the buffer is not empty.