Plugin Host. 'Summing' VST3/VST2 plugin outputs to AudioDevice Buffer

I have submitted a request to have my original post to be deleted.

I am writing a Superior Drummer 3 ‘Grid Editor’ type thing that I will utilize
with Steven Slate Drums SSD5, but it would not hurt it it also worked with
other drum VST’s like MT Power Drumkit.

In the end I will utilize it as a plug in in my DAW for editing purposes but decided to start it as a ‘standalone’ application (bad idea!).

My questions are from the view point of a VST host, not a VST plugin.

My issue seems to be a difference between the way a VST3 VST are acting.

My real question here is toward the bottom in:

void _rMidiAudioDeviceCallBack::ProcessorCallBack(juce::AudioBuffer *AudioDeviceBuffer)
‘// Questions / Confusion’

I have 4 plugins that have more than one output buses:
– IkMultiMedia Philharmonik 2 (VST3), 16 stereo buses, 32 channels.
I am using this because it is the only mutli channel VST3 I Own.
– Steven Slate SSD4 (VST), 8 Stereo Buses, 8 Mono Buses, 24 channels.
– Steven Slate SSD5 (VST), 24 Stereo buses, 48 channels.
– MT Power Drumkit (VST) 2 8 Stereo Buses, 16 Channels.

The Philharmonik works (empirically) as expected, sound on all buses / channels.
It is a VST3. I understand that this is ‘working’ due to the fact that the
VST3 is ‘summing’ the channels.

(I understand this is an incorrect statement. It is empirically based):
The VST’s (SSD4, SSD5, MT Power Drumkit) will only produce sound on bus[0], Stereo 1, Channels 0,1.

Please forgive the this->, I like to type!

I start by loading plugins as follows:
A VST3:

int _rMidiStandAlone::LoadVst3PlugIn(
std::unique_ptr *PlugInPtr,juce::String PlugInPath,
juce::OwnedArrayjuce::PluginDescription *ThePlugInDescriptionPtr)
{juce::VST3PluginFormat *Format=(juce::VST3PluginFormat *)nullptr;

this->_rMidiStandAloneError=109;
if((Format=new juce::VST3PluginFormat()))
{
this->CurrentPlugInFormat=_rMidiStandAlone::AttributesValueEnum::Xml_AttributeValue_Vst3;

(this->LoadPlugInGeneric)(Format,PlugInPtr,PlugInPath,ThePlugInDescriptionPtr);
delete Format;
Format=(juce::VST3PluginFormat *)nullptr;
} // End if((Format=new juce::VST3PluginFormat()))

return(this->_rMidiStandAloneError);
}

A VST:

int _rMidiStandAlone::LoadVstPlugIn(
std::unique_ptr *PlugInPtr,
juce::String *PlugInPath,
juce::OwnedArrayjuce::PluginDescription *ThePlugInDescriptionPtr)
{juce::VSTPluginFormat *Format=(juce::VSTPluginFormat *)nullptr;

this->_rMidiStandAloneError=107;
if((Format=new juce::VSTPluginFormat()))
{
(this->LoadPlugInGeneric)(Format,PlugInPtr,PlugInPath,ThePlugInDescriptionPtr);
delete Format;
Format=(juce::VSTPluginFormat *)nullptr;
} // if((Format=new juce::VSTPluginFormat()))

return(this->_rMidiStandAloneError);
}

Both of the above methods call:

int _rMidiStandAlone::LoadPlugInGeneric(
juce::AudioPluginFormat *Format,std::unique_ptr *PlugInPtr,
juce::String *TargetPlugInPath,
juce::OwnedArrayjuce::PluginDescription *ThePlugInDescriptionPtr)
{
(Format->findAllTypesForFile)(*ThePlugInDescriptionPtr,*TargetPlugInPath);

this->_rMidiStandAloneError=110;
if((ThePlugInDescriptionPtr->size)())
{
this->_rMidiStandAloneError=111;
if(*PlugInPtr=(Format->createInstanceFromDescription)(*ThePlugInDescriptionPtr[0].getFirst(),((this->GetAudioIo)()->GetSampleRate)(),((this->GetAudioIo)()->GetBufferSize)()))
{
this->_rMidiStandAloneError=59;
if(((*PlugInPtr)->enableAllBuses)()) // Even Though They Are Already All Enabled.
{
this->_rMidiStandAloneError=0;
}
}
} // End if((this->NewPlugInDescription->size)())

return(this->_rMidiStandAloneError);
}

