make control protocol's SelectByRID signal work, thus enabling MIDI binding maps...
authorPaul Davis <paul@linuxaudiosystems.com>
Sun, 14 Aug 2011 17:11:33 +0000 (17:11 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Sun, 14 Aug 2011 17:11:33 +0000 (17:11 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@9991 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_ops.cc
libs/surfaces/generic_midi/generic_midi_control_protocol.cc
libs/surfaces/generic_midi/midifunction.cc
libs/surfaces/generic_midi/midifunction.h

index d45d89a96e6106db35ce1c9c694b99dc4f34d90a..cf1619156f1252fdfce5db507461b19a6b480d51 100644 (file)
@@ -704,6 +704,7 @@ Editor::Editor ()
        ControlProtocol::ZoomIn.connect (*this, invalidator (*this), boost::bind (&Editor::temporal_zoom_step, this, false), gui_context());
        ControlProtocol::ZoomOut.connect (*this, invalidator (*this), boost::bind (&Editor::temporal_zoom_step, this, true), gui_context());
        ControlProtocol::ScrollTimeline.connect (*this, invalidator (*this), ui_bind (&Editor::control_scroll, this, _1), gui_context());
+       ControlProtocol::SelectByRID.connect (*this, invalidator (*this), ui_bind (&Editor::control_select, this, _1), gui_context());
        BasicUI::AccessAction.connect (*this, invalidator (*this), ui_bind (&Editor::access_action, this, _1, _2), gui_context());
 
        /* problematic: has to return a value and thus cannot be x-thread */
@@ -911,6 +912,32 @@ Editor::zoom_adjustment_changed ()
        temporal_zoom (fpu);
 }
 
+void
+Editor::control_select (uint32_t rid) 
+{
+       /* handles the (static) signal from the ControlProtocol class that
+        * requests setting the selected track to a given RID
+        */
+        
+       if (!_session) {
+               return;
+       }
+
+       boost::shared_ptr<Route> r = _session->route_by_remote_id (rid);
+
+       if (!r) {
+               return;
+       }
+
+       TimeAxisView* tav = axis_view_from_route (r);
+
+       if (tav) {
+               selection->set (tav);
+       } else {
+               selection->clear_tracks ();
+       }
+}
+
 void
 Editor::control_scroll (float fraction)
 {
index 55d78238f73fb13bda63c84c778e4ee63f1df929..e9960b3938c3b9394fd9bbb1643d4e4ed72116ee 100644 (file)
@@ -977,6 +977,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Gtk::HBox           edit_controls_hbox;
 
        void control_scroll (float);
+       void control_select (uint32_t rid);
        void access_action (std::string,std::string);
        bool deferred_control_scroll (framepos_t);
        sigc::connection control_scroll_connection;
index 29471aa913d5a05a995ac5058c70d6a8a29407f5..07aeda33692b2ac74de5d71bb1075fcd3d88b860 100644 (file)
@@ -4795,7 +4795,7 @@ Editor::toggle_mute ()
                }
 
                if (first) {
-                       new_state = !rtav->route()->soloed ();
+                       new_state = !rtav->route()->muted();
                        first = false;
                }
 
index 1a615de4249d8558640d17662454c58faa0b702d..05a3ef0505b28b78edb1212bbde83eedd81f531a 100644 (file)
@@ -844,7 +844,7 @@ GenericMidiControlProtocol::create_function (const XMLNode& node)
                }
        }
 
-       if ((prop = node.property (X_("arg"))) != 0) {
+       if ((prop = node.property (X_("arg"))) != 0 || (prop = node.property (X_("argument"))) != 0 || (prop = node.property (X_("arguments"))) != 0) {
                argument = prop->value ();
        }
 
index 186858550f7c4790e6438bdca483bbd2aa843ce6..38252326d79cb62cb00ac8ac5706e93ec997d87d 100644 (file)
@@ -66,6 +66,16 @@ MIDIFunction::setup (GenericMidiControlProtocol& ui, const std::string& invokabl
                        return -1;
                }
                _function = Select;
+       } else if (strcasecmp (_invokable_name.c_str(), "track-set-solo") == 0) {
+               if (_argument.empty()) {
+                       return -1;
+               }
+               _function = TrackSetSolo;
+       } else if (strcasecmp (_invokable_name.c_str(), "track-set-mute") == 0) {
+               if (_argument.empty()) {
+                       return -1;
+               }
+               _function = TrackSetMute;
        } else {
                return -1;
        }
@@ -123,6 +133,8 @@ MIDIFunction::execute ()
                        sscanf (_argument.c_str(), "%d", &rid);
                        _ui->SelectByRID (rid);
                }
+       default:
+               break;
        }
 }
 
index aafa739f20df01c9a2c3a4b19764449a58f5c0ef..8b3a52df3c47c961ac93c80540ef443ac5b2d966 100644 (file)
@@ -53,7 +53,14 @@ class MIDIFunction : public MIDIInvokable
                TransportLoopToggle,
                TransportRecordEnable,
                TransportRecordDisable,
+               /* 1 argument functions: RID */
                Select,
+               /* 2 argument functions: RID, value */
+               TrackSetSolo, 
+               TrackSetMute,
+               TrackSetGain,
+               TrackSetRecordEnable,
+               TrackSetSoloIsolate,
        };
 
        MIDIFunction (MIDI::Port&);