Only processing one of two channels



Working on a very simple VST/AU plugin. 

My problem is that whatever I do with the channelData or the buffer inside the for-loop it only applies to one channel (the first) even when I put the plugin on a stereo-track (in Reaper). And it seems the getNumInputChannels() return 1 as well on a stereo track. Where should I be looking? Thank you very much!

void NewProjectAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
    // This is the place where you'd normally do the guts of your plugin's
    // audio processing...       

    for (int channel = 0; channel < getNumInputChannels(); ++channel)
        float* channelData = buffer.getWritePointer (channel);        

        //simple clipper
        for (int i = 0; i < buffer.getNumSamples(); i++)
            if (channelData[i] > 0.01f)
            channelData[i] = 0.01f;
            else if (channelData[i] < - 0.01f)
                channelData[i] = -0.01f;
        buffer.copyFrom(channel, 0, channelData, buffer.getNumSamples());

    // In case we have more outputs than inputs, we'll clear any output
    // channels that didn't contain input data, (because these aren't
    // guaranteed to be empty - they may contain garbage).

    for (int i = getNumInputChannels(); i < getNumOutputChannels(); ++i)
        buffer.clear (i, 0, buffer.getNumSamples());

EDIT: It seems I don´t have this problem with the VST-build only the AU-build. Strange. I guess Apples crappy code is the source of the problem here. But I have no idea where to fix this. Maybe you know something? Thanks

Xcode 5.1.1
and of course I added the CoreAudio files in Xcode/Developer/Extras.


You need to write

#define JucePlugin_PreferredChannelConfigurations  {2, 2}, {1, 1}

instead of

#define JucePlugin_PreferredChannelConfigurations  {1, 1}, {2, 2}

in AppConfig.h. So, the preferred configuration should come first.


Ah! Beautiful, thanks!



i would like to know if there is a workaround using the following formation of channel pair :

#define JucePlugin_PreferredChannelConfigurations  {1, 2}

Processing one input channel but the output should result into two.