AudioProcessor


#1

Hi! I’m getting started using AudioProcessors inside an AudioProcessorGraph.
I see as for AudioGraphIOProcessor the input/output numbers are set when the the method AudioProcessorGraph::addNode() is called.
In AudioProcessorGraph::addNode i can see:

[code]AudioProcessorGraph::AudioGraphIOProcessor* const ioProc
= dynamic_cast AudioProcessorGraph::AudioGraphIOProcessor* (n->processor);

if (ioProc != 0)
    ioProc->setParentGraph (this);[/code]

and then on AudioGraphIOProcessor::setParentGraph()

[code]if (graph != 0)
{
setPlayConfigDetails (type == audioOutputNode ? graph->getNumOutputChannels() : 0,
type == audioInputNode ? graph->getNumInputChannels() : 0,
getSampleRate(),
getBlockSize());

    updateHostDisplay();
}[/code]

And so input/output processor (AudioGraphIOProcessor) is getting the number of input/output of the graph. These numbers (number of input/output of the graph) are set by
AudioProcessorPlayer in its setProcessor()

[code]if (processorToPlay != 0 && sampleRate > 0 && blockSize > 0)
{
processorToPlay->setPlayConfigDetails (numInputChans, numOutputChans,
sampleRate, blockSize);

        processorToPlay->prepareToPlay (sampleRate, blockSize);
    }[/code]

NOW: If I want to add custom audio processors to the graph where I have to set the number of input and output of the processor itself in order to have no problem when the graph method addConnection is called ?
is it correct to put in the AudioProcess::prepareToPlay(double sampleRate, int estimatedSamplesPerBlock) something like:

void MyCustomAudioProcess::prepareToPlay(double sampleRate, int estimatedSamplesPerBlock){ setPlayConfigDetails(mycustomaudioprocess_numberOfInput, mycustomaudioprocess_numberOfOutput, sampleRate, estimatedSamplesPerBlock); }
Or by doing this something in the whole architecture could be broken???

Thanx!


#2

Excuse me… maybe it is better to put the question in Audio Plugins section…
I’ve done it.