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/monitor_processor.h"
22 #include "ardour/rc_configuration.h"
23 #include "ardour/session.h"
24 #include "ardour/track.h"
26 #include "faderport.h"
28 using namespace ARDOUR;
29 using namespace ArdourSurface;
34 ControlProtocol::Undo (); /* EMIT SIGNAL */
40 ControlProtocol::Redo (); /* EMIT SIGNAL */
46 if (!_current_route) {
50 if (_current_route == session->monitor_out()) {
51 boost::shared_ptr<MonitorProcessor> mp = _current_route->monitor_control();
52 mp->set_cut_all (!mp->cut_all());
56 boost::shared_ptr<RouteList> rl (new RouteList);
57 rl->push_back (_current_route);
58 session->set_mute (rl, !_current_route->muted());
64 if (!_current_route) {
68 boost::shared_ptr<RouteList> rl (new RouteList);
69 rl->push_back (_current_route);
71 if (Config->get_solo_control_is_listen_control()) {
72 session->set_listen (rl, !_current_route->listening_via_monitor());
74 session->set_solo (rl, !_current_route->soloed());
79 FaderPort::rec_enable ()
81 if (!_current_route) {
85 boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_current_route);
91 boost::shared_ptr<RouteList> rl (new RouteList);
92 rl->push_back (_current_route);
94 session->set_record_enabled (rl, !t->record_enabled());
98 FaderPort::use_master ()
100 boost::shared_ptr<Route> r = session->master_out();
102 if (_current_route == r) {
103 r = pre_master_route.lock();
104 set_current_route (r);
105 if (r == session->monitor_out()) {
106 button_info(Output).set_led_state (_output_port, true);
107 blinkers.push_back (Output);
109 button_info(Output).set_led_state (_output_port, false);
110 blinkers.remove (Output);
113 pre_master_route = boost::weak_ptr<Route> (_current_route);
114 set_current_route (r);
115 button_info(Output).set_led_state (_output_port, true);
116 blinkers.remove (Output);
122 FaderPort::use_monitor ()
124 boost::shared_ptr<Route> r = session->monitor_out();
127 if (_current_route == r) {
128 r = pre_monitor_route.lock();
129 set_current_route (r);
130 if (r == session->master_out()) {
131 button_info(Output).set_led_state (_output_port, true);
133 button_info(Output).set_led_state (_output_port, false);
135 blinkers.remove (Output);
137 pre_monitor_route = boost::weak_ptr<Route> (_current_route);
138 set_current_route (r);
139 button_info(Output).set_led_state (_output_port, true);
140 blinkers.push_back (Output);