program selection

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Is there a function that host calls when user changes program in the drop down list of plugin window?

Post

there is

virtual void setProgram (VstInt32 program) { curProgram = program; }

which you can override

Post

Actually, I checked setProgram() at first, and it wasn't called by the host when the event happened. Code within the function wasn't executed, and I also hit a breakpoint inside the function, but debugger didn't get to the breakpoint, when the event occured.

Post

Hmm that is odd. you could try just trapping the message

Post

It only works if you select a program from the host. If you select a program from the plugin window, the host will not call anything (however, the plugin should call updateDisplay() to notify the host that the current program has changed)

Post

Where is the item selection event actually handled? We don't create the control that contains the list of programs; it's created automatically by the host. Shouldn’t setPorgram() be called somewhere, when the program is selected from the list?

Post

if the list is part of the host UI, then yes, selecting an item in the list should call setProgram()
Just double-check your method signature. It should be:

Code: Select all

virtual void setProgram (VstInt32 program);

Post

Big Tick wrote:if the list is part of the host UI, then yes, selecting an item in the list should call setProgram()
Just double-check your method signature. It should be:

Code: Select all

virtual void setProgram (VstInt32 program);
Programs list, on the top of plugin window.
Last edited by user125 on Tue Sep 01, 2015 12:32 am, edited 1 time in total.

Post

Ok, the problem is solved. My function was declared like this:

Code: Select all

virtual void setProgram (long program);
and after changing the parameter to VstInt32, setProgram() is called by the host after selection.

Post

A classic c++ bug....

In order to avoid it, make sure you use the c++11 override keyword. If you had declared your function like this:

Code: Select all

virtual void setProgram (long program) override;
the compiler would have complained immediately, saving you hours of debugging time.

Post

+1 for override. And turn these warnings to errors even!

Post Reply

Return to “DSP and Plugin Development”