1 /*
2 * Copyright (C) 2017-2019 Ben Loftis <ben@harrisonconsoles.com>
3 *
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.
8 *
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.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #include <algorithm>
20
21 #include "pbd/memento_command.h"
22
23 #include "ardour/debug.h"
24 #include "ardour/profile.h"
25 #include "ardour/session.h"
26 #include "ardour/route.h"
27 #include "ardour/location.h"
28 #include "ardour/rc_configuration.h"
29
30 #include "us2400_control_protocol.h"
31 #include "surface.h"
32 #include "fader.h"
33
34 #include "pbd/i18n.h"
35
36 /* handlers for all buttons, broken into a separate file to avoid clutter in
37 * us2400_control_protocol.cc
38 */
39
40 using std::string;
41 using namespace ARDOUR;
42 using namespace PBD;
43 using namespace ArdourSurface;
44 using namespace US2400;
45
46 LedState
shift_press(Button &)47 US2400Protocol::shift_press (Button &)
48 {
49 _modifier_state |= MODIFIER_SHIFT;
50 return on;
51 }
52 LedState
shift_release(Button &)53 US2400Protocol::shift_release (Button &)
54 {
55 _modifier_state &= ~MODIFIER_SHIFT;
56 return off;
57 }
58 LedState
option_press(Button &)59 US2400Protocol::option_press (Button &)
60 {
61 _modifier_state |= MODIFIER_OPTION;
62 return on;
63 }
64 LedState
option_release(Button &)65 US2400Protocol::option_release (Button &)
66 {
67 _modifier_state &= ~MODIFIER_OPTION;
68 return off;
69 }
70 LedState
control_press(Button &)71 US2400Protocol::control_press (Button &)
72 {
73 _modifier_state |= MODIFIER_CONTROL;
74 DEBUG_TRACE (DEBUG::US2400, string_compose ("CONTROL Press: modifier state now set to %1\n", _modifier_state));
75 return on;
76 }
77 LedState
control_release(Button &)78 US2400Protocol::control_release (Button &)
79 {
80 _modifier_state &= ~MODIFIER_CONTROL;
81 DEBUG_TRACE (DEBUG::US2400, string_compose ("CONTROL Release: modifier state now set to %1\n", _modifier_state));
82 return off;
83 }
84 LedState
cmd_alt_press(Button &)85 US2400Protocol::cmd_alt_press (Button &)
86 {
87 _modifier_state |= MODIFIER_CMDALT;
88 return on;
89 }
90 LedState
cmd_alt_release(Button &)91 US2400Protocol::cmd_alt_release (Button &)
92 {
93 _modifier_state &= ~MODIFIER_CMDALT;
94 return off;
95 }
96
97 LedState
left_press(Button &)98 US2400Protocol::left_press (Button &)
99 {
100 if (_subview_mode != None) {
101 return none;
102 }
103
104 Sorted sorted = get_sorted_stripables();
105 uint32_t strip_cnt = n_strips ();
106
107 DEBUG_TRACE (DEBUG::US2400, string_compose ("bank left with current initial = %1 nstrips = %2 tracks/busses = %3\n",
108 _current_initial_bank, strip_cnt, sorted.size()));
109 if (_current_initial_bank > 0) {
110 (void) switch_banks ((_current_initial_bank - 1) / strip_cnt * strip_cnt);
111 } else {
112 (void) switch_banks (0);
113 }
114
115
116 return on;
117 }
118
119 LedState
left_release(Button &)120 US2400Protocol::left_release (Button &)
121 {
122 return none;
123 }
124
125 LedState
right_press(Button &)126 US2400Protocol::right_press (Button &)
127 {
128 if (_subview_mode != None) {
129 return none;
130 }
131
132 Sorted sorted = get_sorted_stripables();
133 uint32_t strip_cnt = n_strips();
134 uint32_t route_cnt = sorted.size();
135 uint32_t max_bank = route_cnt / strip_cnt * strip_cnt;
136
137
138 DEBUG_TRACE (DEBUG::US2400, string_compose ("bank right with current initial = %1 nstrips = %2 tracks/busses = %3\n",
139 _current_initial_bank, strip_cnt, route_cnt));
140
141 if (_current_initial_bank < max_bank) {
142 uint32_t new_initial = (_current_initial_bank / strip_cnt * strip_cnt) + strip_cnt;
143 (void) switch_banks (new_initial);
144 }
145
146 return none;
147 }
148
149 LedState
right_release(Button &)150 US2400Protocol::right_release (Button &)
151 {
152 return none;
153 }
154
155 LedState
cursor_left_press(Button &)156 US2400Protocol::cursor_left_press (Button& )
157 {
158 if (zoom_mode()) {
159
160 if (main_modifier_state() & MODIFIER_OPTION) {
161 /* reset selected tracks to default vertical zoom */
162 } else {
163 ZoomOut (); /* EMIT SIGNAL */
164 }
165 } else {
166 float page_fraction;
167 if (main_modifier_state() == MODIFIER_CONTROL) {
168 page_fraction = 1.0;
169 } else if (main_modifier_state() == MODIFIER_OPTION) {
170 page_fraction = 0.1;
171 } else if (main_modifier_state() == MODIFIER_SHIFT) {
172 page_fraction = 2.0;
173 } else {
174 page_fraction = 0.25;
175 }
176
177 ScrollTimeline (-page_fraction);
178 }
179
180 return off;
181 }
182
183 LedState
cursor_left_release(Button &)184 US2400Protocol::cursor_left_release (Button&)
185 {
186 return off;
187 }
188
189 LedState
cursor_right_press(Button &)190 US2400Protocol::cursor_right_press (Button& )
191 {
192 if (zoom_mode()) {
193
194 if (main_modifier_state() & MODIFIER_OPTION) {
195 /* reset selected tracks to default vertical zoom */
196 } else {
197 ZoomIn (); /* EMIT SIGNAL */
198 }
199 } else {
200 float page_fraction;
201 if (main_modifier_state() == MODIFIER_CONTROL) {
202 page_fraction = 1.0;
203 } else if (main_modifier_state() == MODIFIER_OPTION) {
204 page_fraction = 0.1;
205 } else if (main_modifier_state() == MODIFIER_SHIFT) {
206 page_fraction = 2.0;
207 } else {
208 page_fraction = 0.25;
209 }
210
211 ScrollTimeline (page_fraction);
212 }
213
214 return off;
215 }
216
217 LedState
cursor_right_release(Button &)218 US2400Protocol::cursor_right_release (Button&)
219 {
220 return off;
221 }
222
223 LedState
cursor_up_press(Button &)224 US2400Protocol::cursor_up_press (Button&)
225 {
226 if (zoom_mode()) {
227
228 if (main_modifier_state() & MODIFIER_CONTROL) {
229 VerticalZoomInSelected (); /* EMIT SIGNAL */
230 } else {
231 VerticalZoomInAll (); /* EMIT SIGNAL */
232 }
233 } else {
234 access_action ("Editor/select-prev-route");
235 }
236 return off;
237 }
238
239 LedState
cursor_up_release(Button &)240 US2400Protocol::cursor_up_release (Button&)
241 {
242 return off;
243 }
244
245 LedState
cursor_down_press(Button &)246 US2400Protocol::cursor_down_press (Button&)
247 {
248 if (zoom_mode()) {
249 if (main_modifier_state() & MODIFIER_OPTION) {
250 VerticalZoomOutSelected (); /* EMIT SIGNAL */
251 } else {
252 VerticalZoomOutAll (); /* EMIT SIGNAL */
253 }
254 } else {
255 access_action ("Editor/select-next-route");
256 }
257 return off;
258 }
259
260 LedState
cursor_down_release(Button &)261 US2400Protocol::cursor_down_release (Button&)
262 {
263 return off;
264 }
265
266 LedState
channel_left_press(Button &)267 US2400Protocol::channel_left_press (Button &)
268 {
269 if (_subview_mode != None) {
270 return none;
271 }
272 Sorted sorted = get_sorted_stripables();
273 if (sorted.size() > n_strips()) {
274 prev_track();
275 return on;
276 } else {
277 return flashing;
278 }
279 }
280
281 LedState
channel_left_release(Button &)282 US2400Protocol::channel_left_release (Button &)
283 {
284 return off;
285 }
286
287 LedState
channel_right_press(Button &)288 US2400Protocol::channel_right_press (Button &)
289 {
290 if (_subview_mode != None) {
291 return none;
292 }
293 Sorted sorted = get_sorted_stripables();
294 if (sorted.size() > n_strips()) {
295 next_track();
296 return on;
297 } else {
298 return flashing;
299 }
300 }
301
302 LedState
channel_right_release(Button &)303 US2400Protocol::channel_right_release (Button &)
304 {
305 return off;
306 }
307
308 US2400::LedState
zoom_press(US2400::Button &)309 US2400Protocol::zoom_press (US2400::Button &)
310 {
311 return none;
312 }
313
314 US2400::LedState
zoom_release(US2400::Button &)315 US2400Protocol::zoom_release (US2400::Button &)
316 {
317 if (_modifier_state & MODIFIER_ZOOM) {
318 _modifier_state &= ~MODIFIER_ZOOM;
319 } else {
320 _modifier_state |= MODIFIER_ZOOM;
321 }
322
323 return (zoom_mode() ? on : off);
324 }
325
326 US2400::LedState
scrub_press(US2400::Button &)327 US2400Protocol::scrub_press (US2400::Button &)
328 {
329 if (!surfaces.empty()) {
330 // surfaces.front()->next_jog_mode ();
331 _master_surface->next_jog_mode ();
332 }
333 return none;
334 }
335
336 US2400::LedState
scrub_release(US2400::Button &)337 US2400Protocol::scrub_release (US2400::Button &)
338 {
339 return none;
340 }
341
342 LedState
undo_press(Button &)343 US2400Protocol::undo_press (Button&)
344 {
345 if (main_modifier_state() == MODIFIER_SHIFT) {
346 redo();
347 } else {
348 undo ();
349 }
350 return none;
351 }
352
353 LedState
undo_release(Button &)354 US2400Protocol::undo_release (Button&)
355 {
356 return none;
357 }
358
359 LedState
drop_press(Button &)360 US2400Protocol::drop_press (Button &)
361 {
362 _modifier_state |= MODIFIER_DROP;
363 printf("drop press, modifier drop state = %d\n", _modifier_state);
364
365 return none;
366 }
367
368 LedState
drop_release(Button &)369 US2400Protocol::drop_release (Button &)
370 {
371 _modifier_state &= ~MODIFIER_DROP;
372 printf("drop release, modifier drop state = %d\n", _modifier_state);
373
374 return none;
375 }
376
377 LedState
save_press(Button &)378 US2400Protocol::save_press (Button &)
379 {
380 if (main_modifier_state() == MODIFIER_SHIFT) {
381 quick_snapshot_switch();
382 } else {
383 save_state ();
384 }
385
386 return none;
387 }
388
389 LedState
save_release(Button &)390 US2400Protocol::save_release (Button &)
391 {
392 return none;
393 }
394
395 LedState
timecode_beats_press(Button &)396 US2400Protocol::timecode_beats_press (Button &)
397 {
398 switch (_timecode_type) {
399 case ARDOUR::AnyTime::BBT:
400 _timecode_type = ARDOUR::AnyTime::Timecode;
401 break;
402 case ARDOUR::AnyTime::Timecode:
403 _timecode_type = ARDOUR::AnyTime::BBT;
404 break;
405 default:
406 return off;
407 }
408
409 update_timecode_beats_led();
410
411 return on;
412 }
413
414 LedState
timecode_beats_release(Button &)415 US2400Protocol::timecode_beats_release (Button &)
416 {
417 return off;
418 }
419
420 /////////////////////////////////////
421 // Functions
422 /////////////////////////////////////
423 LedState
marker_press(Button &)424 US2400Protocol::marker_press (Button &)
425 {
426 if (main_modifier_state() & MODIFIER_SHIFT) {
427 access_action ("Common/remove-location-from-playhead");
428 return off;
429 } else {
430 _modifier_state |= MODIFIER_MARKER;
431 marker_modifier_consumed_by_button = false;
432 return on;
433 }
434 }
435
436 LedState
marker_release(Button &)437 US2400Protocol::marker_release (Button &)
438 {
439 _modifier_state &= ~MODIFIER_MARKER;
440
441 if (main_modifier_state() & MODIFIER_SHIFT) {
442 return off; //if shift was held, we already did the action
443 }
444
445 if (marker_modifier_consumed_by_button) {
446 DEBUG_TRACE (DEBUG::US2400, "marked modifier consumed by button, ignored\n");
447 /* marker was used a modifier for some other button(s), so do
448 nothing
449 */
450 return off;
451 }
452
453 string markername;
454
455 /* Don't add another mark if one exists within 1/100th of a second of
456 * the current position and we're not rolling.
457 */
458
459 samplepos_t where = session->audible_sample();
460
461 if (session->transport_stopped_or_stopping() && session->locations()->mark_at (where, session->sample_rate() / 100.0)) {
462 return off;
463 }
464
465 session->locations()->next_available_name (markername,"mark");
466 add_marker (markername);
467
468 return off;
469 }
470
471 /////////////////////////////////////
472 // Transport Buttons
473 /////////////////////////////////////
474
475 LedState
stop_press(Button &)476 US2400Protocol::stop_press (Button &)
477 {
478 transport_stop ();
479
480 if (main_modifier_state() == MODIFIER_SHIFT) {
481 session->midi_panic();
482 }
483
484 return on;
485 }
486
487 LedState
stop_release(Button &)488 US2400Protocol::stop_release (Button &)
489 {
490 return session->transport_stopped_or_stopping();
491 }
492
493 LedState
play_press(Button &)494 US2400Protocol::play_press (Button &)
495 {
496 /* if we're already rolling at normal speed, and we're pressed
497 again, jump back to where we started last time
498 */
499
500 transport_play (get_transport_speed() == 1.0);
501 return none;
502 }
503
504 LedState
play_release(Button &)505 US2400Protocol::play_release (Button &)
506 {
507 return none;
508 }
509
510 LedState
record_press(Button &)511 US2400Protocol::record_press (Button &)
512 {
513 rec_enable_toggle ();
514 return none;
515 }
516
517 LedState
record_release(Button &)518 US2400Protocol::record_release (Button &)
519 {
520 return none;
521 }
522
523 LedState
rewind_press(Button &)524 US2400Protocol::rewind_press (Button &)
525 {
526 if (modifier_state() & MODIFIER_MARKER) {
527 prev_marker ();
528 } else if ( (_modifier_state & MODIFIER_DROP) == MODIFIER_DROP) {
529 access_action ("Common/start-range-from-playhead");
530 } else if (main_modifier_state() & MODIFIER_SHIFT) {
531 goto_start ();
532 } else {
533 rewind ();
534 }
535 return none;
536 }
537
538 LedState
rewind_release(Button &)539 US2400Protocol::rewind_release (Button &)
540 {
541 return none;
542 }
543
544 LedState
ffwd_press(Button &)545 US2400Protocol::ffwd_press (Button &)
546 {
547 if (modifier_state() & MODIFIER_MARKER) {
548 next_marker ();
549 } else if ( (_modifier_state & MODIFIER_DROP) == MODIFIER_DROP) {
550 access_action ("Common/finish-range-from-playhead");
551 } else if (main_modifier_state() & MODIFIER_SHIFT) {
552 goto_end();
553 } else {
554 ffwd ();
555 }
556 return none;
557 }
558
559 LedState
ffwd_release(Button &)560 US2400Protocol::ffwd_release (Button &)
561 {
562 return none;
563 }
564
565 LedState
loop_press(Button &)566 US2400Protocol::loop_press (Button &)
567 {
568 if (main_modifier_state() & MODIFIER_SHIFT) {
569 access_action ("Editor/set-loop-from-edit-range");
570 return off;
571 } else {
572 bool was_on = session->get_play_loop();
573 loop_toggle ();
574 return was_on ? off : on;
575 }
576 }
577
578 LedState
loop_release(Button &)579 US2400Protocol::loop_release (Button &)
580 {
581 return none;
582 }
583
584 LedState
enter_press(Button &)585 US2400Protocol::enter_press (Button &)
586 {
587 if (main_modifier_state() & MODIFIER_SHIFT) {
588 access_action ("Transport/ToggleFollowEdits");
589 } else {
590 access_action ("Common/select-all-tracks");
591 }
592 return none;
593 }
594
595 LedState
enter_release(Button &)596 US2400Protocol::enter_release (Button &)
597 {
598 return none;
599 }
600
601 LedState
bank_release(Button & b,uint32_t basic_bank_num)602 US2400Protocol::bank_release (Button& b, uint32_t basic_bank_num)
603 {
604 if (_subview_mode != None) {
605 return none;
606 }
607
608 uint32_t bank_num = basic_bank_num;
609
610 if (b.long_press_count() > 0) {
611 bank_num = 8 + basic_bank_num;
612 }
613
614 (void) switch_banks (n_strips() * bank_num);
615
616 return on;
617 }
618
619 /* F-KEYS are only used for actions that are bound from the control panel; no need to address them here
620 LedState
621 US2400Protocol::F1_press (Button &b)
622 {
623 return on;
624 }
625 LedState
626 US2400Protocol::F1_release (Button &b)
627 {
628 return off;
629 }
630 LedState
631 US2400Protocol::F2_press (Button &)
632 {
633 return on;
634 }
635 LedState
636 US2400Protocol::F2_release (Button &b)
637 {
638 return off;
639 }
640 LedState
641 US2400Protocol::F3_press (Button &)
642 {
643 return on;
644 }
645 LedState
646 US2400Protocol::F3_release (Button &b)
647 {
648 return off;
649 }
650 LedState
651 US2400Protocol::F4_press (Button &)
652 {
653 return on;
654 }
655 LedState
656 US2400Protocol::F4_release (Button &b)
657 {
658 return off;
659 }
660 LedState
661 US2400Protocol::F5_press (Button &)
662 {
663 return on;
664 }
665 LedState
666 US2400Protocol::F5_release (Button &)
667 {
668 return off;
669 }
670 LedState
671 US2400Protocol::F6_press (Button &)
672 {
673 return on;
674 }
675 LedState
676 US2400Protocol::F6_release (Button &)
677 {
678 return off;
679 }
680 LedState
681 US2400Protocol::F7_press (Button &)
682 {
683 return on;
684 }
685 LedState
686 US2400Protocol::F7_release (Button &)
687 {
688 return off;
689 }
690 LedState
691 US2400Protocol::F8_press (Button &)
692 {
693 return on;
694 }
695 LedState
696 US2400Protocol::F8_release (Button &)
697 {
698 return off;
699 }
700 */
701
702
703 /* UNIMPLEMENTED */
704
705 LedState
pan_press(Button &)706 US2400Protocol::pan_press (Button &)
707 {
708 //US-2400: deselect all strips when the user asks for "Pan". This resets us to default showing the panner only
709 access_action ("Mixer/select-none");
710
711 return none;
712 }
713 LedState
pan_release(Button &)714 US2400Protocol::pan_release (Button &)
715 {
716 return none;
717 }
718 LedState
plugin_press(Button &)719 US2400Protocol::plugin_press (Button &)
720 {
721 return off;
722 }
723 LedState
plugin_release(Button &)724 US2400Protocol::plugin_release (Button &)
725 {
726 // Do not do this yet, since it does nothing
727 // set_view_mode (Plugins);
728 return none; /* LED state set by set_view_mode */
729 }
730 LedState
eq_press(Button &)731 US2400Protocol::eq_press (Button &)
732 {
733 return none; /* led state handled by set_subview_mode() */
734
735 }
736 LedState
eq_release(Button &)737 US2400Protocol::eq_release (Button &)
738 {
739 return none;
740 }
741 LedState
dyn_press(Button &)742 US2400Protocol::dyn_press (Button &)
743 {
744 return none; /* led state handled by set_subview_mode() */
745 }
746
747 LedState
dyn_release(Button &)748 US2400Protocol::dyn_release (Button &)
749 {
750 return none;
751 }
752
753 LedState
flip_press(Button &)754 US2400Protocol::flip_press (Button &)
755 {
756 if (_view_mode == Busses) {
757 set_view_mode (Mixer);
758 return off;
759 } else {
760 set_view_mode (Busses);
761 return on;
762 }
763 }
764
765 LedState
flip_release(Button &)766 US2400Protocol::flip_release (Button &)
767 {
768 return none;
769 }
770
771 LedState
mstr_press(Button &)772 US2400Protocol::mstr_press (Button &)
773 {
774 // access_action("Mixer/select-none");
775 set_stripable_selection( session->master_out() );
776 return on;
777 }
778
779 LedState
mstr_release(Button &)780 US2400Protocol::mstr_release (Button &)
781 {
782 return none;
783 }
784
785 LedState
name_value_press(Button &)786 US2400Protocol::name_value_press (Button &)
787 {
788 return off;
789 }
790 LedState
name_value_release(Button &)791 US2400Protocol::name_value_release (Button &)
792 {
793 return off;
794 }
795 LedState
touch_press(Button &)796 US2400Protocol::touch_press (Button &)
797 {
798 return none;
799 }
800 LedState
touch_release(Button &)801 US2400Protocol::touch_release (Button &)
802 {
803 set_automation_state (ARDOUR::Touch);
804 return none;
805 }
806 LedState
cancel_press(Button &)807 US2400Protocol::cancel_press (Button &)
808 {
809 if (main_modifier_state() & MODIFIER_SHIFT) {
810 access_action ("Transport/ToggleExternalSync");
811 } else {
812 access_action ("Main/Escape");
813 }
814 return none;
815 }
816 LedState
cancel_release(Button &)817 US2400Protocol::cancel_release (Button &)
818 {
819 return none;
820 }
821 LedState
user_a_press(Button &)822 US2400Protocol::user_a_press (Button &)
823 {
824 transport_play (get_transport_speed() == 1.0);
825 return off;
826 }
827 LedState
user_a_release(Button &)828 US2400Protocol::user_a_release (Button &)
829 {
830 return off;
831 }
832 LedState
user_b_press(Button &)833 US2400Protocol::user_b_press (Button &)
834 {
835 transport_stop();
836 return off;
837 }
838 LedState
user_b_release(Button &)839 US2400Protocol::user_b_release (Button &)
840 {
841 return off;
842 }
843
844 LedState
master_fader_touch_press(US2400::Button &)845 US2400Protocol::master_fader_touch_press (US2400::Button &)
846 {
847 DEBUG_TRACE (DEBUG::US2400, "US2400Protocol::master_fader_touch_press\n");
848
849 Fader* master_fader = _master_surface->master_fader();
850
851 boost::shared_ptr<AutomationControl> ac = master_fader->control ();
852
853 master_fader->set_in_use (true);
854 master_fader->start_touch (transport_sample());
855
856 return none;
857 }
858 LedState
master_fader_touch_release(US2400::Button &)859 US2400Protocol::master_fader_touch_release (US2400::Button &)
860 {
861 DEBUG_TRACE (DEBUG::US2400, "US2400Protocol::master_fader_touch_release\n");
862
863 Fader* master_fader = _master_surface->master_fader();
864
865 master_fader->set_in_use (false);
866 master_fader->stop_touch (transport_sample());
867
868 return none;
869 }
870
871 US2400::LedState
read_press(US2400::Button &)872 US2400Protocol::read_press (US2400::Button&)
873 {
874 return none;
875 }
876
877 US2400::LedState
read_release(US2400::Button &)878 US2400Protocol::read_release (US2400::Button&)
879 {
880 set_automation_state (ARDOUR::Play);
881 return none;
882 }
883 US2400::LedState
write_press(US2400::Button &)884 US2400Protocol::write_press (US2400::Button&)
885 {
886 return none;
887 }
888 US2400::LedState
write_release(US2400::Button &)889 US2400Protocol::write_release (US2400::Button&)
890 {
891 set_automation_state (ARDOUR::Write);
892 return none;
893 }
894
895 US2400::LedState
clearsolo_press(US2400::Button &)896 US2400Protocol::clearsolo_press (US2400::Button&)
897 {
898 // clears all solos and listens (pfl/afl)
899 if (main_modifier_state() & MODIFIER_OPTION) {
900 cancel_all_solo ();
901 }
902
903 return none;
904 }
905
906 US2400::LedState
clearsolo_release(US2400::Button &)907 US2400Protocol::clearsolo_release (US2400::Button&)
908 {
909 //return session->soloing();
910 return none;
911 }
912
913 US2400::LedState
track_press(US2400::Button &)914 US2400Protocol::track_press (US2400::Button&)
915 {
916 set_subview_mode (TrackView, first_selected_stripable());
917 return none;
918 }
919 US2400::LedState
track_release(US2400::Button &)920 US2400Protocol::track_release (US2400::Button&)
921 {
922 return none;
923 }
924 US2400::LedState
send_press(US2400::Button &)925 US2400Protocol::send_press (US2400::Button&)
926 {
927 // _modifier_state |= MODIFIER_AUX; //US2400 ... AUX button is some kind of modifier
928 // return on;
929
930 // set_subview_mode (Sends, first_selected_stripable());
931
932 //DO NOTHING
933
934 return none; /* led state handled by set_subview_mode() */
935 }
936 US2400::LedState
send_release(US2400::Button &)937 US2400Protocol::send_release (US2400::Button&)
938 {
939 return none;
940 }
941 US2400::LedState
miditracks_press(US2400::Button &)942 US2400Protocol::miditracks_press (US2400::Button&)
943 {
944 return none;
945 }
946 US2400::LedState
miditracks_release(US2400::Button &)947 US2400Protocol::miditracks_release (US2400::Button&)
948 {
949 return none;
950 }
951 US2400::LedState
inputs_press(US2400::Button &)952 US2400Protocol::inputs_press (US2400::Button&)
953 {
954 return none;
955 }
956 US2400::LedState
inputs_release(US2400::Button &)957 US2400Protocol::inputs_release (US2400::Button&)
958 {
959 return none;
960 }
961 US2400::LedState
audiotracks_press(US2400::Button &)962 US2400Protocol::audiotracks_press (US2400::Button&)
963 {
964 return none;
965 }
966 US2400::LedState
audiotracks_release(US2400::Button &)967 US2400Protocol::audiotracks_release (US2400::Button&)
968 {
969 return none;
970 }
971 US2400::LedState
audioinstruments_press(US2400::Button & b)972 US2400Protocol::audioinstruments_press (US2400::Button& b)
973 {
974 return none;
975 }
976
977 US2400::LedState
audioinstruments_release(US2400::Button & b)978 US2400Protocol::audioinstruments_release (US2400::Button& b)
979 {
980 return none;
981
982 }
983 US2400::LedState
aux_press(US2400::Button &)984 US2400Protocol::aux_press (US2400::Button&)
985 {
986 return none;
987 }
988 US2400::LedState
aux_release(US2400::Button &)989 US2400Protocol::aux_release (US2400::Button&)
990 {
991 return none;
992 }
993 US2400::LedState
busses_press(US2400::Button &)994 US2400Protocol::busses_press (US2400::Button&)
995 {
996 return none;
997 }
998 US2400::LedState
busses_release(US2400::Button &)999 US2400Protocol::busses_release (US2400::Button&)
1000 {
1001 return none;
1002 }
1003 US2400::LedState
outputs_press(US2400::Button &)1004 US2400Protocol::outputs_press (US2400::Button&)
1005 {
1006 return none;
1007 }
1008 US2400::LedState
outputs_release(US2400::Button &)1009 US2400Protocol::outputs_release (US2400::Button&)
1010 {
1011 return none;
1012 }
1013 US2400::LedState
user_press(US2400::Button &)1014 US2400Protocol::user_press (US2400::Button&)
1015 {
1016 return none;
1017 }
1018 US2400::LedState
user_release(US2400::Button &)1019 US2400Protocol::user_release (US2400::Button&)
1020 {
1021 return none;
1022 }
1023 US2400::LedState
trim_press(US2400::Button &)1024 US2400Protocol::trim_press (US2400::Button&)
1025 {
1026 return none;
1027 }
1028 US2400::LedState
trim_release(US2400::Button &)1029 US2400Protocol::trim_release (US2400::Button&)
1030 {
1031 return none;
1032 }
1033 US2400::LedState
latch_press(US2400::Button &)1034 US2400Protocol::latch_press (US2400::Button&)
1035 {
1036 return none;
1037 }
1038 US2400::LedState
latch_release(US2400::Button &)1039 US2400Protocol::latch_release (US2400::Button&)
1040 {
1041 return none;
1042 }
1043 US2400::LedState
grp_press(US2400::Button &)1044 US2400Protocol::grp_press (US2400::Button&)
1045 {
1046 return none;
1047 }
1048 US2400::LedState
grp_release(US2400::Button &)1049 US2400Protocol::grp_release (US2400::Button&)
1050 {
1051 /* There is no "Off" button for automation,
1052 so we use Group for this purpose.
1053 */
1054 set_automation_state (Off);
1055 return none;
1056 }
1057 US2400::LedState
nudge_press(US2400::Button &)1058 US2400Protocol::nudge_press (US2400::Button&)
1059 {
1060 // _modifier_state |= MODIFIER_NUDGE; //no such button on US2400
1061 nudge_modifier_consumed_by_button = false;
1062 return on;
1063 }
1064 US2400::LedState
nudge_release(US2400::Button &)1065 US2400Protocol::nudge_release (US2400::Button&)
1066 {
1067 // _modifier_state &= ~MODIFIER_NUDGE; //no such button on US2400
1068
1069 /* XXX these action names are stupid, because the action can affect
1070 * regions, markers or the playhead depending on selection state.
1071 */
1072
1073 if (main_modifier_state() & MODIFIER_SHIFT) {
1074 access_action ("Region/nudge-backward");
1075 } else {
1076 access_action ("Region/nudge-forward");
1077 }
1078
1079 return off;
1080 }
1081 US2400::LedState
replace_press(US2400::Button &)1082 US2400Protocol::replace_press (US2400::Button&)
1083 {
1084 if (main_modifier_state() == MODIFIER_SHIFT) {
1085 toggle_punch_out();
1086 return none;
1087 } else {
1088 access_action ("Common/finish-range-from-playhead");
1089 }
1090 return none;
1091 }
1092 US2400::LedState
replace_release(US2400::Button &)1093 US2400Protocol::replace_release (US2400::Button&)
1094 {
1095 return none;
1096 }
1097 US2400::LedState
click_press(US2400::Button &)1098 US2400Protocol::click_press (US2400::Button&)
1099 {
1100 if (main_modifier_state() & MODIFIER_SHIFT) {
1101 access_action ("Editor/set-punch-from-edit-range");
1102 return off;
1103 } else {
1104 bool state = !Config->get_clicking();
1105 Config->set_clicking (state);
1106 return state;
1107 }
1108 }
1109 US2400::LedState
click_release(US2400::Button &)1110 US2400Protocol::click_release (US2400::Button&)
1111 {
1112 return none;
1113 }
1114 US2400::LedState
view_press(US2400::Button &)1115 US2400Protocol::view_press (US2400::Button&)
1116 {
1117 set_view_mode (Mixer);
1118 return none;
1119 }
1120 US2400::LedState
view_release(US2400::Button &)1121 US2400Protocol::view_release (US2400::Button&)
1122 {
1123 return none;
1124 }
1125