Juce VST3, parameter IDs

Hey guys,

I have had some problems with my JUCE VST3 plugins and have found some fixes and possible enhancements to the JUCE VST3 wrapper code, however I do believe that this should be wrapped in a flag JUCE_VST3_PARAMIDS so that old projects will persist.

#My problems were:

  • When I used any hidden parameters and set an automation envelope it would set the wrong parameter.
  • If I had automation envelopes and changed the order of my parameters the automation envelopes would edit the wrong parameters.

My fixes were just a few changes to the VST3 wrapper and one added function to the audio processor.

#The change to the audio processor:
To the audio processor I added a function:

 const uint32 AudioProcessor::getParameterID( int index )
    	if ( AudioProcessorParameter* p = getParamChecked( index ) )
    		if ( AudioProcessorParameterWithID* paramWithID = dynamic_cast<AudioProcessorParameterWithID*>( p ) )
                    return paramWithID->paramID.hashCode();
    		    return index;
    	return index;

which returns a parameterID (provided you are using the AudioProcessorParameterWithID class and attempts to make a uin32 ID From the string using the juce hasCode(), maybe there is a better way to do this part or a check for uniqueness here. If you are not using these parameterWithIDs then it will return index (basically how it works now).

#The change to the VST3_Wrapper
In the vst3 wrapper I introduced the member variables:

std::map<int, Vst::ParamID> ParamNumtoID;
std::map<Vst::ParamID, int> IDtoParamNum;

to the JuceVST3EditController class. These will serve as a mapping from Index to ID for the vst3.
In order to populate this list in the Param constructor I changed

info.id = (Vst::ParamID) index;


info.id = (Vst::ParamID) p.getParameterID(index);

I populate the maps in the setupParameters call and after that all throughout that class Instead of casting the index to a vst::ParamID to edit parameters I get the associated paramID with ParamNumtoID[index].

The final change was in the JuceVST3Component::processParameterChanges, just simply changing the line:

const int id = (int) paramQueue->getParameterId();


const int id = juceVST3EditController->IDtoParamNum[paramQueue->getParameterId()];

This way whenever the host wants to change a parameter, it sends the parameter and the plugin changes the appropriate parameter as opposed to the parameter at that index. This allows users to use Juce’s AudioProcessorParameterWithID with VST3 as well as setting parameters to hidden without fear of messing with automation. I dont think this causes any consequences on new projects however it will break automation persistence with old projects so I definitely recommend putting it behind a flag JUCE_VST3_PARAMIDS.

(Might make it easier to read those code snippets if you use the </> button on them)

Hmm I am doing that and, in the editor, it is adjusting their tabbing but not in the display.

You need to leave a blank line above + below the code

Awesome Thanks should be fixed now.

OK, thanks… We’ll have a think about all this, it’s something we were discussing anyway.

Also relevant to this subject is what has been said in this topic: Problem with VST3 Bypass implementation

Yes. I’ll have a look at this. I have fixed this for AU already but the other formats need fixing as well

Please see this post for a fix to this bug.