2 Copyright (C) 2006 Paul Davis
4 This program is free software; you can redistribute it
5 and/or modify it under the terms of the GNU Lesser
6 General Public License as published by the Free Software
7 Foundation; either version 2 of the License, or (at your
8 option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <ardour/session.h>
23 #include <ardour/route.h>
24 #include <ardour/audio_track.h>
26 #include <control_protocol/control_protocol.h>
28 using namespace ARDOUR;
31 sigc::signal<void> ControlProtocol::ZoomToSession;
32 sigc::signal<void> ControlProtocol::ZoomOut;
33 sigc::signal<void> ControlProtocol::ZoomIn;
34 sigc::signal<void> ControlProtocol::Enter;
35 sigc::signal<void,float> ControlProtocol::ScrollTimeline;
37 ControlProtocol::ControlProtocol (Session& s, string str)
44 ControlProtocol::~ControlProtocol ()
49 ControlProtocol::next_track (uint32_t initial_id)
51 uint32_t limit = session->nroutes();
52 Route* cr = route_table[0];
56 id = cr->remote_control_id ();
68 if ((cr = session->route_by_remote_id (id)) != 0) {
76 while (id != initial_id) {
77 if ((cr = session->route_by_remote_id (id)) != 0) {
88 ControlProtocol::prev_track (uint32_t initial_id)
90 uint32_t limit = session->nroutes() - 1;
91 Route* cr = route_table[0];
95 id = cr->remote_control_id ();
101 id = session->nroutes() - 1;
107 if ((cr = session->route_by_remote_id (id)) != 0) {
115 while (id > initial_id) {
116 if ((cr = session->route_by_remote_id (id)) != 0) {
128 ControlProtocol::set_route_table_size (uint32_t size)
130 while (route_table.size() < size) {
131 route_table.push_back (0);
136 ControlProtocol::set_route_table (uint32_t table_index, ARDOUR::Route*)
141 ControlProtocol::set_route_table (uint32_t table_index, uint32_t remote_control_id)
143 if (table_index >= route_table.size()) {
147 Route* r = session->route_by_remote_id (remote_control_id);
153 route_table[table_index] = r;
159 ControlProtocol::route_set_rec_enable (uint32_t table_index, bool yn)
161 if (table_index > route_table.size()) {
165 Route* r = route_table[table_index];
167 AudioTrack* at = dynamic_cast<AudioTrack*>(r);
170 at->set_record_enable (yn, this);
175 ControlProtocol::route_get_rec_enable (uint32_t table_index)
177 if (table_index > route_table.size()) {
181 Route* r = route_table[table_index];
183 AudioTrack* at = dynamic_cast<AudioTrack*>(r);
186 return at->record_enabled ();
194 ControlProtocol::route_get_gain (uint32_t table_index)
196 if (table_index > route_table.size()) {
200 Route* r = route_table[table_index];
210 ControlProtocol::route_set_gain (uint32_t table_index, float gain)
212 if (table_index > route_table.size()) {
216 Route* r = route_table[table_index];
219 r->set_gain (gain, this);
224 ControlProtocol::route_get_effective_gain (uint32_t table_index)
226 if (table_index > route_table.size()) {
230 Route* r = route_table[table_index];
236 return r->effective_gain ();
241 ControlProtocol::route_get_peak_input_power (uint32_t table_index, uint32_t which_input)
243 if (table_index > route_table.size()) {
247 Route* r = route_table[table_index];
253 return r->peak_input_power (which_input);
258 ControlProtocol::route_get_muted (uint32_t table_index)
260 if (table_index > route_table.size()) {
264 Route* r = route_table[table_index];
274 ControlProtocol::route_set_muted (uint32_t table_index, bool yn)
276 if (table_index > route_table.size()) {
280 Route* r = route_table[table_index];
283 r->set_mute (yn, this);
289 ControlProtocol::route_get_soloed (uint32_t table_index)
291 if (table_index > route_table.size()) {
295 Route* r = route_table[table_index];
305 ControlProtocol::route_set_soloed (uint32_t table_index, bool yn)
307 if (table_index > route_table.size()) {
311 Route* r = route_table[table_index];
314 r->set_solo (yn, this);
319 ControlProtocol:: route_get_name (uint32_t table_index)
321 if (table_index > route_table.size()) {
325 Route* r = route_table[table_index];