refreshParameterList() and varying parameter arrays

Sorry for bringing this up once again but none of the topics my searches returned explained the topic to an end and I’m looking for an answer here to base a potential new JUCE project on.

I’m thinking about developing a sampler that can load different multisample instruments.

Now if an instrument A has 3 parameters

  • Attack
  • Decay
  • Volume

and an instrument B has 2

  • Volume
  • Pan

is there a way to change the AudioProcessor’s parameter array when instrument A is loaded and I then load instrument B? I can see methods of adding parameters but not for removing from or clearing the array.

Looking at the documentation of the AudioProcessor class seeing the function refreshParameterList() and especially the explaining sentences

A processor should implement this method so that the host can ask it to rebuild its parameter tree. If a plugin never changes its parameters, it's enough to create its parameters in its constructor and do nothing in this method, but some may want to

and also the function updateHostDisplay() gave me some hope.

So question:
Can I change the number of parameters, their names, ranges and resolution while the sampler plugin is instantiated i.e. at runtime? Maybe if I don’t support legacy VST2 but only VST3, AU and AAX (Mac & Win)? If so, what is best practice to do so? What is the alternative? Exposing a fixed number of meta parameters with generic names and map them to actually existing params? Is there a nicer alternative by now?

// EDIT:
Just seeing setParameterTree()… Is that what I should use? If yes - does it work in all major hosts?

Juce has currently very limited support for dynamically changing the plugin parameters. I don’t think anything in the parameters can be changed once they have been created.

@fabian: Can you shed some light on the issue?

I’m in a similar situation–I need to be able to edit the set of parameters exposed to the host, in particular add parameters. VST3 only is okay for my application.

In my case I’m not making a sampler, but a spatializer. Audio sources will be instances of the plugin on certain tracks, and the speaker/headphone outputs will be another instance on another track. They need to be in the same DLL because they share the same underlying spatializer (audio goes in from the source instances and comes out of the headphone instances). Since it appears that JUCE does not support having multiple VST3s identified in one single DLL (.vst3 file), I decided to approach it by having one plugin which you pick via the GUI (or via the saved state info) whether you want it to be a source or headphones. But, this means that the set of parameters need to be updated when this is set.

Adding the parameters “nicely” caused no change in the host; forcibly replacing them with setParameterTree() crashed the host (Reaper) as the docs said it would.

Any suggestions? Do I have to resort to making a pure VST3 without Juce (or heavily hacking the format)? Or make them different VST3s and use sockets or pipes to send the audio between them?