We have uncovered a potential bug in Cubase when loading VST3 Spatial FX plugins such as the one we have developed. Our plugin implements the VSTSingleComponentEffect class is registered as a Spatial FX plugin in the factory registration by choosing Steinberg::Vst::PlugType::kFxSpatial as the subcategory of the PClassInfo instance created.
Here are the steps to reproduce:
- Create empty project
- Add an audio track
- Add plugin to the track’s plugin chain
- Hit play
On debugging our plugin with Cubase, we see that the process call:
Steinberg::tresult PLUGIN_API process(Steinberg::Vst::ProcessData& ioData)
is initially called with iodata having numInputs = 1, numOutputs = 1 and numSamples = 256 on every callback when instantiating our plugin. However, shortly after with no user action at all, these change immediately to numInputs = 0, numOutputs = 0 and numSamples = 0 which signifies a “flush” and hence our plugin stops doing any processing on these callbacks. The plugin stays in this bad state indefinitely after this unless a Delay or Modulation plugin is also added to the plugin chain on the same track in Cubase, where it goes back to having process calls with numSamples = 256, numInputs and numOutputs = 1 and hence we do processing on the callback.
I am also seeing the same issue (process calls with numSamples = 0) with the sample AGain plugin provided in the VST SDK. The only scenario where the AGain plugin does not exhibit this behavior is on playing back a recorded track. The ADelay plugin does not exhibit this bug because it is of the “Fx|Delay” subcategory. On hacking the AGain plugin’s factory registration in its source code to “Fx|Delay” from its original “Fx”, it stops exhibiting this bug.
I tried changing the factory registration of our plugin to “Fx|Delay” subcategory and this fixed the issues described above in our plugin as well, i.e.: it behaves like it should in all the possible use cases, eg: right after instantiating, playing, recording automation, playing back, etc.
Another important thing to note is that without any of the above hacks/changes, our plugin configured as a Spatial FX plugin during factory registration behaves completely fine using Nuendo as a host. For this reason, we believe that this is a bug in Cubase where it is handling the audio process callbacks differently depending on what subcategory type of plugins are in the plugin chain on a track.
Can this behavior be changed so that Spatial Fx plugins and other types of plugins don’t behave this way? Or is this a limitation of Cubase? We would like to not hack our plugin factory registration to incorrectly be of “Fx|Delay” plugin subcategory just to get it to behave, when it is really a Spatial FX plugin. We would also prefer that our users not have to add another plugin to the plugin chain on their tracks just to get our plugin to work properly on Cubase.