(Dynamic) Bus Arrangement for Instruments

There have already been questions about bus arrangement for effect plugins and there is some good documentation about it, but we have problems figuring out how it works for instruments.

Can instruments be realized that support multiple output arrangements?
I can see two ways for the user to select the audio output arrangement:

  1. by routing the instrument to a bus that has the desired input configuration (upon creation of instance)
  2. and by selecting the configuration in the plugin GUI leaving it to the plugin to adapt the outputs.

Asking for Cubase for example. As I understand, generally, first the plugin just adds default audio inputs/outputs (https://developer.steinberg.help/display/VST/Frequently+Asked+Questions#FrequentlyAskedQuestions-Q:Myplug-iniscapableofprocessingallpossiblechannelconfigurations.) and then the host usually makes a suggestion for which arrangement to use according to the track layout etc…

For Cubase it seems, that the host does not make a suggestion for instruments (i.e. not calling setBusArrangement()). This makes sense because instruments don’t (need to) have audio inputs. But the output configuration could be guessed like described above in (1.).

The way it is, the plugin just starts with its default configuration. Unfortunately, dynamically changing it through user interaction does not seem to work quite correctly (in Cubase at least). After calling restartComponent(kIoChanged) from the UI thread, AudioEffect::getBusArrangement() is called and we change the audio outputs and return the new arrangement. In the next call to AudioEffect::process() the value of processData.outputs.numChannels has the correct value but Cubase still displays the old speaker arrangement in the channel settings.

However, the host still displays the old speaker arrangement in the “Channel Settings” window. Also, from then on, no sound is to the destination. I can verify though that the output buffers are still filled with valid audio.

Is this just a Cubase issue or are we missing something here? Are there known cases of VST instruments with variable output configuration?

This is a current limitation of Cubase: it is not yet possible to change the associated channels arrangements according to the instrument plugin outputs later on.
One workaround is that the plugin saves somewhere what it wants and then ask to restart or ask the user to reload the plugin and provide at instantiation the wanted arrangement.

1 Like

Thank you Yvan. This is probably the best solution.
Do you know if there is there a way to ask the host if it supports a certain speaker arrangement? It would be problematic to offer formats that the host itself might not be able handle or crash upon.

Otherwise I can only think of getting the host name via IHostApplication and hard-coded enable the supported arrangements.

No there for now no interface allowing a plugin to ask if a specific arrangement is supported for a given input or output bus of the plugin.
Normally a host should always be prepared to handle all kind of arrangement by providing the correct number of buffer to the plugin.
The workaround with the host name is not recommended!
Which kind of use case you are trying to cover?

We did some testing and errors we encountered before for certain formats had a different cause that could be fixed. Looks good so far. It would be great to visually disable formats that are not supported by the host (we target most available formats) but I can see this is not feasible for now.

Is it guaranteed that Processor::setState() is called before the host asks for the bus arrangement? From the call sequence diagrams it looks like it is. Otherwise it would be hard to distinguish instantiation of a new plugin in a project from recalling a session in time to provide the wanted arrangement in the first case. Is this the recommended way to achieve this?

The plugin should be prepared for the case, not only for project loading, but loading a preset too, to inform the host that after a state load (setState) its current arrangements may have changed, if the host did not already ask for the arrangement you may not need to inform the host about this new arrangements, else or by default you have to call restartComponent with IOChanged.

1 Like

Okay, thanks a lot!