//------------------------------------------------------------------------ tresult PLUGIN_API AGainSimple::setBusArrangements (SpeakerArrangement* inputs, int32 numIns, SpeakerArrangement* outputs, int32 numOuts) { if (numIns == 1 && numOuts == 1) { if (inputs[0] == SpeakerArr::kMono && outputs[0] == SpeakerArr::kMono) { AudioBus* bus = FCast<AudioBus> (audioInputs.at (0)); if (bus) { if (bus->getArrangement () != SpeakerArr::kMono) { removeAudioBusses (); addAudioInput (USTRING ("Mono In"), SpeakerArr::kMono); addAudioOutput (USTRING ("Mono Out"), SpeakerArr::kMono); } return kResultOk; } } else { AudioBus* bus = FCast<AudioBus> (audioInputs.at (0)); if (bus) { if (bus->getArrangement () != SpeakerArr::kStereo) { removeAudioBusses (); addAudioInput (USTRING ("Stereo In"), SpeakerArr::kStereo); addAudioOutput (USTRING ("Stereo Out"), SpeakerArr::kStereo); } return kResultOk; } } } return kResultFalse; }
//------------------------------------------------------------------------ tresult PLUGIN_API AGain::setBusArrangements (SpeakerArrangement* inputs, int32 numIns, SpeakerArrangement* outputs, int32 numOuts) { if (numIns == 1 && numOuts == 1) { // the host wants Mono => Mono (or 1 channel -> 1 channel) if (SpeakerArr::getChannelCount (inputs[0]) == 1 && SpeakerArr::getChannelCount (outputs[0]) == 1) { AudioBus* bus = FCast<AudioBus> (audioInputs.at (0)); if (bus) { // check if we are Mono => Mono, if not we need to recreate the buses if (bus->getArrangement () != inputs[0]) { removeAudioBusses (); addAudioInput (STR16 ("Mono In"), inputs[0]); addAudioOutput (STR16 ("Mono Out"), inputs[0]); } return kResultOk; } } // the host wants something else than Mono => Mono, in this case we are always Stereo => Stereo else { AudioBus* bus = FCast<AudioBus> (audioInputs.at (0)); if (bus) { tresult result = kResultFalse; // the host wants 2->2 (could be LsRs -> LsRs) if (SpeakerArr::getChannelCount (inputs[0]) == 2 && SpeakerArr::getChannelCount (outputs[0]) == 2) { removeAudioBusses (); addAudioInput (STR16 ("Stereo In"), inputs[0]); addAudioOutput (STR16 ("Stereo Out"), outputs[0]); result = kResultTrue; } // the host want something different than 1->1 or 2->2 : in this case we want stereo else if (bus->getArrangement () != SpeakerArr::kStereo) { removeAudioBusses (); addAudioInput (STR16 ("Stereo In"), SpeakerArr::kStereo); addAudioOutput (STR16 ("Stereo Out"), SpeakerArr::kStereo); result = kResultFalse; } return result; } } } return kResultFalse; }