2 * Copyright (C) 2006 Paul Davis
3 * Copyright (C) 2007 Michael Taht
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your 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.
21 #include <tranzport_common.h>
22 #include <tranzport_control_protocol.h>
24 using namespace ARDOUR;
31 #include <pbd/abstract_ui.cc>
36 TranzportControlProtocol::button_event_battery_press (bool shifted)
41 TranzportControlProtocol::button_event_battery_release (bool shifted)
46 TranzportControlProtocol::button_event_backlight_press (bool shifted)
51 TranzportControlProtocol::button_event_backlight_release (bool shifted)
54 printf("backlight released, redrawing (and possibly crashing) display\n");
59 last_where += 1; /* force time redisplay */
60 last_track_gain = FLT_MAX;
65 TranzportControlProtocol::button_event_trackleft_press (bool shifted)
68 // not really the right layer for this
69 if(display_mode == DisplayBigMeter) {
70 if (route_table[0] != 0) {
71 notify(route_get_name (0).substr (0, 15).c_str());
77 TranzportControlProtocol::button_event_trackleft_release (bool shifted)
82 TranzportControlProtocol::button_event_trackright_press (bool shifted)
85 // not really the right layer for this
86 if(display_mode == DisplayBigMeter) {
87 if (route_table[0] != 0) {
88 notify(route_get_name (0).substr (0, 15).c_str());
94 TranzportControlProtocol::button_event_trackright_release (bool shifted)
99 TranzportControlProtocol::button_event_trackrec_press (bool shifted)
102 toggle_all_rec_enables ();
104 route_set_rec_enable (0, !route_get_rec_enable (0));
109 TranzportControlProtocol::button_event_trackrec_release (bool shifted)
114 TranzportControlProtocol::button_event_trackmute_press (bool shifted)
117 // Mute ALL? Something useful when a phone call comes in. Mute master?
119 route_set_muted (0, !route_get_muted (0));
124 TranzportControlProtocol::button_event_trackmute_release (bool shifted)
129 TranzportControlProtocol::button_event_tracksolo_press (bool shifted)
132 printf("solo pressed\n");
134 if (display_mode == DisplayBigMeter) {
135 light_off (LightAnysolo);
140 session->set_all_solo (!session->soloing());
142 route_set_soloed (0, !route_get_soloed (0));
147 TranzportControlProtocol::button_event_tracksolo_release (bool shifted)
150 printf("solo released\n");
155 TranzportControlProtocol::button_event_undo_press (bool shifted)
157 // undohistory->get_state(1);
159 //UndoHistory::get_state (uint32_t depth)
162 redo (); // someday flash the screen with what was redone
165 undo (); // someday flash the screen with what was undone
171 TranzportControlProtocol::button_event_undo_release (bool shifted)
176 TranzportControlProtocol::button_event_in_press (bool shifted)
181 ControlProtocol::ZoomIn (); /* EMIT SIGNAL */
186 TranzportControlProtocol::button_event_in_release (bool shifted)
191 TranzportControlProtocol::button_event_out_press (bool shifted)
196 ControlProtocol::ZoomOut (); /* EMIT SIGNAL */
201 TranzportControlProtocol::button_event_out_release (bool shifted)
206 TranzportControlProtocol::button_event_punch_press (bool shifted)
211 TranzportControlProtocol::button_event_punch_release (bool shifted)
216 TranzportControlProtocol::button_event_loop_press (bool shifted)
219 next_wheel_shift_mode ();
226 TranzportControlProtocol::button_event_loop_release (bool shifted)
231 TranzportControlProtocol::button_event_prev_press (bool shifted)
234 ControlProtocol::ZoomToSession (); /* EMIT SIGNAL */
241 TranzportControlProtocol::button_event_prev_release (bool shifted)
245 // Note - add_marker should adhere to the snap to setting
246 // maybe session->audible_frame does that
249 TranzportControlProtocol::button_event_add_press (bool shifted)
255 TranzportControlProtocol::button_event_add_release (bool shifted)
260 TranzportControlProtocol::button_event_next_press (bool shifted)
270 TranzportControlProtocol::button_event_next_release (bool shifted)
275 TranzportControlProtocol::button_event_rewind_press (bool shifted)
285 TranzportControlProtocol::button_event_rewind_release (bool shifted)
290 TranzportControlProtocol::button_event_fastforward_press (bool shifted)
300 TranzportControlProtocol::button_event_fastforward_release (bool shifted)
305 TranzportControlProtocol::button_event_stop_press (bool shifted)
308 next_display_mode ();
315 TranzportControlProtocol::button_event_stop_release (bool shifted)
320 TranzportControlProtocol::button_event_play_press (bool shifted)
323 set_transport_speed (1.0f);
330 TranzportControlProtocol::button_event_play_release (bool shifted)
335 TranzportControlProtocol::button_event_record_press (bool shifted)
340 rec_enable_toggle ();
345 TranzportControlProtocol::button_event_record_release (bool shifted)
350 TranzportControlProtocol::button_event_footswitch_press (bool shifted)
353 next_marker (); // think this through, we could also do punch in
355 prev_marker (); // think this through, we could also do punch in
360 TranzportControlProtocol::button_event_footswitch_release (bool shifted)
362 if(session->transport_speed() == 0.0)
368 // Possible new api example
369 // tries harder to do the right thing if we somehow missed a button down event
370 // which currently happens... a lot.
372 void button_event_mute (bool pressed, bool shifted)
374 static int was_pressed = 0;
375 if((!pressed && !was_pressed) || pressed) {