Audio Processor Graph connecting node doesn't output


#1

Hi , I’m trying to follow the AudioProcessorGraph tutorial and right now I’m trying to connect in a static way the processor blocks, right Now I’ve this problem, when I connect the audioInputNode to the audioOutputNode everything works fine , audio pass from input to output but when I try this solution to make static connection following this principle :
audioInputNode -----> filterProcessorNode ( the new node I’ve created with Filter Processor class)----->audioOutputNode , audio don’t pass…

Here’s the code in my final stage class where AudioProcessorGraph is

        void initialiseGraph()
    {
        mainProcessor->clear();
        audioInputNode  = mainProcessor->addNode (new AudioGraphIOProcessor(AudioGraphIOProcessor::audioInputNode));
        audioOutputNode = mainProcessor->addNode (new AudioGraphIOProcessor(AudioGraphIOProcessor::audioOutputNode));
        midiInputNode   = mainProcessor->addNode (new AudioGraphIOProcessor(AudioGraphIOProcessor::midiInputNode));
        midiOutputNode      = mainProcessor->addNode(new AudioGraphIOProcessor(AudioGraphIOProcessor::midiOutputNode));
        filterProcessorNode = mainProcessor->addNode(new FilterAudioProcessor());
        connectMidiNodes();

    }
    
    void connectFilterNodes()
    {
        for (int channel = 0; channel < 2; ++channel)
        {
        mainProcessor->addConnection ({ { audioInputNode->nodeID,  channel },
            { filterProcessorNode->nodeID, channel } });
        
        mainProcessor->addConnection ({ { filterProcessorNode->nodeID,  channel },
                { audioOutputNode->nodeID, channel } });
        }
    }
    void connectMidiNodes()
    {
        mainProcessor->addConnection ({ { midiInputNode->nodeID,  AudioProcessorGraph::midiChannelIndex },
            { midiOutputNode->nodeID, AudioProcessorGraph::midiChannelIndex } });
    }

I don’t get why the logic doesn’t work thank you if you want to help :slight_smile:


#2

additionally here’s the code for the Filter Processor class

class FilterAudioProcessor : public ProcessorBase
{
    
public:
    FilterAudioProcessor(){}
    void prepareToPlay (double sampleRate, int samplesPerBlock) override
    {
        FilterAudioProcessor::setPlayConfigDetails(getMainBusNumInputChannels(), getMainBusNumOutputChannels(), sampleRate, samplesPerBlock);
        *filter.state= *dsp::IIR::Coefficients<float>::makeLowPass (sampleRate, 4000.0f );
        dsp::ProcessSpec spec {sampleRate, static_cast<uint32> (samplesPerBlock),2};
        filter.prepare(spec);
    }
    
    void processBlock (AudioSampleBuffer& buffer, MidiBuffer&) override
    {
        
        dsp::AudioBlock<float> block (buffer);
        dsp::ProcessContextReplacing<float> context (block);
        filter.process(context);
    }
    void reset() override
    {
        filter.reset();
    }
    
private:
    dsp::ProcessorDuplicator<dsp::IIR::Filter<float>, dsp::IIR::Coefficients<float>> filter;
};

#3

Hello,

I had a similar problem about three months ago and unfortunately, I do not remember details. But I think that it was something with a correct bus layout configuration for my custom processors.

I attached a debugger with a breakpoint in processBlock and it appeared that a buffer had zero channels.

I am not sure but probably I fixed this by adding mainProcessor->enableAllBuses(); in prepareToPlay.

Maybe this will somehow help. If not sorry for messing around.

Best regards,
Mateusz


#4

mmm thank you, I’m now checking the bus config.

I’m not sure about the enableAllBuses(); but maybe I’ll give it a spin.

btw if anyone want to provide a more precise solution :slight_smile:


#5

FIXED!!!
i was missing this in void connectFilterNodes call :smiley:

filterProcessorNode->;getProcessor( )->setPlayConfigDetails(getMainBusNumInputChannels( ), getMainBusNumOutputChannels( ), getSampleRate( ), getBlockSize( ) );