Spacechild1 / vstplugin

VST plugin support for Pd and SuperCollider (mirror of https://git.iem.at/pd/vstplugin). If possible, use the issue tracker at https://git.iem.at/pd/vstplugin/-/issues.
Other
84 stars 6 forks source link

ReaEQ plugin crashes but only for a few of its GUI elements #10

Closed ariutti closed 1 year ago

ariutti commented 1 year ago

Hi guys, I am taking my first steps with the VSTPlugin Quark in SuperCollider.

I am working on

I wanted to use a simple graphical equalizer at the end of my sound pipeline, so I decided to load a plugin I am used to: the ReaEQ from Cockos.

Here is the code I am using, which is basically copied and pasted from the documentation.

s.boot;

(
SynthDef(\insert, { arg bus;
    Out.ar(bus, VSTPlugin.ar(In.ar(bus, 2), 2));
    //ReplaceOut.ar(bus, VSTPlugin.ar(In.ar(bus, 2), 2));
}).add;
)

// create the synth:
~synth = Synth(\insert, [\bus, 0]);

// get a handle to the VSTPlugin:
~fx = VSTPluginController(~synth);

// open a plugin by name/key (might require VSTPlugin.search!)
~fx.open("C:/Program Files/VSTPlugins/ReaPlugs/reaeq-standalone.dll", editor: true, verbose: true);

~fx.numParameters; // il plugin reaEQ ha 12 parametri

// show the generic plugin GUI:
~fx.gui;

// show the VST editor:
~fx.editor(show:true);

I first notice that on the SuperCollider side the plugin seems to have only 12 controllable parameters (evaluating these lines):

~fx.numParameters; 
~fx.gui; 

03_VST_gui

while opening the same plugin as a VST in insert within DAW Reaper, it also shows some other controllable parameters such as:

01_VST_da_Reaper

I notice that by opening the "proprietary" plugin interface through the VSTPluginController (method .editor(show:true) ), it is cropped and does not show all the GUI elements.

02_VST_da_SC

In addition, the plugin crashes whenever I attempt to change any of the settings, it would seem, that are not among the 12 "really" visible by SuperCollider.

How to fix this? Thank you so much for your great work and for your help and support

Spacechild1 commented 1 year ago

Thanks for the report! Note that the ReaPlugs VST plugins are not the same thing as the plugins included in Reaper. The latter use custom VST extensions that are only supported by REAPER (https://www.reaper.fm/sdk/vst/vst_ext.php), so certain features are not available in the "plain" VST version.

In addition, the plugin crashes whenever I attempt to change any of the settings, it would seem, that are not among the 12 "really" visible by SuperCollider.

Which parameters for example?

ariutti commented 1 year ago

Thank you @Spacechild1 for your reply, I crash it everytime I use the:

Spacechild1 commented 1 year ago

Ok, I see the problem. The plugins send a weird parameter change message whenever you automate one of these parameters. The Pd version can handle it, but the SC version apparently doesn't. Should be an easy fix.

The wrong window dimension is annoying. I hope I can fix it!

Spacechild1 commented 1 year ago

The crash should now be fixed on the develop branch. Please give it a try!

Regarding the window size bug: this might take a while to fix, but as a workaround you can change the bool Window::canResize method implementation in WindowWin32.cpp to the following:

bool Window::canResize(){
    return true;
}

This way the window will at least be resizable.

ariutti commented 1 year ago

Thank you so much @Spacechild1 for your instructions. I was able to compile it from the develop branch (also using your workaround for the resize).

Now it works as expected:

Don't know if this can be useful or not but now if I add a new band and moving some of its parameters, I see some warning messages on the post windows complaining I'm using out of range parameters.

04_VST_gui_now_not_crash_and_resizable

I believe this is normal behavior since, at an initial calculation, when the plugin was first loaded, there were only 12 editable parameters. The new band controls doesn't appear in the default editor when I evaluate the .gui method on the VSTPluginController instance.

Despite this, the changes to the additional bandwidth made on the plugin GUI are yes affecting the audio signal!

I forgot to mention that when I work instead on the vertical slider named "Gain" from the plugin interface, this graphic element does not result in any warning message in the post windows. Although it is actually affecting the audio, this parameter was not counted among the 12 parameters initially available (it is not even visible in the default SC gui).

Is this because such a slider has some different behavior than the other controls?

(BTW: this project is super cool - congratulations and thank you very much for your work)

Spacechild1 commented 1 year ago

I believe this is normal behavior since, at an initial calculation, when the plugin was first loaded, there were only 12 editable parameters. The new band controls doesn't appear in the default editor when I evaluate the .gui method on the VSTPluginController instance.

Yes, that's exactly what's happening. I've now pushed another fix to develop that completely ignores out-of-range parameter automation messages.

Is this because such a slider has some different behavior than the other controls?

For whatever reason, the "Gain" slider is not part of the exposed VST parameters.

To be honest, the ReaPlugs implementation is a bit wonky. There is no reason why these parameters should be hidden from the generic interface in the first place.

Spacechild1 commented 1 year ago

Looks like the wrong window size of ReaPlugs has already been reported (https://git.iem.at/pd/vstplugin/-/issues/171), so I think I can close this issue.

Thanks again for reporting!