I have had this code running and commented out.
It has not effect (changes nothing) whether it runs or not:

BusLayout=(PlugInPtr->getBusesLayout)();

if((PlugInPtr->checkBusesLayoutSupported)(BusLayout))
{
(DebugLogFile->LogMessage)(_T(“BusLayout Is In Fact Supported”));
if((PlugInPtr->setBusesLayout)(BusLayout))
{
(DebugLogFile->LogMessage)(_T("(PlugInPtr->setBusesLayout)() Success"));
BusCount=0;
}
}

//=================================================================
When I ‘Set’ my processor within my AudioDeviceCallBack:

void _rMidiAudioDeviceCallBack::SetProcessor(juce::AudioProcessor *const TheProcessor)
{bool SupportsDouble;
.
.
.

// _rMidiAudioDeviceCallBack::PlugInOutPutChannels. PlugInOutPutChannels;
// (TheProcessor->getTotalNumOutputChannels)() is returning the correct number of channels.
(this->PlugInOutPutChannels.calloc)((TheProcessor->getTotalNumOutputChannels)());

(TheProcessor->setRateAndBufferSizeDetails)(this->SampleRate,this->BlockSize);

SupportsDouble=((TheProcessor->supportsDoublePrecisionProcessing)()&&this->IsDoublePrecision);

(TheProcessor->setProcessingPrecision)(SupportsDouble?AudioProcessor::doublePrecision:AudioProcessor::singlePrecision);

(TheProcessor->prepareToPlay)(this->SampleRate,this->BlockSize);
.
.
.
}

Finally, when my audioDeviceIOCallback() fires and I have a Processor:

void _rMidiAudioDeviceCallBack::ProcessorCallBack(juce::AudioBuffer *AudioDeviceBuffer)
{juce::AudioBuffer *MyPlugInOutputs=(juce::AudioBuffer *)nullptr;
int TheNumberOfChannels=jmax((this->Processor->getTotalNumInputChannels)(),(this->Processor->getTotalNumOutputChannels)());

// TheNumberOfChannels Is Always Correct, VST3:32, VST2: SSD4:24, SSD5:48, MT PowerKit:16
// _rMidiAudioDeviceCallBack::PlugInOutputData Is A juce::AudioBuffer
this->PlugInOutputData.setSize(TheNumberOfChannels,this->BlockSize);
this->PlugInOutputData.clear();

for(int i=0;i<TheNumberOfChannels;i++)
{
//_rMidiAudioDeviceCallBack::PlugInOutPutChannels Is A juce::HeapBlock<float *>
this->PlugInOutPutChannels[i]=this->PlugInOutputData.getWritePointer(i);
}

if((MyPlugInOutputs=new juce::AudioBuffer(this->PlugInOutPutChannels,(jmax((this-Processor->getNumInputChannels)(),(this->Processor->getNumOutputChannels)())),1024)))
{
(this->Processor->processBlock)(*MyPlugInOutputs,this->IncomingMidi);

// Questions / Confusion
// VST3:
// It seems to have ‘summed’ all 32 channels of Audio and has put the summed
// audio into MyPlugInOutputs[0] and MyPlugInOutputs[1].
// I currently do not understand why this is so.
// I would have expected 32 channels of data, without channels 0,1 being overwritten wit the summed audio.
//
// VST:
// It has not ‘summed’ all 16 (MT Power Kit as example) channels of audio.
// I assume that the audio output is still in each channel.
//
// So:
// - VST: How do I ‘sum’ the outputs of the 16 channels into the AudioDeviceBuffer channels?
// - VST/VST3: What do I do about the difference between a VST and VST3?
// Perhaps I am better off understanding how to tell the VST3 to not sum the channels
// and treat a VST and VST3 the same?
for (int i=0;i<(AudioDeviceBuffer->getNumChannels)();++i)
{
(AudioDeviceBuffer->copyFrom)(i,0,*MyPlugInOutputs,i,0,1024);
}

delete MyPlugInOutputs;
}

}

Any insight would be greatly appreciated.