program selection
-
- KVRian
- 1256 posts since 15 Mar, 2007 from Yorkshire, England
there is
virtual void setProgram (VstInt32 program) { curProgram = program; }
which you can override
virtual void setProgram (VstInt32 program) { curProgram = program; }
which you can override
-
- KVRer
- Topic Starter
- 27 posts since 9 Oct, 2014
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.
-
- KVRian
- 1256 posts since 15 Mar, 2007 from Yorkshire, England
Hmm that is odd. you could try just trapping the message
-
- KVRAF
- 3388 posts since 29 May, 2001 from New York, NY
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)
-
- KVRer
- Topic Starter
- 27 posts since 9 Oct, 2014
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?
-
- KVRAF
- 3388 posts since 29 May, 2001 from New York, NY
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:
Just double-check your method signature. It should be:
Code: Select all
virtual void setProgram (VstInt32 program);
-
- KVRer
- Topic Starter
- 27 posts since 9 Oct, 2014
Programs list, on the top of plugin window.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);
Last edited by user125 on Tue Sep 01, 2015 12:32 am, edited 1 time in total.
-
- KVRer
- Topic Starter
- 27 posts since 9 Oct, 2014
Ok, the problem is solved. My function was declared like this:
and after changing the parameter to VstInt32, setProgram() is called by the host after selection.
Code: Select all
virtual void setProgram (long program);
-
- KVRAF
- 3388 posts since 29 May, 2001 from New York, NY
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:
the compiler would have complained immediately, saving you hours of debugging time.
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;
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
+1 for override. And turn these warnings to errors even!