From 5aad9d9a336082844acddc44a051ddb851cd67ec Mon Sep 17 00:00:00 2001 From: Len Ovens Date: Thu, 22 Jun 2017 22:37:38 -0700 Subject: OSC: only show visible plugins (not MB channel strip PI) --- libs/surfaces/osc/osc.cc | 29 ++++++++++++++++++++++------- libs/surfaces/osc/osc.h | 1 + libs/surfaces/osc/osc_select_observer.cc | 2 +- 3 files changed, 24 insertions(+), 8 deletions(-) (limited to 'libs') diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 90989c5d18..e47e145327 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -2028,29 +2028,44 @@ OSC::_sel_plugin (int id, lo_address addr) // find out how many plugins we have bool plugs; int nplugs = 0; + sur->plugins.clear(); do { plugs = false; if (r->nth_plugin (nplugs)) { - /// need to check for mixbus channel strips (and exclude them) + if (r->nth_plugin(nplugs)->display_to_user()) { +#ifdef MIXBUS + // need to check for mixbus channel strips (and exclude them) + boost::shared_ptr proc = r->nth_plugin (nplugs); + boost::shared_ptr pi; + if ((pi = boost::dynamic_pointer_cast(proc))) { + + if (!pi->is_channelstrip()) { +#endif + sur->plugins.push_back (nplugs); +#ifdef MIXBUS + } + } +#endif + } plugs = true; nplugs++; } } while (plugs); // limit plugin_id to actual plugins - if (!nplugs) { + if (!sur->plugins.size()) { sur->plugin_id = 0; return 0; - } else if (nplugs < id) { - sur->plugin_id = nplugs; - } else if (nplugs && !id) { + } else if (sur->plugins.size() < (uint32_t) id) { + sur->plugin_id = sur->plugins.size(); + } else if (sur->plugins.size() && !id) { sur->plugin_id = 1; } else { sur->plugin_id = id; } // we have a plugin number now get the processor - boost::shared_ptr proc = r->nth_plugin (sur->plugin_id - 1); + boost::shared_ptr proc = r->nth_plugin (sur->plugins[sur->plugin_id - 1]); boost::shared_ptr pi; if (!(pi = boost::dynamic_pointer_cast(proc))) { PBD::warning << "OSC: Plugin: " << sur->plugin_id << " does not seem to be a plugin" << endmsg; @@ -3763,7 +3778,7 @@ OSC::select_plugin_parameter (const char *path, const char* types, lo_arg **argv return 1; } - boost::shared_ptr proc = r->nth_plugin (sur->plugin_id - 1); + boost::shared_ptr proc = r->nth_plugin (sur->plugins[sur->plugin_id - 1]); boost::shared_ptr pi; if (!(pi = boost::dynamic_pointer_cast(proc))) { return 1; diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index 02002cb828..faa5f79c2e 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -126,6 +126,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI uint32_t plug_page_size; // plugin page size (number of controls) int plugin_id; // id of current plugin std::vector plug_params; // vector to store ports that are controls + std::vector plugins; // stores allowable plugins with index (work around MB strip PIs) int send_page; // current send page uint32_t send_page_size; // send page size in channels PBD::ScopedConnection proc_connection; // for processor signal monitoring diff --git a/libs/surfaces/osc/osc_select_observer.cc b/libs/surfaces/osc/osc_select_observer.cc index e8b26a3f4a..2786aafcf8 100644 --- a/libs/surfaces/osc/osc_select_observer.cc +++ b/libs/surfaces/osc/osc_select_observer.cc @@ -326,7 +326,7 @@ OSCSelectObserver::plugin_init() } // we have a plugin number now get the processor - boost::shared_ptr proc = r->nth_plugin (sur->plugin_id - 1); + boost::shared_ptr proc = r->nth_plugin (sur->plugins[sur->plugin_id - 1]); boost::shared_ptr pi; if (!(pi = boost::dynamic_pointer_cast(proc))) { return; -- cgit v1.2.3