Skip to content

Commit 748d8e6

Browse files
osc: Send /select/plugin plugin_id feedback
Whenever the active plugin changes (because the plugin changes or the selected strip changes), the name, some other properties and parameter values for the newly selected plugin is sent as feedback. However, there was no clear indication of which plugin was selected exactly. Applications or surfaces that need to know the active plugin could track the currently selected plugin by remembering the most recently selected index, but unexpected plugin changes (e.g. when switching to a strip with fewer plugins) and the asynchronous nature of OSC messages make this more complicated than it should be. By sending the active plugin id as feedback, clients do not have to guess. When no plugin is selected (e.g. on startup or when no strip is selected) or the currently selected index is not a plugin (but a some other kind of processor), a value of -1 is sent. This uses the `/select/plugin` message, which is also used to change the selected plugin. There is a slight discrepancy: the control messages accepts a delta on the selected plugin, while the feedback sends an absolute value.
1 parent 41b6c8a commit 748d8e6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

libs/surfaces/osc/osc_select_observer.cc

+3
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,8 @@ OSCSelectObserver::plugin_init()
486486
plugin_end ();
487487
return;
488488
}
489+
_osc.float_message (X_("/select/plugin"), plug_id, addr);
490+
489491
std::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
490492
// we have a plugin we can ask if it is activated
491493
proc->ActiveChanged.connect (plugin_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::plug_enable, this, X_("/select/plugin/activate"), proc), OSC::instance());
@@ -558,6 +560,7 @@ void
558560
OSCSelectObserver::plugin_end ()
559561
{
560562
plugin_connections.drop_connections ();
563+
_osc.float_message (X_("/select/plugin"), -1, addr);
561564
_osc.float_message (X_("/select/plugin/activate"), 0, addr);
562565
_osc.text_message (X_("/select/plugin/name"), " ", addr);
563566
for (uint32_t i = 1; i <= plug_size; i++) {

0 commit comments

Comments
 (0)