2 Copyright (C) 2006 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.
21 #include <ardour/control_protocol.h>
22 #include <ardour/session.h>
23 #include <ardour/route.h>
24 #include <ardour/audio_track.h>
26 using namespace ARDOUR;
29 sigc::signal<void> ControlProtocol::ZoomToSession;
30 sigc::signal<void> ControlProtocol::ZoomOut;
31 sigc::signal<void> ControlProtocol::ZoomIn;
32 sigc::signal<void> ControlProtocol::Enter;
33 sigc::signal<void,float> ControlProtocol::ScrollTimeline;
35 ControlProtocol::ControlProtocol (Session& s, string str)
42 ControlProtocol::~ControlProtocol ()
47 ControlProtocol::next_track (uint32_t initial_id)
49 uint32_t limit = session->nroutes();
50 Route* cr = route_table[0];
54 id = cr->remote_control_id ();
66 if ((cr = session->route_by_remote_id (id)) != 0) {
74 while (id != initial_id) {
75 if ((cr = session->route_by_remote_id (id)) != 0) {
86 ControlProtocol::prev_track (uint32_t initial_id)
88 uint32_t limit = session->nroutes() - 1;
89 Route* cr = route_table[0];
93 id = cr->remote_control_id ();
99 id = session->nroutes() - 1;
105 if ((cr = session->route_by_remote_id (id)) != 0) {
113 while (id > initial_id) {
114 if ((cr = session->route_by_remote_id (id)) != 0) {
126 ControlProtocol::set_route_table_size (uint32_t size)
128 while (route_table.size() < size) {
129 route_table.push_back (0);
134 ControlProtocol::set_route_table (uint32_t table_index, ARDOUR::Route*)
139 ControlProtocol::route_set_rec_enable (uint32_t table_index, bool yn)
141 if (table_index > route_table.size()) {
145 Route* r = route_table[table_index];
147 AudioTrack* at = dynamic_cast<AudioTrack*>(r);
150 at->set_record_enable (yn, this);
155 ControlProtocol::route_get_rec_enable (uint32_t table_index)
157 if (table_index > route_table.size()) {
161 Route* r = route_table[table_index];
163 AudioTrack* at = dynamic_cast<AudioTrack*>(r);
166 at->record_enabled ();
172 ControlProtocol::route_get_gain (uint32_t table_index)
174 if (table_index > route_table.size()) {
178 Route* r = route_table[table_index];
188 ControlProtocol::route_set_gain (uint32_t table_index, float gain)
190 if (table_index > route_table.size()) {
194 Route* r = route_table[table_index];
197 r->set_gain (gain, this);
202 ControlProtocol::route_get_effective_gain (uint32_t table_index)
204 if (table_index > route_table.size()) {
208 Route* r = route_table[table_index];
214 return r->effective_gain ();
219 ControlProtocol::route_get_peak_input_power (uint32_t table_index, uint32_t which_input)
221 if (table_index > route_table.size()) {
225 Route* r = route_table[table_index];
231 return r->peak_input_power (which_input);
236 ControlProtocol::route_get_muted (uint32_t table_index)
238 if (table_index > route_table.size()) {
242 Route* r = route_table[table_index];
252 ControlProtocol::route_set_muted (uint32_t table_index, bool yn)
254 if (table_index > route_table.size()) {
258 Route* r = route_table[table_index];
261 r->set_mute (yn, this);
267 ControlProtocol::route_get_soloed (uint32_t table_index)
269 if (table_index > route_table.size()) {
273 Route* r = route_table[table_index];
283 ControlProtocol::route_set_soloed (uint32_t table_index, bool yn)
285 if (table_index > route_table.size()) {
289 Route* r = route_table[table_index];
292 r->set_solo (yn, this);
297 ControlProtocol:: route_get_name (uint32_t table_index)
299 if (table_index > route_table.size()) {
303 Route* r = route_table[table_index];