Skip to content

Commit

Permalink
osc: Send /select/plugin plugin_id feedback
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
matthijskooijman committed Jun 28, 2024
1 parent 41b6c8a commit 748d8e6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libs/surfaces/osc/osc_select_observer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,8 @@ OSCSelectObserver::plugin_init()
plugin_end ();
return;
}
_osc.float_message (X_("/select/plugin"), plug_id, addr);

std::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
// we have a plugin we can ask if it is activated
proc->ActiveChanged.connect (plugin_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::plug_enable, this, X_("/select/plugin/activate"), proc), OSC::instance());
Expand Down Expand Up @@ -558,6 +560,7 @@ void
OSCSelectObserver::plugin_end ()
{
plugin_connections.drop_connections ();
_osc.float_message (X_("/select/plugin"), -1, addr);
_osc.float_message (X_("/select/plugin/activate"), 0, addr);
_osc.text_message (X_("/select/plugin/name"), " ", addr);
for (uint32_t i = 1; i <= plug_size; i++) {
Expand Down

0 comments on commit 748d8e6

Please sign in to comment.