2 Copyright (C) 2015 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "ardour/async_midi_port.h"
21 #include "ardour/rc_configuration.h"
22 #include "ardour/session.h"
23 #include "ardour/track.h"
25 #include "faderport.h"
27 using namespace ARDOUR;
28 using namespace ArdourSurface;
33 ControlProtocol::Undo (); /* EMIT SIGNAL */
39 ControlProtocol::Redo (); /* EMIT SIGNAL */
45 if (!_current_route) {
49 boost::shared_ptr<RouteList> rl (new RouteList);
50 rl->push_back (_current_route);
51 session->set_mute (rl, !_current_route->muted());
57 if (!_current_route) {
61 boost::shared_ptr<RouteList> rl (new RouteList);
62 rl->push_back (_current_route);
64 if (Config->get_solo_control_is_listen_control()) {
65 session->set_listen (rl, !_current_route->listening_via_monitor());
67 session->set_solo (rl, !_current_route->soloed());
72 FaderPort::rec_enable ()
74 if (!_current_route) {
78 boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_current_route);
84 boost::shared_ptr<RouteList> rl (new RouteList);
85 rl->push_back (_current_route);
87 session->set_record_enabled (rl, !t->record_enabled());
91 FaderPort::use_master ()
93 boost::shared_ptr<Route> r = session->master_out();
95 if (_current_route == r) {
96 r = pre_master_route.lock();
97 set_current_route (r);
98 if (r == session->monitor_out() || r == session->master_out()) {
99 button_info(Output).set_led_state (_output_port, true);
101 button_info(Output).set_led_state (_output_port, false);
104 pre_master_route = boost::weak_ptr<Route> (_current_route);
105 set_current_route (r);
106 button_info(Output).set_led_state (_output_port, true);
112 FaderPort::use_monitor ()
114 boost::shared_ptr<Route> r = session->monitor_out();
116 if (_current_route == r) {
117 r = pre_monitor_route.lock();
118 set_current_route (r);
119 if (r == session->monitor_out() || r == session->master_out()) {
120 button_info(Output).set_led_state (_output_port, true);
122 button_info(Output).set_led_state (_output_port, false);
125 pre_monitor_route = boost::weak_ptr<Route> (_current_route);
126 set_current_route (r);
127 button_info(Output).set_led_state (_output_port, true);