diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-11-25 16:34:11 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-11-25 16:34:11 -0500 |
commit | 104ec39b50556435a2edcce24375e3ba4a938a2d (patch) | |
tree | b99da03d7e22c28ca3455c712e7075498a4686cc /libs | |
parent | 487ada663027eadb91fe8e98c2d79917a7df15de (diff) |
faderport: enable "Output" button to select master out (or, with Shift, monitor out if it exists) as the target route
Diffstat (limited to 'libs')
-rw-r--r-- | libs/surfaces/faderport/faderport.cc | 41 | ||||
-rw-r--r-- | libs/surfaces/faderport/faderport.h | 4 | ||||
-rw-r--r-- | libs/surfaces/faderport/operations.cc | 18 |
3 files changed, 55 insertions, 8 deletions
diff --git a/libs/surfaces/faderport/faderport.cc b/libs/surfaces/faderport/faderport.cc index 859b69abe4..e8e68475ff 100644 --- a/libs/surfaces/faderport/faderport.cc +++ b/libs/surfaces/faderport/faderport.cc @@ -73,7 +73,7 @@ FaderPort::FaderPort (Session& s) , blink_state (false) { last_encoder_time = 0; - + boost::shared_ptr<ARDOUR::Port> inp; boost::shared_ptr<ARDOUR::Port> outp; @@ -148,6 +148,9 @@ FaderPort::FaderPort (Session& s) button_info (Mute).set_action (boost::bind (&FaderPort::mute, this), true); button_info (Solo).set_action (boost::bind (&FaderPort::solo, this), true); button_info (Rec).set_action (boost::bind (&FaderPort::rec_enable, this), true); + + button_info (Output).set_action (boost::bind (&FaderPort::use_master, this), true); + button_info (Output).set_action (boost::bind (&FaderPort::use_monitor, this), true, ShiftDown); } FaderPort::~FaderPort () @@ -319,7 +322,7 @@ FaderPort::encoder_handler (MIDI::Parser &, MIDI::pitchbend_t pb) last_encoder_time = now; last_good_encoder_delta = delta; } - + if (_current_route) { if ( (button_state & ShiftDown) == ShiftDown ) { //shift+encoder = input trim @@ -332,9 +335,9 @@ FaderPort::encoder_handler (MIDI::Parser &, MIDI::pitchbend_t pb) } else { //pan / balance //ToDo } - + } - + } void @@ -737,15 +740,37 @@ FaderPort::ButtonInfo::set_led_state (boost::shared_ptr<MIDI::Port> port, int on void FaderPort::gui_track_selection_changed (RouteNotificationListPtr routes) { - if (routes->empty()) { - _current_route.reset (); - } else { - _current_route = routes->front().lock(); + boost::shared_ptr<Route> r; + + if (!routes->empty()) { + r = routes->front().lock(); } + set_current_route (r); +} + +void +FaderPort::drop_current_route () +{ + if (_current_route) { + if (_current_route == session->monitor_out()) { + set_current_route (session->master_out()); + } else { + set_current_route (boost::shared_ptr<Route>()); + } + } +} + +void +FaderPort::set_current_route (boost::shared_ptr<Route> r) +{ route_connections.drop_connections (); + _current_route = r; + if (_current_route) { + _current_route->DropReferences.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::drop_current_route, this), this); + _current_route->mute_changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_mute, this, _1), this); _current_route->solo_changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_solo, this, _1, _2, _3), this); _current_route->listen_changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_listen, this, _1, _2), this); diff --git a/libs/surfaces/faderport/faderport.h b/libs/surfaces/faderport/faderport.h index 3635070d9b..5fe657c704 100644 --- a/libs/surfaces/faderport/faderport.h +++ b/libs/surfaces/faderport/faderport.h @@ -243,6 +243,10 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq bool blink_state; bool blink (); + void set_current_route (boost::shared_ptr<ARDOUR::Route>); + void drop_current_route (); + void use_master (); + void use_monitor (); void gui_track_selection_changed (ARDOUR::RouteNotificationListPtr); PBD::ScopedConnection selection_connection; PBD::ScopedConnectionList route_connections; diff --git a/libs/surfaces/faderport/operations.cc b/libs/surfaces/faderport/operations.cc index 05c9e02beb..01b555f575 100644 --- a/libs/surfaces/faderport/operations.cc +++ b/libs/surfaces/faderport/operations.cc @@ -85,3 +85,21 @@ FaderPort::rec_enable () session->set_record_enabled (rl, !t->record_enabled()); } + +void +FaderPort::use_master () +{ + boost::shared_ptr<Route> r = session->master_out(); + if (r) { + set_current_route (r); + } +} + +void +FaderPort::use_monitor () +{ + boost::shared_ptr<Route> r = session->monitor_out(); + if (r) { + set_current_route (r); + } +} |