OSC: only show visible plugins (not MB channel strip PI)
authorLen Ovens <len@ovenwerks.net>
Fri, 23 Jun 2017 05:37:38 +0000 (22:37 -0700)
committerLen Ovens <len@ovenwerks.net>
Fri, 23 Jun 2017 05:40:06 +0000 (22:40 -0700)
libs/surfaces/osc/osc.cc
libs/surfaces/osc/osc.h
libs/surfaces/osc/osc_select_observer.cc

index 90989c5d18938f1304fec602f0b28d641de84aa3..e47e14532747a07ce8c00cc1f9e6cd35f9b81169 100644 (file)
@@ -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<Processor> proc = r->nth_plugin (nplugs);
+                                       boost::shared_ptr<PluginInsert> pi;
+                                       if ((pi = boost::dynamic_pointer_cast<PluginInsert>(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<Processor> proc = r->nth_plugin (sur->plugin_id - 1);
+               boost::shared_ptr<Processor> proc = r->nth_plugin (sur->plugins[sur->plugin_id - 1]);
                boost::shared_ptr<PluginInsert> pi;
                if (!(pi = boost::dynamic_pointer_cast<PluginInsert>(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<Processor> proc = r->nth_plugin (sur->plugin_id - 1);
+       boost::shared_ptr<Processor> proc = r->nth_plugin (sur->plugins[sur->plugin_id - 1]);
        boost::shared_ptr<PluginInsert> pi;
        if (!(pi = boost::dynamic_pointer_cast<PluginInsert>(proc))) {
                return 1;
index 02002cb828feb3888add4486931edd0276b7329d..faa5f79c2e20d0511703b33a3c7ee5d1ad222ff9 100644 (file)
@@ -126,6 +126,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
                uint32_t plug_page_size;        // plugin page size (number of controls)
                int plugin_id;                  // id of current plugin
                std::vector<int> plug_params; // vector to store ports that are controls
+               std::vector<int> 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
index e8b26a3f4a9cf41dbfc7879ac13e1c7fe6a44e80..2786aafcf84269c6361f50c7150290a4027b54e0 100644 (file)
@@ -326,7 +326,7 @@ OSCSelectObserver::plugin_init()
        }
 
        // we have a plugin number now get the processor
-       boost::shared_ptr<Processor> proc = r->nth_plugin (sur->plugin_id - 1);
+       boost::shared_ptr<Processor> proc = r->nth_plugin (sur->plugins[sur->plugin_id - 1]);
        boost::shared_ptr<PluginInsert> pi;
        if (!(pi = boost::dynamic_pointer_cast<PluginInsert>(proc))) {
                return;