AudioProcessor

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!

Yes, the inputs and outputs aren’t really designed to be changed dynamically, I’m afraid…

In PluginHost code If you set the graphPlayer's processor to null and the audioDevice is DirectSound I get a loud noise.

This does not happen with WindowsAudio or ASIO. The documentation says "To stop anything playing, pass in 0 to this method."

Change this is the pluginHodst demo and run it. Be sure to turn down the volume on your speakers first.

// graphPlayer.setProcessor (&graph.getGraph());
 graphPlayer.setProcessor (nullptr);

 

Thanks - try again now..