Handle each channel separately

I am trying to put up an instrument plugin. I am having issues getting the two stereo channels independently. Since I am looking for stereo output, I initialize the buses in my processor as follows -

addEventInput(STR16(Event In), 1);|
addAudioOutput(STR16(AudioOutput), Vst::SpeakerArr::kStereo);|

Now in the process function, I expect to handle the left and right channels independently .

float* leftOutput = data.outputs[0].channelBuffers32[0];
float* rightOutput = data.outputs[0].channelBuffers32[1];

But I get only one channel

float* finalOutput = data.outputs[0].channelBuffers32[0];|

Incidentally the audio is heard on both speakers.

The moment I try

float* rightOutput = data.outputs[0].channelBuffers32[1];

It throws up build error.

What gives ? How can I get access to channelBuffers32[0] and channelBuffers32[1] independently

Which host are you using? Do you have a custom implementation for IAudioProcessor::setBusArrangement(..) or IAudioProcessor::getBusArrangement(..)?

I have tried with multiple DAWs.- SDK included TestHost, Reaper and Cakewalk.

I have not set up any specific bus arrangement with setBusArrangement. Am I supposed to do that ?

Normally not.
What’s the number in data.outputs[0].numChannels?

This shows as 2.

That all looks correct. Something else must be wrong in your code as the host is required to provide valid buffers in the process function (when numSamples > 0).

I am not sure what the issue was but setBusArrangements solved the issue.

tresult PLUGIN_API SProcessor::setBusArrangements(Steinberg::Vst::SpeakerArrangement* inputs, int32 numIns, Steinberg::Vst::SpeakerArrangement* outputs, int32 numOuts)
// one stereo output bus
if (numIns == 0 && numOuts == 1 && outputs[0] == Vst::SpeakerArr::kStereo)
return AudioEffect::setBusArrangements(inputs, numIns, outputs, numOuts);
return kResultFalse;

1 Like