Why don't my IO-Nodes have Input-/Output-Buses?

I have a strange problem here: My in- and out-nodes seem to have no input- or output-buses. Any suggestions?

In the following i want to show you some code I’ve put into the Constructor of my MainComponent:

MainComponent::MainComponent()
{
// Component-Stuff ignored

// Audio:
// In/ Out-Node
in = new AudioProcessorGraph::AudioGraphIOProcessor( AudioProcessorGraph::AudioGraphIOProcessor::audioInputNode);
out = new AudioProcessorGraph::AudioGraphIOProcessor(AudioProcessorGraph::AudioGraphIOProcessor::audioOutputNode);

myAudioProcessor = new MyAudioProcessor();

audioProcessorGraph = new AudioProcessorGraph();

inNode = audioProcessorGraph->addNode(in);
outNode = audioProcessorGraph->addNode(out);
myAPasNode = audioProcessorGraph->addNode(myAudioProcessor);

// This does not work (because inNode has no outputs)
if(audioProcessorGraph->addConnection({{inNode->nodeID,0 }, {myAPasNode->nodeID,0} })) std::cout << "succeed." << std::endl;
else std::cout << "not working." << std::endl;


audioProcessorPlayer = new AudioProcessorPlayer();
audioProcessorPlayer->setProcessor(audioProcessorGraph);

audioDeviceManager.initialiseWithDefaultDevices(2, 2);
audioDeviceManager.addAudioCallback(audioProcessorPlayer);

}

Any suggestions?

Are you adding any input/output busses to your MyAudioProcessor? Can you show us the constructor of that processor?

Yes sure :slight_smile:

MyAudioProcessor::MyAudioProcessor() : AudioProcessor (BusesProperties()
                                                   .withInput  ("Input",  AudioChannelSet::stereo(), true)
                                                   .withOutput ("Output", AudioChannelSet::stereo(), true)
                                                   )
{ //(empty at the moment)
}

But I have problems with the inNode, i think.

Hmmm looks good to me. Have a look at the AudioPluginHost in the extras folder. It also adds internal processors (Reverb and sine synth) to the audio graph. You can add it via PlugIns -> Create plugin.

Okay, I’ll take a look there! Thanks for your help so far.

Just one question: Is it normal then, that an audioInputNode has no Outputs, that can be connected? How am I able to connect an input of an AudioProcessor to an AudioGraphIOProcessor that has no inputs/ outputs? (I have the same problem for the audioInputNode and the audioOutputNode)

There will be no output pins in AudioInputNode if no audio input device is selected.

  • Jussi
2 Likes

Oh, god, I never thought about his. Thanks Jussi! :slight_smile:

So, if anyone will have a problem with setting up the AudioProcessorGraph in the future, this is working code:

MainComponent::MainComponent()
{
    // do your Component stuff
    setSize (600, 400);
    
    // Audio:
    // Setup the variables and connections
    myAudioProcessor = new MyAudioProcessor();
    
    audioProcessorGraph = new AudioProcessorGraph();
    
    audioProcessorPlayer = new AudioProcessorPlayer();
    audioProcessorPlayer->setProcessor(audioProcessorGraph);
    
    audioDeviceManager.initialiseWithDefaultDevices(2, 2);
    audioDeviceManager.addAudioCallback(audioProcessorPlayer);
    
    // In/ Out-Node /after/ initialising the audioDeviceManager
    in = new AudioProcessorGraph::AudioGraphIOProcessor( AudioProcessorGraph::AudioGraphIOProcessor::audioInputNode);
    out = new AudioProcessorGraph::AudioGraphIOProcessor(AudioProcessorGraph::AudioGraphIOProcessor::audioOutputNode);
    
    // add the Nodes to the Graph
    inNode = audioProcessorGraph->addNode(in);
    outNode = audioProcessorGraph->addNode(out);
    myAPasNode = audioProcessorGraph->addNode(myAudioProcessor);

    // connect everything
    if(audioProcessorGraph->addConnection({{inNode->nodeID,0 }, {myAPasNode->nodeID,0} }))
        std::cout << "successful connected." << std::endl;
    else std::cout << "not connected." << std::endl;
    audioProcessorGraph->addConnection({{inNode->nodeID,1 }, {myAPasNode->nodeID,1} });
    audioProcessorGraph->addConnection({{myAPasNode->nodeID,0 }, {outNode->nodeID,0} });
    audioProcessorGraph->addConnection({{myAPasNode->nodeID,1 }, {outNode->nodeID,1} });
    
    // add an AudioDeviceSetup (optional, this is working without the following block, too)
    audioDeviceSetup = new AudioDeviceSelectorComponent
    (audioDeviceManager,
     1, 2, // min/max Inputs
     1, 2, // min/max Outputs
     true, // Midi Input
     true, // Midi Output
     false,// Channels as Stereo Pairs
     false // Hide Advanced Options (Sample Rate, Block Size)
     );
    audioDeviceSetup->setSize(450, 500);
    addAndMakeVisible(audioDeviceSetup);
}