Why getTotalNumInputChannels() is always 0


My plugin processor constructor is

#ifndef JucePlugin_PreferredChannelConfigurations
     : AudioProcessor (BusesProperties()
                       .withInput  ("Input",  juce::AudioChannelSet::stereo(), true)
                       .withOutput ("Output", juce::AudioChannelSet::stereo(), true)

In the processBlock getTotalNumInputChannels(); is always 0;
And getTotalNumOutputChannels(); is always 2.

I don’t understand why I don’t have any inputs…

Perhaps some sort of flag in projucer?

Is it an instrument? In this case, you may don’t get any input channels in some hosts.

I would remove #ifndef JucePlugin_PreferredChannelConfigurations and make sure you don’t have any channel configuration in Projucer.

1 Like

Hi. Thank you for you replay.
Yes, It is an instrument.
I tested it in hosApp, in Cubase, and in StudioOne5:
hostApp getTotalNumInputChannels() = 2
Cubase getTotalNumInputChannels() = 2
StudioOne5 getTotalNumInputChannels() = 0

till thinking why… DAW configuration?

For VST3i you need an additional sidechain input if you want to receive audio.

override isBusesLayoutSupported

1 Like

Yes, i think this is required too. I was able to make sidechain input work for instruments in cubase with this code:

bool TalCore::isBusesLayoutSupported (const BusesLayout& layout) const
    for (const auto& bus : layout.outputBuses)
        if (bus != AudioChannelSet::stereo()
            && !bus.isDisabled())
            return false;

    for (const auto& bus : layout.inputBuses)
        if (bus != AudioChannelSet::stereo())
            return false;

    juce::PluginHostType hostType;
    if (!hostType.isProTools())
        if (layout.inputBuses.size() < 2)
            return false;

    return true;

I wasn’t able to make this work in PT. Your code have to check if the sidechain exists before using it as an input.

1 Like

For Instrument plugins, you can also derive your AudioProcessor publicly from VST3ClientExtensions and override getPluginHasMainInput to return false. This function will be called to check whether the first input bus should be designated as “kMain” or “kAux”. I believe that the Surge synthesiser uses this technique to provide input buses that aren’t necessarily enabled by default.

1 Like

there are some examples of instrument vsti that actually have an audio input and use it. for example EXC!TE SNARE DRUM – The Center for Haptic Audio Interaction Research

but vsti instruments having audio inputs is only supported by a few daws so far, as you have noticed.

Thank you guys! You have the best support forum!