VST Plugins Using... Not ASCII

Hi Jules,

It turns out that VST plugins don’t always dispatch text, like parameter names and parameter text, in ASCII…

Would you mind adding the following fixes/minor changes to the VSTPluginInstance?

String getParameterLabel (int index) const
{
    if (effect != nullptr)
    {
        jassert (index >= 0 && index < effect->numParams);

        char nm [256] = { 0 };
        dispatch (effGetParamLabel, index, 0, nm, 0);
        return String (CharPointer_UTF8 (nm)).trim(); //Modified here
    }

    return String::empty;
}
const String getParameterName (int index)
{
    if (effect != nullptr)
    {
        jassert (index >= 0 && index < effect->numParams);

        char nm [256] = { 0 };
        dispatch (effGetParamName, index, 0, nm, 0);
        return String (CharPointer_UTF8 (nm)).trim(); //Modified here
    }

    return String::empty;
}
const String getParameterText (int index)
{
    if (effect != nullptr)
    {
        jassert (index >= 0 && index < effect->numParams);

        char nm [256] = { 0 };
        dispatch (effGetParamDisplay, index, 0, nm, 0);
        return String (CharPointer_UTF8 (nm)).trim(); //Modified here
    }

    return String::empty;
}

Also, I have a minor adjustment if you’re interested - would help DRY:

    String getTextForOpcode (int index, AEffectOpcodes opcode) const
    {
        if (effect != nullptr)
        {
            jassert (index >= 0 && index < effect->numParams);

            char nm [256] = { 0 };
            dispatch (opcode, index, 0, nm, 0);
            return String (CharPointer_UTF8 (nm)).trim();
        }

        return String::empty;
    }
    const String getParameterName (int index)
    {
        return getTextForOpcode (index, effGetParamName);
    }
    const String getParameterText (int index)
    {
        return getTextForOpcode (index, effGetParamDisplay);
    }
    String getParameterLabel (int index) const
    {
        return getTextForOpcode (index, effGetParamLabel);
    }

Great suggestion, thanks! I’ll sort that out…