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/pannable.h"
23 #include "ardour/rc_configuration.h"
24 #include "ardour/session.h"
25 #include "ardour/track.h"
26 #include "ardour/types.h"
28 #include "faderport.h"
30 using namespace ARDOUR;
31 using namespace ArdourSurface;
36 access_action ("Editor/select-prev-route");
39 //if ( (button_state & ShiftDown) == ShiftDown )
46 access_action ("Editor/select-next-route");
49 //if ( (button_state & ShiftDown) == ShiftDown )
57 boost::shared_ptr<AutomationControl> gain = _current_route->gain_control ();
59 gain->set_automation_state( (ARDOUR::AutoState) ARDOUR::Play );
68 boost::shared_ptr<AutomationControl> gain = _current_route->gain_control ();
70 gain->set_automation_state( (ARDOUR::AutoState) ARDOUR::Write );
79 boost::shared_ptr<AutomationControl> gain = _current_route->gain_control ();
81 gain->set_automation_state( (ARDOUR::AutoState) ARDOUR::Touch );
90 boost::shared_ptr<AutomationControl> gain = _current_route->gain_control ();
92 gain->set_automation_state( (ARDOUR::AutoState) ARDOUR::Off );
103 ControlProtocol::Undo (); /* EMIT SIGNAL */
109 ControlProtocol::Redo (); /* EMIT SIGNAL */
115 if (!_current_route) {
119 if (_current_route == session->monitor_out()) {
120 boost::shared_ptr<MonitorProcessor> mp = _current_route->monitor_control();
121 mp->set_cut_all (!mp->cut_all());
125 boost::shared_ptr<RouteList> rl (new RouteList);
126 rl->push_back (_current_route);
127 session->set_mute (rl, !_current_route->muted());
133 if (!_current_route) {
137 boost::shared_ptr<RouteList> rl (new RouteList);
138 rl->push_back (_current_route);
140 if (Config->get_solo_control_is_listen_control()) {
141 session->set_listen (rl, !_current_route->listening_via_monitor());
143 session->set_solo (rl, !_current_route->soloed());
148 FaderPort::rec_enable ()
150 if (!_current_route) {
154 boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_current_route);
160 boost::shared_ptr<RouteList> rl (new RouteList);
161 rl->push_back (_current_route);
163 session->set_record_enabled (rl, !t->record_enabled());
167 FaderPort::use_master ()
169 boost::shared_ptr<Route> r = session->master_out();
171 if (_current_route == r) {
172 r = pre_master_route.lock();
173 set_current_route (r);
174 button_info(Output).set_led_state (_output_port, false);
175 blinkers.remove (Output);
177 if (_current_route != session->master_out() && _current_route != session->monitor_out()) {
178 pre_master_route = boost::weak_ptr<Route> (_current_route);
180 set_current_route (r);
181 button_info(Output).set_led_state (_output_port, true);
182 blinkers.remove (Output);
188 FaderPort::use_monitor ()
190 boost::shared_ptr<Route> r = session->monitor_out();
193 if (_current_route == r) {
194 r = pre_monitor_route.lock();
195 set_current_route (r);
196 button_info(Output).set_led_state (_output_port, false);
197 blinkers.remove (Output);
199 if (_current_route != session->master_out() && _current_route != session->monitor_out()) {
200 pre_monitor_route = boost::weak_ptr<Route> (_current_route);
202 set_current_route (r);
203 button_info(Output).set_led_state (_output_port, true);
204 blinkers.push_back (Output);
211 FaderPort::ardour_pan_azimuth (int delta)
213 if (!_current_route) {
217 boost::shared_ptr<Pannable> pannable = _current_route->pannable ();
223 boost::shared_ptr<AutomationControl> azimuth = pannable->pan_azimuth_control;
229 azimuth->set_value (azimuth->interface_to_internal (azimuth->internal_to_interface (azimuth->get_value()) + (delta / 64.0)));
234 FaderPort::ardour_pan_width(int delta)
236 if (!_current_route) {
240 boost::shared_ptr<Pannable> pannable = _current_route->pannable ();
246 boost::shared_ptr<AutomationControl> width = pannable->pan_width_control;
252 width->set_value (width->interface_to_internal (width->internal_to_interface (width->get_value()) + (delta / 64.0)));
256 FaderPort::mixbus_pan (int delta)