//----------------------------------------------------------------------------- SurroundDelay::SurroundDelay (audioMasterCallback audioMaster) : ADelay (audioMaster) , plugInput (0) , plugOutput (0) { // The first buffer is allocated in ADelay's constructor for (int i = 1; i < MAX_CHANNELS; i++) { sBuffers[i] = new float[size]; } setNumInputs (MAX_CHANNELS); setNumOutputs (MAX_CHANNELS); // We initialize the arrangements to default values. // Nevertheless, the host should modify them via // appropriate calls to setSpeakerArrangement. allocateArrangement (&plugInput, MAX_CHANNELS); plugInput->type = kSpeakerArr51; allocateArrangement (&plugOutput, MAX_CHANNELS); plugOutput->type = kSpeakerArr51; setUniqueID ('SDlE'); // this should be unique, use the Steinberg web page for plugin Id registration // create the editor editor = new SDEditor (this); resume (); }
//------------------------------------------------------------------------------------------------------- bool AudioEffectX::matchArrangement (VstSpeakerArrangement** to, VstSpeakerArrangement* from) { if (from == NULL) return false; if ((!deallocateArrangement (to)) || (!allocateArrangement (to, from->numChannels))) return false; (*to)->type = from->type; for (int i = 0; i < (*to)->numChannels; i++) { if (!copySpeaker (&((*to)->speakers[i]), &(from->speakers[i]))) return false; } return true; }
//------------------------------------------------------------------------ bool SurroundDelay::setSpeakerArrangement (VstSpeakerArrangement* pluginInput, VstSpeakerArrangement* pluginOutput) { if (!pluginOutput || !pluginInput) return false; bool result = true; // This plug-in can act on any speaker arrangement, // provided that there are the same number of inputs/outputs. if (pluginInput->numChannels > MAX_CHANNELS) { // This plug-in can't have so many channels. So we answer // false, and we set the input arrangement with the maximum // number of channels possible result = false; allocateArrangement (&plugInput, MAX_CHANNELS); plugInput->type = kSpeakerArr51; } else { matchArrangement (&plugInput, pluginInput); } if (pluginOutput->numChannels != plugInput->numChannels) { // This plug-in only deals with symetric IO configurations... result = false; matchArrangement (&plugOutput, plugInput); } else { matchArrangement (&plugOutput, pluginOutput); } return result; }