Hi guys,
a customer asked me to implement hard coded presets that will show in the DAW presets list. For our plugins we usually use our own presets management, which works fine, so I never had the chance to work on this kind of presets management.
I tried a raw test using a StringArray for preset names, an int to store the current preset idx and just a switch to change a single parameter.
int MyAudioProcessor::getNumPrograms()
{
//DBG("getNumPrograms");
return 2;
}
int MyAudioProcessor::getCurrentProgram()
{
DBG("getCurrentProgram");
return currPresetNum;
}
void MyAudioProcessor::setCurrentProgram (int index)
{
DBG("setCurrentProgram: " << index);
if((Time::getMillisecondCounter()-setChunkCalled)<200)
return;
switch(index)
{
case 0:
gainKnobParam->setValueNotifyingHost(0.0f);
break;
case 1:
gainKnobParam->setValueNotifyingHost(0.7f);
break;
}
}
const String MyAudioProcessor::getProgramName (int index)
{
return presetNames[index];
}
This works fine on AU and VST2, but VST3 doesn’t seem to call setCurrentProgram at all. It just goes to getCurrentProgram, then getStateInformation.
Any advice about how to handle that?
Thanks