MultiOut Synth Plugin


I am trying to use the MultiOutSynth Plugin example and modify it so that it can load more than one sample sound (the singing.ogg). I do not know where (or really how) to put a “if/else” statement to get it to choose another synth sound based on the user changing the choice. Here is what I did, although it only plays the same singing.ogg on every choice.

for (int midiChannel = 0; midiChannel < maxMidiChannel; ++midiChannel)
synth.add (new Synthesiser());
for (int i = 0; i < maxNumberOfVoices; ++i)
synth[midiChannel]->addVoice (new SamplerVoice());

	  if (currentProgram = 0)
		loadNewSample(BinaryData::snaredrum_ogg, BinaryData::snaredrum_oggSize);
	  else if (currentProgram = 1)
		loadNewSample2(BinaryData::singing_ogg, BinaryData::singing_oggSize);

~MultiOutSynth() {}         ................................

I also have placed this in there (from the AVSynth), which allows you to choose other sounds.

const String getName() const override { return “MultiOutSynth”; }
bool acceptsMidi() const override { return true; }
bool producesMidi() const override { return false; }
double getTailLengthSeconds() const override { return 0; }
//int getNumPrograms() override { return 1; }
int getNumPrograms() override { return 4; }
int getCurrentProgram() override { return currentProgram; }
void setCurrentProgram(int index) override { currentProgram = index; }
const String getProgramName(int index) override
switch (index)
case 0:
return “Piano”;
case 1:
return “singing”;
case 2:
return “pinched ballloon”;
case 3:
return “Gazeebo”;
return “”;

void changeProgramName(int /*index*/, const String& /*name*/) override { }

Any help would be greatly appreciated. I am new to c++ and find it more difficult than c# and other program languages. It seems very strict and structured.