2 Copyright (C) 2016 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.
19 #include "ardour/mute_control.h"
20 #include "ardour/session.h"
21 #include "ardour/solo_control.h"
25 using namespace ArdourSurface;
26 using namespace ARDOUR;
31 if (session->transport_rolling ()) {
39 Push2::button_recenable ()
57 Push2::button_right ()
59 ScrollTimeline (0.75);
65 ScrollTimeline (-0.75);
69 Push2::button_repeat ()
75 Push2::button_metronome ()
89 access_action ("Editor/start-range-from-playhead");
91 id_button_map[New]->set_color (LED::White);
92 id_button_map[New]->set_state (LED::NoTransition);
93 write (id_button_map[New]->state_msg());
95 /* blink the button for the other half of this operation */
97 id_button_map[FixedLength]->set_color (LED::White);
98 id_button_map[FixedLength]->set_state (LED::Blinking4th);
99 write (id_button_map[FixedLength]->state_msg());
104 Push2::button_fixed_length ()
106 access_action ("Editor/finish-range-from-playhead");
108 /* turn off both buttons for this operation */
110 id_button_map[New]->set_color (LED::Black);
111 id_button_map[New]->set_state (LED::NoTransition);
112 write (id_button_map[New]->state_msg());
113 id_button_map[FixedLength]->set_color (LED::Black);
114 id_button_map[FixedLength]->set_state (LED::NoTransition);
115 write (id_button_map[FixedLength]->state_msg());
119 Push2::button_shift_press ()
121 modifier_state = ModifierState (modifier_state | ModShift);
125 Push2::button_shift_release ()
127 modifier_state = ModifierState (modifier_state & ~ModShift);
131 Push2::button_browse ()
133 switch_bank (max (0, bank_start - 8));
137 Push2::button_clip ()
139 switch_bank (max (0, bank_start + 8));
143 Push2::button_upper (uint32_t n)
149 boost::shared_ptr<SoloControl> sc = stripable[n]->solo_control ();
151 sc->set_value (!sc->get_value(), PBD::Controllable::UseGroup);
156 Push2::button_lower (uint32_t n)
162 boost::shared_ptr<MuteControl> mc = stripable[n]->mute_control ();
165 mc->set_value (!mc->get_value(), PBD::Controllable::UseGroup);
170 Push2::button_undo ()
172 if (modifier_state & ModShift) {
173 ControlProtocol::Redo ();
175 ControlProtocol::Undo ();
180 Push2::button_fwd32t ()
182 const int n = (modifier_state & ModShift) ? 8 : 0;
183 goto_nth_marker (0+n);
187 Push2::button_fwd32 ()
189 const int n = (modifier_state & ModShift) ? 8 : 0;
190 goto_nth_marker (1+n);
194 Push2::button_fwd16t ()
196 const int n = (modifier_state & ModShift) ? 8 : 0;
197 goto_nth_marker (2+n);
201 Push2::button_fwd16 ()
203 const int n = (modifier_state & ModShift) ? 8 : 0;
204 goto_nth_marker (3+n);
208 Push2::button_fwd8t ()
210 const int n = (modifier_state & ModShift) ? 8 : 0;
211 goto_nth_marker (4+n);
215 Push2::button_fwd8 ()
217 const int n = (modifier_state & ModShift) ? 8 : 0;
218 goto_nth_marker (5+n);
222 Push2::button_fwd4t ()
224 const int n = (modifier_state & ModShift) ? 8 : 0;
225 goto_nth_marker (6+n);
229 Push2::button_fwd4 ()
231 const int n = (modifier_state & ModShift) ? 8 : 0;
232 goto_nth_marker (7+n);