diff options
-rw-r--r-- | gtk2_ardour/editor.cc | 7 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 1 | ||||
-rw-r--r-- | libs/surfaces/control_protocol/control_protocol.cc | 1 | ||||
-rw-r--r-- | libs/surfaces/control_protocol/control_protocol/control_protocol.h | 1 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.cc | 18 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.h | 1 | ||||
-rw-r--r-- | libs/surfaces/mackie/meter.cc | 5 |
7 files changed, 29 insertions, 5 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 5295337c5d..d331b6aee1 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -713,6 +713,7 @@ Editor::Editor () ControlProtocol::Redo.connect (*this, invalidator (*this), boost::bind (&Editor::redo, 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()); + ControlProtocol::UnselectTrack.connect (*this, invalidator (*this), ui_bind (&Editor::control_unselect, this), 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 */ @@ -922,6 +923,12 @@ Editor::zoom_adjustment_changed () } void +Editor::control_unselect () +{ + selection->clear_tracks (); +} + +void Editor::control_select (uint32_t rid) { /* handles the (static) signal from the ControlProtocol class that diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index d5b2cb9172..92675edb4e 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -989,6 +989,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void control_scroll (float); void control_select (uint32_t rid); + void control_unselect (); void access_action (std::string,std::string); bool deferred_control_scroll (framepos_t); sigc::connection control_scroll_connection; diff --git a/libs/surfaces/control_protocol/control_protocol.cc b/libs/surfaces/control_protocol/control_protocol.cc index bbe4cea350..fc98a3845a 100644 --- a/libs/surfaces/control_protocol/control_protocol.cc +++ b/libs/surfaces/control_protocol/control_protocol.cc @@ -39,6 +39,7 @@ Signal0<void> ControlProtocol::Undo; Signal0<void> ControlProtocol::Redo; Signal1<void,float> ControlProtocol::ScrollTimeline; Signal1<void,uint32_t> ControlProtocol::SelectByRID; +Signal0<void> ControlProtocol::UnselectTrack; ControlProtocol::ControlProtocol (Session& s, string str, EventLoop* evloop) : BasicUI (s), diff --git a/libs/surfaces/control_protocol/control_protocol/control_protocol.h b/libs/surfaces/control_protocol/control_protocol/control_protocol.h index c6547b0974..956f8f814d 100644 --- a/libs/surfaces/control_protocol/control_protocol/control_protocol.h +++ b/libs/surfaces/control_protocol/control_protocol/control_protocol.h @@ -64,6 +64,7 @@ class ControlProtocol : virtual public sigc::trackable, public PBD::Stateful, pu static PBD::Signal0<void> Redo; static PBD::Signal1<void,float> ScrollTimeline; static PBD::Signal1<void,uint32_t> SelectByRID; + static PBD::Signal0<void> UnselectTrack; /* the model here is as follows: diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 3410eeb29f..ba19679d9e 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -101,6 +101,7 @@ MackieControlProtocol::MackieControlProtocol (Session& session) , _output_bundle (new ARDOUR::Bundle (_("Mackie Control Out"), false)) , _gui (0) , _zoom_mode (false) + , _current_selected_track (-1) { DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::MackieControlProtocol\n"); @@ -286,6 +287,8 @@ MackieControlProtocol::switch_banks (int initial) } _current_initial_bank = initial; + _current_selected_track = -1; + clear_route_signals(); // now set the signals for new routes @@ -474,8 +477,19 @@ MackieControlProtocol::handle_strip_button (SurfacePort & port, Control & contro state = !route->soloed(); route->set_solo (state, this); } else if (control.name() == "select") { - // TODO make the track selected. Whatever that means. - //state = default_button_press (dynamic_cast<Button&> (control)); + Strip* strip = const_cast<Strip*>(dynamic_cast<const Strip*>(&control.group())); + if (strip) { + if (strip->index() < route_table.size()) { + boost::shared_ptr<Route> r = route_table[strip->index()]; + if (r->remote_control_id() == _current_selected_track) { + UnselectTrack (); /* EMIT SIGNAL */ + _current_selected_track = -1; + } else { + SelectByRID (r->remote_control_id()); /* EMIT SIGNAL */ + _current_selected_track = r->remote_control_id();; + } + } + } } else if (control.name() == "vselect") { // TODO could be used to select different things to apply the pot to? //state = default_button_press (dynamic_cast<Button&> (control)); diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h index 70e1dfd364..458f4f782f 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.h +++ b/libs/surfaces/mackie/mackie_control_protocol.h @@ -428,6 +428,7 @@ class MackieControlProtocol void* _gui; bool _zoom_mode; + int _current_selected_track; }; #endif // ardour_mackie_control_protocol_h diff --git a/libs/surfaces/mackie/meter.cc b/libs/surfaces/mackie/meter.cc index 6617c1aa8c..386230ff7d 100644 --- a/libs/surfaces/mackie/meter.cc +++ b/libs/surfaces/mackie/meter.cc @@ -44,6 +44,8 @@ MidiByteArray Meter::update_message (float dB) { float def = 0.0f; /* Meter deflection %age */ + + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Meter ID %1 dB %2\n", raw_id(), dB)); if (dB < -70.0f) { def = 0.0f; @@ -88,10 +90,7 @@ Meter::update_message (float dB) if (last_segment_value_sent != segment) { last_segment_value_sent = segment; - DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Meter ID %1 to use segment %2\n", raw_id(), segment)); msg << MidiByteArray (2, 0xD0, (raw_id()<<4) | segment); - } else { - DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Meter ID %1 not sent (same as last)\n", raw_id())); } return msg; |