Hard coded presets

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

I could be wrong but IIRC this can be avoided altogether by saving .aupreset and .vstpreset files in the correct location. On macOS this would be /Library/Audio/Presets/<Manufacturer>/<Plugin Name> organise your presets into directories if you want and it should be picked up and reflected in most DAWs. I can’t recall where they should be for AAC presets or where they should be on Windows but with a little bit of digging I’m sure you could figure it out. It’s worth checking what gets installed by other developers as a hint.

Thanks Anthony. I was already aware of that way, but it’s not what I’m trying to do. Having to supply the plugin with different preset formats for different platforms it’s not the way to go for our client. If the client will agree to not having hard coded presets, we could implement our own presets system which is already works fine on every DAW and every OS. I’m just wondering if there’s a way to get VST3 working the way I’m trying.

For our VST3 presets, we put our .vstpreset files into our project’s binary resources, which the plugin copies to the expected location when first launched. That way our installers don’t have to worry about them, and they show up in VST3 hosts as expected.

3 Likes