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.
21 #include "ardour/debug.h"
22 #include "ardour/mute_control.h"
23 #include "ardour/session.h"
24 #include "ardour/solo_control.h"
25 #include "ardour/solo_isolate_control.h"
27 #include "launch_control_xl.h"
29 using namespace ArdourSurface;
30 using namespace ARDOUR;
35 LaunchControlXL::build_maps ()
41 nn_note_button_map.clear();
42 id_note_button_map.clear();
43 cc_controller_button_map.clear();
44 id_controller_button_map.clear();
47 boost::shared_ptr<Knob> knob;
49 #define MAKE_KNOB(i,cc,index,c_on,c_off,a) \
50 knob.reset (new Knob ((i), (cc), (index), (c_on), (c_off), (a), (*this))); \
51 cc_knob_map.insert (std::make_pair (knob->controller_number(), knob)); \
52 id_knob_map.insert (std::make_pair (knob->id(), knob));
53 #define MAKE_DM_KNOB(i,cc,index,c_on,c_off,action,check) \
54 knob.reset (new Knob ((i), (cc), (index), (c_on), (c_off), (action), (check), (*this))); \
55 cc_knob_map.insert (std::make_pair (knob->controller_number(), knob)); \
56 id_knob_map.insert (std::make_pair (knob->id(), knob));
58 if (!device_mode()) { /* mixer mode */
59 MAKE_KNOB (SendA1, 13, 0, RedFull, RedLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_sendA, this, 0)));
60 MAKE_KNOB (SendA2, 14, 1, YellowFull, YellowLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_sendA, this, 1)));
61 MAKE_KNOB (SendA3, 15, 2, GreenFull, GreenLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_sendA, this, 2)));
62 MAKE_KNOB (SendA4, 16, 3, AmberFull, AmberLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_sendA, this, 3)));
63 MAKE_KNOB (SendA5, 17, 4, RedFull, RedLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_sendA, this, 4)));
64 MAKE_KNOB (SendA6, 18, 5, YellowFull, YellowLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_sendA, this, 5)));
65 MAKE_KNOB (SendA7, 19, 6, GreenFull, GreenLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_sendA, this, 6)));
66 MAKE_KNOB (SendA8, 20, 7, AmberFull, AmberLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_sendA, this, 7)));
68 MAKE_KNOB (SendB1, 29, 8, RedFull, RedLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_sendB, this, 0)));
69 MAKE_KNOB (SendB2, 30, 9, YellowFull, YellowLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_sendB, this, 1)));
70 MAKE_KNOB (SendB3, 31, 10, GreenFull, GreenLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_sendB, this, 2)));
71 MAKE_KNOB (SendB4, 32, 11, AmberFull, AmberLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_sendB, this, 3)));
72 MAKE_KNOB (SendB5, 33, 12, RedFull, RedLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_sendB, this, 4)));
73 MAKE_KNOB (SendB6, 34, 13, YellowFull, YellowLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_sendB, this, 5)));
74 MAKE_KNOB (SendB7, 35, 14, GreenFull, GreenLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_sendB, this, 6)));
75 MAKE_KNOB (SendB8, 36, 15, AmberFull, AmberLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_sendB, this, 7)));
77 MAKE_KNOB (Pan1, 49, 16, RedFull, RedLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_pan, this, 0)));
78 MAKE_KNOB (Pan2, 50, 17, YellowFull, YellowLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_pan, this, 1)));
79 MAKE_KNOB (Pan3, 51, 18, GreenFull, GreenLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_pan, this, 2)));
80 MAKE_KNOB (Pan4, 52, 19, AmberFull, AmberLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_pan, this, 3)));
81 MAKE_KNOB (Pan5, 53, 20, RedFull, RedLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_pan, this, 4)));
82 MAKE_KNOB (Pan6, 54, 21, YellowFull, YellowLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_pan, this, 5)));
83 MAKE_KNOB (Pan7, 55, 22, GreenFull, GreenLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_pan, this, 6)));
84 MAKE_KNOB (Pan8, 56, 23, AmberFull, AmberLow, boost::function<void ()> (boost::bind (&LaunchControlXL::knob_pan, this, 7)));
86 } else { /* device mode */
88 #ifdef MIXBUS // from here Mixbus Standard + 32C
89 MAKE_DM_KNOB (SendB5, 33, 12, RedFull, RedLow, boost::function<void ()>
90 (boost::bind (&LaunchControlXL::dm_trim, this, SendB5)),
91 boost::bind(&LaunchControlXL::dm_check_trim, this));
92 MAKE_DM_KNOB (SendB6, 34, 13, GreenFull, GreenLow, boost::function<void ()>
93 (boost::bind (&LaunchControlXL::dm_mb_comp, this, SendB6, CompMakeup)),
94 boost::bind(&LaunchControlXL::dm_mb_comp_enabled,this));
95 MAKE_DM_KNOB (SendB7, 35, 14, GreenFull, GreenLow, boost::function<void ()>
96 (boost::bind (&LaunchControlXL::dm_mb_comp, this, SendB7, CompSpeed)),
97 boost::bind(&LaunchControlXL::dm_mb_comp_enabled, this));
98 MAKE_DM_KNOB (SendB8, 36, 15, GreenFull, GreenLow, boost::function<void ()>
99 (boost::bind (&LaunchControlXL::dm_mb_comp, this, SendB8, CompMode)),
100 boost::bind(&LaunchControlXL::dm_mb_comp_enabled, this));
102 /* Pan Knobs -> Sends */
103 for (uint8_t i = 0; i < 8; ++i) {
104 MAKE_DM_KNOB (static_cast<KnobID>(i + 16), (i + 49), (i + 16), GreenLow, YellowLow, boost::function<void()>
105 (boost::bind (&LaunchControlXL::dm_mb_sends, this, static_cast<KnobID>(i + 16))),
106 boost::function<uint8_t ()> (boost::bind(&LaunchControlXL::dm_mb_check_send_knob, this, static_cast<KnobID>(i + 16))));
109 #ifdef MIXBUS32C // from here 32C only
111 if (first_selected_stripable() && (first_selected_stripable()->is_master() || first_selected_stripable()->mixbus())) {
112 MAKE_DM_KNOB (SendA1, 13, 0, AmberFull, AmberLow, boost::function<void ()>
113 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendA1, true, 0)),
114 boost::function<uint8_t ()> (boost::bind(&LaunchControlXL::dm_mb_eq_gain_enabled, this, 0)));
115 MAKE_DM_KNOB (SendA2, 14, 1, AmberFull, AmberLow, boost::function<void ()>
116 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendA2, true, 1)),
117 boost::function<uint8_t ()> (boost::bind(&LaunchControlXL::dm_mb_eq_gain_enabled, this, 1)));
118 MAKE_DM_KNOB (SendA3, 15, 2, AmberFull, AmberLow, boost::function<void ()>
119 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendA3, true, 2)),
120 boost::function<uint8_t ()> (boost::bind(&LaunchControlXL::dm_mb_eq_gain_enabled, this, 2)));
121 MAKE_DM_KNOB (SendA6, 18, 5, RedLow, RedLow, boost::function<void ()>
122 (boost::bind (&LaunchControlXL::dm_pan_width, this, SendA6)),
123 boost::bind(&LaunchControlXL::dm_check_pan_width, this));
124 MAKE_DM_KNOB (SendA7, 19, 6, AmberLow, AmberLow, boost::function<void ()>
125 (boost::bind (&LaunchControlXL::dm_mb_tapedrive, this, SendA7)),
126 boost::bind(&LaunchControlXL::dm_mb_has_tapedrive, this));
128 MAKE_DM_KNOB (SendA1, 13, 0, AmberFull, AmberLow, boost::function<void ()>
129 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendA1, false, 0)),
130 boost::bind(&LaunchControlXL::dm_mb_eq_freq_enabled, this));
131 MAKE_DM_KNOB (SendA2, 14, 1, AmberFull, AmberLow, boost::function<void ()>
132 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendA2, true, 0)),
133 boost::function<uint8_t ()> (boost::bind(&LaunchControlXL::dm_mb_eq_gain_enabled, this, 0)));
134 MAKE_DM_KNOB (SendA3, 15, 2, YellowLow, AmberLow, boost::function<void ()>
135 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendA3, false, 1)),
136 boost::bind(&LaunchControlXL::dm_mb_eq_freq_enabled, this));
137 MAKE_DM_KNOB (SendA4, 16, 3, YellowLow, AmberLow, boost::function<void ()>
138 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendA4, true, 1)),
139 boost::function<uint8_t ()> (boost::bind(&LaunchControlXL::dm_mb_eq_gain_enabled, this, 1)));
140 MAKE_DM_KNOB (SendA5, 17, 4, AmberFull, AmberLow, boost::function<void ()>
141 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendA5, false, 2)),
142 boost::bind(&LaunchControlXL::dm_mb_eq_freq_enabled, this));
143 MAKE_DM_KNOB (SendA6, 18, 5, AmberFull, AmberLow, boost::function<void ()>
144 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendA6, true, 2)),
145 boost::function<uint8_t ()> (boost::bind(&LaunchControlXL::dm_mb_eq_gain_enabled, this, 2)));
146 MAKE_DM_KNOB (SendA7, 19, 6, YellowLow, AmberLow, boost::function<void ()>
147 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendA7, false, 3)),
148 boost::bind(&LaunchControlXL::dm_mb_eq_freq_enabled, this));
149 MAKE_DM_KNOB (SendA8, 20, 7, YellowLow, AmberLow, boost::function<void ()>
150 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendA8, true, 3)),
151 boost::function<uint8_t ()> (boost::bind(&LaunchControlXL::dm_mb_eq_gain_enabled, this, 3)));
153 MAKE_DM_KNOB (SendB1, 29, 8, YellowFull, AmberLow, boost::function<void ()>
154 (boost::bind (&LaunchControlXL::dm_mb_flt_frq, this, SendB1, true)),
155 boost::bind(&LaunchControlXL::dm_mb_flt_enabled, this));
156 MAKE_DM_KNOB (SendB2, 30, 9, YellowFull, AmberLow, boost::function<void ()>
157 (boost::bind (&LaunchControlXL::dm_mb_flt_frq, this, SendB2, false)),
158 boost::bind(&LaunchControlXL::dm_mb_flt_enabled, this));
159 MAKE_DM_KNOB (SendB4, 32, 11, RedLow, AmberLow, boost::function<void ()>
160 (boost::bind (&LaunchControlXL::dm_pan_azi, this, SendB4)),
161 boost::bind(&LaunchControlXL::dm_check_pan_azi, this));
163 #else // from here Mixbus Standard only
164 MAKE_DM_KNOB (SendA1, 13, 0, AmberFull, AmberLow, boost::function<void ()>
165 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendA1, true, 0)),
166 boost::function<uint8_t ()> (boost::bind(&LaunchControlXL::dm_mb_eq_gain_enabled, this, 0)));
167 MAKE_DM_KNOB (SendA2, 14, 1, AmberFull, AmberLow, boost::function<void ()>
168 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendA2, true, 1)),
169 boost::function<uint8_t ()> (boost::bind(&LaunchControlXL::dm_mb_eq_gain_enabled, this, 1)));
170 MAKE_DM_KNOB (SendA3, 15, 2, AmberFull, AmberLow, boost::function<void ()>
171 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendA3, true, 2)),
172 boost::function<uint8_t ()> (boost::bind(&LaunchControlXL::dm_mb_eq_gain_enabled, this, 2)));
173 MAKE_DM_KNOB (SendA5, 17, 4, RedLow, AmberLow, boost::function<void ()>
174 (boost::bind (&LaunchControlXL::dm_pan_azi, this, SendA5)),
175 boost::bind(&LaunchControlXL::dm_check_pan_azi, this));
176 MAKE_DM_KNOB (SendA6, 18, 5, RedLow, RedLow, boost::function<void ()>
177 (boost::bind (&LaunchControlXL::dm_pan_width, this, SendA6)),
178 boost::bind(&LaunchControlXL::dm_check_pan_width, this));
179 MAKE_DM_KNOB (SendA7, 19, 6, AmberLow, AmberLow, boost::function<void ()>
180 (boost::bind (&LaunchControlXL::dm_mb_tapedrive, this, SendA7)),
181 boost::bind(&LaunchControlXL::dm_mb_has_tapedrive, this));
182 MAKE_DM_KNOB (SendB1, 29, 8, YellowFull, AmberLow, boost::function<void ()>
183 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendB1, false, 0)),
184 boost::bind(&LaunchControlXL::dm_mb_eq_freq_enabled, this));
185 MAKE_DM_KNOB (SendB2, 30, 9, YellowFull, AmberLow, boost::function<void ()>
186 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendB2, false, 1)),
187 boost::bind(&LaunchControlXL::dm_mb_eq_freq_enabled, this));
188 MAKE_DM_KNOB (SendB3, 31, 10, YellowFull, AmberLow, boost::function<void ()>
189 (boost::bind (&LaunchControlXL::dm_mb_eq, this, SendB3, false, 2)),
190 boost::bind(&LaunchControlXL::dm_mb_eq_freq_enabled, this));
191 MAKE_DM_KNOB (SendB4, 32, 11, YellowFull, AmberLow, boost::function<void ()>
192 (boost::bind (&LaunchControlXL::dm_mb_flt_frq, this, SendB4, true)),
193 boost::bind(&LaunchControlXL::dm_mb_eq_freq_enabled, this));
195 #else // from here Ardour
201 boost::shared_ptr<Fader> fader;
203 #define MAKE_FADER(i,cc,a) \
204 fader.reset (new Fader ((i), (cc), (a))); \
205 cc_fader_map.insert (std::make_pair (fader->controller_number(), fader)); \
206 id_fader_map.insert (std::make_pair (fader->id(), fader))
208 if (!device_mode()) { /* mix mode */
209 for (uint8_t i = 0; i < 8; ++i) {
210 MAKE_FADER(static_cast<FaderID>(i), i+77, boost::function<void()>
211 (boost::bind (&LaunchControlXL::fader, this, i)));
214 } else { /* device mode */
215 MAKE_FADER(Fader1, 77, boost::function<void()>
216 (boost::bind (&LaunchControlXL::dm_fader, this, Fader1)));
218 MAKE_FADER(Fader2, 78, boost::function<void()>
219 (boost::bind (&LaunchControlXL::dm_mb_comp_thresh, this, Fader2)));
224 boost::shared_ptr<ControllerButton> controller_button;
225 boost::shared_ptr<NoteButton> note_button;
228 #define MAKE_TRACK_BUTTON_PRESS(i,nn,index,c_on,c_off,p,check) \
229 note_button.reset (new TrackButton ((i), (nn), (index), (c_on), (c_off), (p), \
230 boost::bind(&LaunchControlXL::relax, this), boost::bind(&LaunchControlXL::relax, this), (check), (*this))); \
231 nn_note_button_map.insert (std::make_pair (note_button->note_number(), note_button)); \
232 id_note_button_map.insert (std::make_pair (note_button->id(), note_button))
233 #define MAKE_CTRL_BUTTON_PRESS(i,nn,index,c_on,c_off,p,check) \
234 note_button.reset (new TrackButton ((i), (nn), (index), (c_on), (c_off), (p), \
235 boost::bind(&LaunchControlXL::relax, this), boost::bind(&LaunchControlXL::relax, this), (check), (*this))); \
236 nn_note_button_map.insert (std::make_pair (note_button->note_number(), note_button)); \
237 id_note_button_map.insert (std::make_pair (note_button->id(), note_button))
238 #define MAKE_SELECT_BUTTON_PRESS(i,cc,index,p) \
239 controller_button.reset (new SelectButton ((i), (cc), (index), (p), \
240 boost::bind(&LaunchControlXL::relax, this), boost::bind(&LaunchControlXL::relax, this), (*this))); \
241 cc_controller_button_map.insert (std::make_pair (controller_button->controller_number(), controller_button)); \
242 id_controller_button_map.insert (std::make_pair (controller_button->id(), controller_button))
243 #define MAKE_TRACK_STATE_BUTTON_PRESS(i,nn,index,p) \
244 note_button.reset (new TrackStateButton ((i), (nn), (index), (p), \
245 boost::bind(&LaunchControlXL::relax, this), boost::bind(&LaunchControlXL::relax, this), (*this))); \
246 nn_note_button_map.insert (std::make_pair (note_button->note_number(), note_button)); \
247 id_note_button_map.insert (std::make_pair (note_button->id(), note_button))
248 #define MAKE_TRACK_STATE_BUTTON_PRESS_RELEASE_LONG(i,nn,index, p,r,l) \
249 note_button.reset (new TrackStateButton ((i), (nn), (index), (p), (r), (l), (*this))); \
250 nn_note_button_map.insert (std::make_pair (note_button->note_number(), note_button)); \
251 id_note_button_map.insert (std::make_pair (note_button->id(), note_button))
253 /* Track Focus Buttons */
254 if (!device_mode()) { /* mixer mode */
255 for (uint8_t i = 0; i < 4; ++i) {
256 MAKE_TRACK_BUTTON_PRESS(static_cast<ButtonID>(i), i+41, i+24, YellowFull, YellowLow,
257 boost::function<void()> (boost::bind (&LaunchControlXL::button_track_focus, this, i)),
258 boost::function<uint8_t()> (boost::bind (&LaunchControlXL::dm_check_dummy, this, dev_nonexistant)));
261 for (uint8_t i = 0; i < 4; ++i) {
262 MAKE_TRACK_BUTTON_PRESS(static_cast<ButtonID>(i+4), i+57, i+28, YellowFull, YellowLow,
263 boost::function<void()> (boost::bind (&LaunchControlXL::button_track_focus, this, i+4)),
264 boost::function<uint8_t()> (boost::bind (&LaunchControlXL::dm_check_dummy, this, dev_nonexistant)));
267 } else { /* device mode */
269 for (uint8_t i = 0; i < 4; ++i) {
270 MAKE_TRACK_BUTTON_PRESS(static_cast<ButtonID>(i), i+41, i+24, GreenFull, YellowLow,
271 boost::function<void()> (boost::bind (&LaunchControlXL::dm_mb_send_switch, this, static_cast<ButtonID>(i))),
272 boost::function<uint8_t()> (boost::bind (&LaunchControlXL::dm_mb_check_send_button, this, i)));
276 for (uint8_t i = 0; i < 4; ++i) {
277 MAKE_TRACK_BUTTON_PRESS(static_cast<ButtonID>(i+4), i+57, i+28, GreenFull, YellowLow,
278 boost::function<void()> (boost::bind (&LaunchControlXL::dm_mb_send_switch, this, static_cast<ButtonID>(i+4))),
279 boost::function<uint8_t()> (boost::bind (&LaunchControlXL::dm_mb_check_send_button, this, i+4)));
283 /* Track Control Buttons */
284 if (!device_mode()) { /* mixer mode */
285 /* Control Buttons in mix mode change their color dynamically so we won't set them here */
286 for (uint8_t i = 0; i < 4; ++i) {
287 MAKE_CTRL_BUTTON_PRESS(static_cast<ButtonID>(i+8), i+73, i+32, Off, Off,
288 boost::function<void()> (boost::bind (&LaunchControlXL::button_press_track_control, this, i)),
289 boost::function<uint8_t()> (boost::bind (&LaunchControlXL::dm_check_dummy, this, dev_nonexistant)));
292 for (uint8_t i = 0; i < 4; ++i) {
293 MAKE_CTRL_BUTTON_PRESS(static_cast<ButtonID>(i+12), i+89, i+36, Off, Off,
294 boost::function<void()> (boost::bind (&LaunchControlXL::button_press_track_control, this, i+4)),
295 boost::function<uint8_t()> (boost::bind (&LaunchControlXL::dm_check_dummy, this, dev_nonexistant)));
298 } else { /*device mode */
299 #ifdef MIXBUS // from here Mixbus Standard + 32C
300 MAKE_CTRL_BUTTON_PRESS(Control1, 73, 32, YellowFull, YellowLow, (boost::bind (&LaunchControlXL::dm_mute_switch, this)),
301 boost::bind (&LaunchControlXL::dm_mute_enabled, this));
302 MAKE_CTRL_BUTTON_PRESS(Control2, 74, 33, GreenFull, GreenLow, (boost::bind (&LaunchControlXL::dm_solo_switch, this)),
303 boost::bind (&LaunchControlXL::dm_solo_enabled, this));
304 MAKE_CTRL_BUTTON_PRESS(Control3, 75, 34, AmberFull, AmberLow, (boost::bind (&LaunchControlXL::dm_mb_eq_switch, this)),
305 boost::function<uint8_t()> (boost::bind(&LaunchControlXL::dm_mb_eq_gain_enabled, this, 0)));
308 #ifdef MIXBUS32C // from here 32C only
309 MAKE_CTRL_BUTTON_PRESS(Control4, 76, 35, AmberFull, AmberLow,
310 boost::function<void()> (boost::bind (&LaunchControlXL::dm_mb_eq_shape_switch, this, 0)),
311 boost::function<uint8_t()> (boost::bind(&LaunchControlXL::dm_mb_eq_shape_enabled, this, 0 )));
312 MAKE_CTRL_BUTTON_PRESS(Control5, 89, 36, AmberFull, AmberLow,
313 boost::function<void()> (boost::bind (&LaunchControlXL::dm_mb_eq_shape_switch, this, 3)),
314 boost::function<uint8_t()> (boost::bind(&LaunchControlXL::dm_mb_eq_shape_enabled, this, 3 )));
315 MAKE_CTRL_BUTTON_PRESS(Control6, 90, 37, YellowFull, YellowLow, (boost::bind (&LaunchControlXL::dm_mb_flt_switch, this)),
316 boost::bind(&LaunchControlXL::dm_mb_flt_enabled, this));
317 MAKE_CTRL_BUTTON_PRESS(Control7, 91, 38, GreenFull, GreenLow, (boost::bind (&LaunchControlXL::dm_mb_master_assign_switch, this)),
318 boost::bind(&LaunchControlXL::dm_mb_master_assign_enabled, this));
319 MAKE_CTRL_BUTTON_PRESS(Control8, 92, 39, GreenFull, GreenLow, (boost::bind (&LaunchControlXL::dm_mb_comp_switch, this)),
320 boost::bind(&LaunchControlXL::dm_mb_comp_enabled, this));
322 #else // from here Mixbus Standard only
323 MAKE_CTRL_BUTTON_PRESS(Control5, 89, 36, GreenFull, GreenLow, (boost::bind (&LaunchControlXL::dm_mb_master_assign_switch, this)),
324 boost::bind(&LaunchControlXL::dm_mb_master_assign_enabled, this));
325 MAKE_CTRL_BUTTON_PRESS(Control7, 91, 38, GreenFull, GreenLow, (boost::bind (&LaunchControlXL::dm_mb_comp_switch, this)),
326 boost::bind(&LaunchControlXL::dm_mb_comp_enabled, this));
327 MAKE_CTRL_BUTTON_PRESS(Control8, 92, 39, RedFull, RedLow, (boost::bind (&LaunchControlXL::dm_recenable_switch, this)),
328 boost::bind(&LaunchControlXL::dm_recenable_enabled, this));
335 /* Select and Mode Buttons on the right side */
337 /* Sends Select buttons are independent of mode */
338 MAKE_SELECT_BUTTON_PRESS(SelectUp, 104, 44, boost::function<void()> (boost::bind (&LaunchControlXL::send_bank_switch, this, false)));
339 MAKE_SELECT_BUTTON_PRESS(SelectDown, 105, 45, boost::function<void()> (boost::bind (&LaunchControlXL::send_bank_switch, this, true)));
341 /* Device Button needs to be always there */
342 MAKE_TRACK_STATE_BUTTON_PRESS_RELEASE_LONG(Device, 105, 40,
343 boost::bind (&LaunchControlXL::relax, this) ,
344 boost::bind (&LaunchControlXL::button_device, this),
345 boost::bind (&LaunchControlXL::button_device_long_press, this));
348 if (!device_mode()) { /* mixer mode */
349 MAKE_SELECT_BUTTON_PRESS(SelectLeft, 106, 46, boost::bind (&LaunchControlXL::button_select_left, this));
350 MAKE_SELECT_BUTTON_PRESS(SelectRight, 107, 47, boost::bind (&LaunchControlXL::button_select_right, this));
352 //MAKE_TRACK_STATE_BUTTON_PRESS(Mute, 106, 41, boost::bind (&LaunchControlXL::button_mute, this));
354 MAKE_TRACK_STATE_BUTTON_PRESS_RELEASE_LONG(Mute, 106, 41,
355 boost::bind (&LaunchControlXL::relax, this) ,
356 boost::bind (&LaunchControlXL::button_mute, this),
357 boost::bind (&LaunchControlXL::button_mute_long_press, this));
359 MAKE_TRACK_STATE_BUTTON_PRESS_RELEASE_LONG(Solo, 107, 42,
360 boost::bind (&LaunchControlXL::relax, this) ,
361 boost::bind (&LaunchControlXL::button_solo, this),
362 boost::bind (&LaunchControlXL::button_solo_long_press, this));
364 //MAKE_TRACK_STATE_BUTTON_PRESS(Solo, 107, 42, boost::bind (&LaunchControlXL::button_solo, this));
365 MAKE_TRACK_STATE_BUTTON_PRESS(Record, 108, 43, boost::bind (&LaunchControlXL::button_record, this));
367 } else { /* device mode */
368 MAKE_SELECT_BUTTON_PRESS(SelectLeft, 106, 46, boost::bind (&LaunchControlXL::dm_select_prev_strip, this));
369 MAKE_SELECT_BUTTON_PRESS(SelectRight, 107, 47, boost::bind (&LaunchControlXL::dm_select_next_strip, this));
374 LaunchControlXL::button_name_by_id (ButtonID id)
388 return "Select Down";
390 return "Select Right";
392 return "Select Left";
433 LaunchControlXL::knob_name_by_id (KnobID id)
492 LaunchControlXL::fader_name_by_id (FaderID id)
518 boost::shared_ptr<LaunchControlXL::TrackButton>
519 LaunchControlXL::track_button_by_range(uint8_t n, uint8_t first, uint8_t middle)
521 NNNoteButtonMap::iterator b;
523 b = nn_note_button_map.find (first + n);
525 b = nn_note_button_map.find (middle + n - 4);
528 if (b != nn_note_button_map.end()) {
529 return boost::dynamic_pointer_cast<TrackButton> (b->second);
532 return boost::shared_ptr<TrackButton>();
536 LaunchControlXL::update_track_focus_led(uint8_t n)
538 boost::shared_ptr<TrackButton> b = focus_button_by_column(n);
545 if ( stripable[n]->is_selected() ) {
546 b->set_color(YellowFull);
548 b->set_color(AmberLow);
554 write (b->state_msg());
557 boost::shared_ptr<AutomationControl>
558 LaunchControlXL::get_ac_by_state(uint8_t n) {
559 boost::shared_ptr<AutomationControl> ac;
561 switch(track_mode()) {
563 ac = stripable[n]->mute_control();
567 ac = stripable[n]->solo_control();
571 ac = stripable[n]->rec_enable_control();
580 boost::shared_ptr<LaunchControlXL::Knob>
581 LaunchControlXL::knob_by_id(KnobID id)
583 IDKnobMap::iterator k = id_knob_map.find(id);
584 return boost::dynamic_pointer_cast<Knob> (k->second);
588 boost::shared_ptr<LaunchControlXL::Knob>*
589 LaunchControlXL::knobs_by_column(uint8_t col, boost::shared_ptr<Knob>* knob_col)
591 for (uint8_t n = 0; n < 3; ++n) {
592 if (id_knob_map.find(static_cast<KnobID>(col+n*8)) != id_knob_map.end()) {
593 knob_col[n] = id_knob_map.find(static_cast<KnobID>(col+n*8))->second;
601 LaunchControlXL::update_knob_led_by_id (uint8_t id, LEDColor color)
604 boost::shared_ptr<Knob> knob;
605 IDKnobMap::iterator k = id_knob_map.find(static_cast<KnobID>(id));
607 if (k != id_knob_map.end()) {
611 knob->set_color(color);
612 write (knob->state_msg());
616 LaunchControlXL::update_knob_led_by_strip(uint8_t n)
620 boost::shared_ptr<Knob> knobs_col[3];
621 knobs_by_column(n, knobs_col);
623 for (uint8_t s = 0; s < 3; ++s) {
626 if (stripable[n]->is_selected()) {
627 color = knobs_col[s]->color_enabled();
629 color = knobs_col[s]->color_disabled();
631 knobs_col[s]->set_color(color);
633 knobs_col[s]->set_color(Off);
635 write (knobs_col[s]->state_msg());
641 LaunchControlXL::update_track_control_led(uint8_t n)
643 boost::shared_ptr<TrackButton> b = control_button_by_column(n);
649 if ((buttons_down.find(Device) != buttons_down.end())) {
650 /* Don't update LEDs if Device button is hold - we are working on selected strips */
655 boost::shared_ptr<AutomationControl> ac = get_ac_by_state(n);
657 if (ac->get_value()) {
658 b->set_color(b->color_enabled());
660 b->set_color(b->color_disabled());
669 write (b->state_msg());
673 LaunchControlXL::solo_mute_rec_changed(uint32_t n) {
677 switch_bank(bank_start);
678 //update_track_control_led(n);
682 LaunchControlXL::solo_iso_changed(uint32_t n)
692 LaunchControlXL::solo_iso_led_bank ()
694 if (device_mode()) { return; }
696 int stripable_counter = get_amount_of_tracks();
698 if (!(buttons_down.find(Device) != buttons_down.end())) {
701 for (int n = 0; n < stripable_counter; ++n) {
702 boost::shared_ptr<TrackButton> b = focus_button_by_column(n);
703 if (stripable[n] && stripable[n]->solo_isolate_control()) {
704 if (stripable[n]->solo_isolate_control()->get_value()) {
705 b->set_color(RedFull);
710 write (b->state_msg());
714 LaunchControlXL::set_refresh_leds_flag(true);
720 LaunchControlXL::master_send_changed(uint32_t n)
725 master_send_led_bank();
730 LaunchControlXL::master_send_led_bank ()
732 if (device_mode()) { return; }
734 if (!(buttons_down.find(Device) != buttons_down.end())) {
737 int stripable_counter = LaunchControlXL::get_amount_of_tracks();
739 for (int n = 0; n < stripable_counter; ++n) {
740 boost::shared_ptr<TrackButton> b = control_button_by_column(n);
741 if (stripable[n] && stripable[n]->master_send_enable_controllable()) {
742 if (stripable[n]->master_send_enable_controllable()->get_value()) {
743 b->set_color(GreenFull);
749 write (b->state_msg());
752 LaunchControlXL::set_refresh_leds_flag(true);
758 LaunchControlXL::fader(uint8_t n)
764 boost::shared_ptr<Fader> fader;
765 IDFaderMap::iterator f = id_fader_map.find(static_cast<FaderID>(n));
767 if (f != id_fader_map.end()) {
775 boost::shared_ptr<AutomationControl> ac = stripable[fader->id()]->gain_control();
776 if (ac && check_pick_up(fader, ac)) {
777 ac->set_value ( ac->interface_to_internal( fader->value() / 127.0), PBD::Controllable::UseGroup );
782 LaunchControlXL::knob_sendA(uint8_t n)
788 boost::shared_ptr<Knob> knob;
789 IDKnobMap::iterator k = id_knob_map.find(static_cast<KnobID>(n));
791 if (k != id_knob_map.end()) {
799 boost::shared_ptr<AutomationControl> ac;
801 if (buttons_down.find(Device) != buttons_down.end()) { // Device button hold
802 ac = stripable[n]->trim_control();
804 ac = stripable[n]->send_level_controllable (send_bank_base());
807 if (ac && check_pick_up(knob, ac)) {
808 ac->set_value ( ac->interface_to_internal( knob->value() / 127.0), PBD::Controllable::UseGroup );
813 LaunchControlXL::knob_sendB(uint8_t n)
819 boost::shared_ptr<Knob> knob;
820 IDKnobMap::iterator k = id_knob_map.find(static_cast<KnobID>(n + 8));
822 if (k != id_knob_map.end()) {
830 boost::shared_ptr<AutomationControl> ac;
832 if (buttons_down.find(Device) != buttons_down.end()) { // Device button hold
834 ac = stripable[n]->filter_freq_controllable (true);
839 ac = stripable[n]->send_level_controllable (send_bank_base() + 1);
842 if (ac && check_pick_up(knob, ac)) {
843 ac->set_value ( ac->interface_to_internal( knob->value() / 127.0), PBD::Controllable::UseGroup );
848 LaunchControlXL::knob_pan(uint8_t n)
854 boost::shared_ptr<Knob> knob;
855 IDKnobMap::iterator k = id_knob_map.find(static_cast<KnobID>(n + 16));
857 if (k != id_knob_map.end()) {
865 boost::shared_ptr<AutomationControl> ac;
867 if (buttons_down.find(Device) != buttons_down.end()) { // Device button hold
869 ac = stripable[n]->filter_freq_controllable(true);
871 ac = stripable[n]->pan_width_control();
874 ac = stripable[n]->pan_azimuth_control();
878 if (ac && check_pick_up(knob, ac)) {
879 ac->set_value ( ac->interface_to_internal( knob->value() / 127.0), PBD::Controllable::UseGroup );
884 LaunchControlXL::button_track_focus(uint8_t n)
886 if (buttons_down.find(Device) != buttons_down.end()) {
887 DEBUG_TRACE (DEBUG::LaunchControlXL, "DEVICE BUTTON HOLD\n");
888 if (stripable[n]->solo_isolate_control()) {
889 bool solo_isolate_active = stripable[n]->solo_isolate_control()->get_value();
890 stripable[n]->solo_isolate_control()->set_value (!solo_isolate_active, PBD::Controllable::UseGroup);
896 if ( stripable[n]->is_selected() ) {
897 ControlProtocol::RemoveStripableFromSelection (stripable[n]);
899 ControlProtocol::AddStripableToSelection (stripable[n]);
907 LaunchControlXL::button_press_track_control(uint8_t n) {
912 if (buttons_down.find(Device) != buttons_down.end()) {
913 DEBUG_TRACE (DEBUG::LaunchControlXL, "DEVICE BUTTON HOLD\n");
915 if (stripable[n]->master_send_enable_controllable()) {
916 bool master_send_active = stripable[n]->master_send_enable_controllable()->get_value();
918 DEBUG_TRACE (DEBUG::LaunchControlXL, "MIXBUS Master Assign\n");
919 stripable[n]->master_send_enable_controllable()->set_value (!master_send_active, PBD::Controllable::UseGroup);
923 /* something useful for Ardour */
928 boost::shared_ptr<AutomationControl> ac = get_ac_by_state(n);
931 session->set_control (ac, !ac->get_value(), PBD::Controllable::UseGroup);
936 LaunchControlXL::button_track_mode(TrackMode state)
938 set_track_mode(state);
939 for (uint8_t n = 0; n < 8; ++n) {
940 update_track_control_led(n);
943 boost::shared_ptr<TrackStateButton> mute = boost::dynamic_pointer_cast<TrackStateButton> (id_note_button_map[Mute]);
944 boost::shared_ptr<TrackStateButton> solo = boost::dynamic_pointer_cast<TrackStateButton> (id_note_button_map[Solo]);
945 boost::shared_ptr<TrackStateButton> record = boost::dynamic_pointer_cast<TrackStateButton> (id_note_button_map[Record]);
947 if (mute && solo && record) {
948 write(mute->state_msg((state == TrackMute)));
949 write(solo->state_msg((state == TrackSolo)));
950 write(record->state_msg((state == TrackRecord)));
955 LaunchControlXL::button_select_left()
957 switch_bank (max (0, bank_start - (7 + (fader8master() ? 0 : 1))));
961 LaunchControlXL::button_select_right()
963 switch_bank (max (0, bank_start + 7 + (fader8master() ? 0 : 1)));
967 LaunchControlXL::send_bank_switch(bool down) {
968 DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose ("send_bank_switch - down: %1\n", down));
977 LaunchControlXL::button_device()
980 return; // currently device mode only on Mixbus
982 LaunchControlXL::set_device_mode(!device_mode());
986 LaunchControlXL::button_device_long_press()
988 if (device_mode()) { return ; }
992 master_send_led_bank();
997 LaunchControlXL::button_mute()
999 if (buttons_down.find(Device) != buttons_down.end()) {
1000 access_action ("Editor/track-mute-toggle");
1002 button_track_mode(TrackMute);
1007 LaunchControlXL::button_mute_long_press()
1009 session->cancel_all_mute();
1013 LaunchControlXL::button_solo()
1015 if (buttons_down.find(Device) != buttons_down.end()) {
1016 access_action ("Editor/track-solo-toggle");
1018 button_track_mode(TrackSolo);
1023 LaunchControlXL::button_solo_long_press()
1029 LaunchControlXL::button_record()
1031 if (buttons_down.find(Device) != buttons_down.end()) {
1032 access_action ("Editor/track-record-enable-toggle");
1034 button_track_mode(TrackRecord);
1039 LaunchControlXL::button_long_press_timeout (ButtonID id, boost::shared_ptr<Button> button)
1041 if (buttons_down.find (id) != buttons_down.end()) {
1042 DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose ("long press timeout for %1, invoking method\n", id));
1043 (button->long_press_method) ();
1045 DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose ("long press timeout for %1, expired/cancelled\n", id));
1046 /* release happened and somehow we were not cancelled */
1049 /* whichever button this was, we've used it ... don't invoke the
1052 consumed.insert (id);
1054 return false; /* don't get called again */
1059 LaunchControlXL::start_press_timeout (boost::shared_ptr<Button> button, ButtonID id)
1061 ButtonID no_timeout_buttons[] = { SelectUp, SelectDown, SelectLeft, SelectRight };
1063 for (size_t n = 0; n < sizeof (no_timeout_buttons) / sizeof (no_timeout_buttons[0]); ++n) {
1064 if (id == no_timeout_buttons[n]) {
1065 DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose ("Not using timeout for button id %1\n", id));
1070 Glib::RefPtr<Glib::TimeoutSource> timeout = Glib::TimeoutSource::create (500); // milliseconds
1071 button->timeout_connection = timeout->connect (sigc::bind (sigc::mem_fun (*this, &LaunchControlXL::button_long_press_timeout), id, button));
1072 timeout->attach (main_loop()->get_context());
1076 /* Device Mode functions */
1079 LaunchControlXL::dm_select_prev_strip()
1081 access_action ("Editor/select-prev-stripable");
1085 LaunchControlXL::dm_select_next_strip()
1087 access_action ("Editor/select-next-stripable");
1091 LaunchControlXL::dm_check_dummy (DeviceStatus ds)
1097 LaunchControlXL::dm_fader (FaderID id) {
1099 if (!first_selected_stripable()) {
1103 boost::shared_ptr<AutomationControl> ac;
1104 boost::shared_ptr<Fader> fader;
1106 IDFaderMap::iterator f = id_fader_map.find(id);
1108 if (f != id_fader_map.end()) {
1112 ac = first_selected_stripable()->gain_control();
1113 if (ac && check_pick_up(fader, ac)) {
1114 ac->set_value ( ac->interface_to_internal( fader->value() / 127.0), PBD::Controllable::UseGroup );
1119 LaunchControlXL::dm_check_pan_azi()
1121 if (!first_selected_stripable()) {
1122 return dev_nonexistant;
1125 uint8_t dev_status = dev_nonexistant;
1126 if (first_selected_stripable()->pan_azimuth_control()) {
1127 dev_status = dev_active;
1134 LaunchControlXL::dm_pan_azi (KnobID k)
1136 if (!first_selected_stripable()) {
1140 boost::shared_ptr<AutomationControl> ac;
1141 boost::shared_ptr<Knob> knob = knob_by_id (k);
1143 ac = first_selected_stripable()->pan_azimuth_control();
1145 if (ac && check_pick_up(knob, ac)) {
1146 ac->set_value ( ac->interface_to_internal( knob->value() / 127.0), PBD::Controllable::UseGroup );
1152 LaunchControlXL::dm_check_pan_width()
1154 if (!first_selected_stripable()) {
1155 return dev_nonexistant;
1158 uint8_t dev_status = dev_nonexistant;
1159 if (first_selected_stripable()->pan_width_control()) {
1160 dev_status = dev_active;
1167 LaunchControlXL::dm_pan_width (KnobID k)
1169 if (!first_selected_stripable()) {
1173 DEBUG_TRACE (DEBUG::LaunchControlXL, "dm_pan_width()\n");
1174 boost::shared_ptr<AutomationControl> ac;
1175 boost::shared_ptr<Knob> knob = knob_by_id (k);
1177 ac = first_selected_stripable()->pan_width_control();
1179 if (ac && check_pick_up(knob, ac)) {
1180 ac->set_value ( ac->interface_to_internal( knob->value() / 127.0), PBD::Controllable::UseGroup );
1185 LaunchControlXL::dm_check_trim()
1187 if (!first_selected_stripable()) {
1188 return dev_nonexistant;
1191 uint8_t dev_status = dev_nonexistant;
1192 if (first_selected_stripable()->trim_control()) {
1193 dev_status = dev_active;
1200 LaunchControlXL::dm_trim (KnobID k)
1202 if (!first_selected_stripable()) {
1206 boost::shared_ptr<AutomationControl> ac;
1207 boost::shared_ptr<Knob> knob = knob_by_id (k);
1209 ac = first_selected_stripable()->trim_control();
1211 if (ac && check_pick_up(knob, ac)) {
1212 ac->set_value ( ac->interface_to_internal( knob->value() / 127.0), PBD::Controllable::UseGroup );
1217 LaunchControlXL::dm_mute_enabled()
1219 if (!first_selected_stripable()) {
1220 return dev_nonexistant;
1223 uint8_t dev_status = dev_nonexistant;
1224 if (first_selected_stripable()->mute_control()->get_value()) {
1225 dev_status = dev_active;
1227 dev_status = dev_inactive;
1234 LaunchControlXL::dm_mute_switch()
1236 if (!first_selected_stripable()) {
1240 if (first_selected_stripable()->mute_control()) {
1241 first_selected_stripable()->mute_control()->set_value(!first_selected_stripable()->mute_control()->get_value(), PBD::Controllable::NoGroup);
1246 LaunchControlXL::dm_solo_enabled()
1248 if (!first_selected_stripable() || first_selected_stripable()->is_master()) {
1249 return dev_nonexistant;
1252 uint8_t dev_status = dev_nonexistant;
1253 if (first_selected_stripable()->solo_control()) {
1254 if (first_selected_stripable()->solo_control()->get_value()) {
1255 dev_status = dev_active;
1257 dev_status = dev_inactive;
1265 LaunchControlXL::dm_solo_switch()
1267 if (!first_selected_stripable()) {
1271 if (first_selected_stripable()->solo_control()) {
1272 first_selected_stripable()->solo_control()->set_value(!first_selected_stripable()->solo_control()->get_value(), PBD::Controllable::NoGroup);
1277 LaunchControlXL::dm_recenable_enabled()
1279 if (!first_selected_stripable()) {
1280 return dev_nonexistant;
1283 uint8_t dev_status = dev_nonexistant;
1284 if (first_selected_stripable()->rec_enable_control()) {
1285 if (first_selected_stripable()->rec_enable_control()->get_value()) {
1286 dev_status = dev_active;
1288 dev_status = dev_inactive;
1296 LaunchControlXL::dm_recenable_switch()
1298 if (!first_selected_stripable()) {
1302 if (first_selected_stripable()->rec_enable_control()) {
1303 first_selected_stripable()->rec_enable_control()->set_value(!first_selected_stripable()->rec_enable_control()->get_value(), PBD::Controllable::NoGroup);
1310 LaunchControlXL::dm_mb_eq_freq_enabled()
1312 if (!first_selected_stripable()) {
1313 return dev_nonexistant;
1316 uint8_t dev_status = dev_nonexistant;
1318 if (first_selected_stripable()->eq_enable_controllable()) {
1319 if (first_selected_stripable()->eq_enable_controllable()->get_value()) {
1320 dev_status = dev_active;
1322 dev_status = dev_inactive;
1326 if (first_selected_stripable()->mixbus() || first_selected_stripable()->is_master()) {
1327 dev_status = dev_nonexistant;
1335 LaunchControlXL::dm_mb_eq_gain_enabled(uint8_t band)
1337 if (!first_selected_stripable()) {
1338 return dev_nonexistant;
1341 uint8_t dev_status = dev_nonexistant;
1343 if (first_selected_stripable()->eq_enable_controllable()) {
1344 if (first_selected_stripable()->eq_enable_controllable()->get_value()) {
1345 dev_status = dev_active;
1347 dev_status = dev_inactive;
1351 if (first_selected_stripable()->mixbus() && band > 3) {
1352 dev_status = dev_nonexistant;
1359 LaunchControlXL::dm_mb_eq (KnobID k, bool gain, uint8_t band)
1361 if (!first_selected_stripable()) {
1365 boost::shared_ptr<AutomationControl> ac;
1366 boost::shared_ptr<Knob> knob = knob_by_id (k);
1368 ac = first_selected_stripable()->eq_gain_controllable(band);
1370 ac = first_selected_stripable()->eq_freq_controllable(band);
1373 if (ac && check_pick_up(knob, ac)) {
1374 ac->set_value ( ac->interface_to_internal( knob->value() / 127.0), PBD::Controllable::UseGroup );
1379 LaunchControlXL::dm_mb_eq_shape_switch (uint8_t band)
1381 if (!first_selected_stripable()) {
1385 if (first_selected_stripable()->eq_shape_controllable(band)) {
1386 first_selected_stripable()->eq_shape_controllable(band)->set_value
1387 (!first_selected_stripable()->eq_shape_controllable(band)->get_value(), PBD::Controllable::NoGroup );
1393 LaunchControlXL::dm_mb_eq_shape_enabled(uint8_t band)
1395 if (!first_selected_stripable()) {
1396 return dev_nonexistant;
1399 uint8_t dev_status = dev_nonexistant;
1401 if (first_selected_stripable()->eq_shape_controllable(band)) {
1402 if (first_selected_stripable()->eq_shape_controllable(band)->get_value()) {
1403 dev_status = dev_active;
1405 dev_status = dev_inactive;
1414 LaunchControlXL::dm_mb_eq_switch()
1416 if (!first_selected_stripable()) {
1420 if (first_selected_stripable()->eq_enable_controllable()) {
1421 first_selected_stripable()->eq_enable_controllable()->set_value
1422 (!first_selected_stripable()->eq_enable_controllable()->get_value(), PBD::Controllable::NoGroup );
1427 LaunchControlXL::dm_mb_flt_enabled()
1429 if (!first_selected_stripable()) {
1430 return dev_nonexistant;
1433 DEBUG_TRACE (DEBUG::LaunchControlXL, "dm_mb_flt_enabled()\n");
1434 uint8_t dev_status = dev_nonexistant;
1436 if (first_selected_stripable()->filter_enable_controllable(true)) {
1437 DEBUG_TRACE (DEBUG::LaunchControlXL, "dm_mb_flt_enabled() - filter exists\n");
1438 if (first_selected_stripable()->filter_enable_controllable(true)->get_value()) {
1439 DEBUG_TRACE (DEBUG::LaunchControlXL, "dm_mb_flt_enabled: get_value true\n");
1440 dev_status = dev_active;
1442 dev_status = dev_inactive;
1445 DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose("dm_mb_flt_enabled: dev_status: %1\n", (int)dev_status));
1451 LaunchControlXL::dm_mb_flt_switch()
1453 if (!first_selected_stripable()) {
1457 if (first_selected_stripable()->filter_enable_controllable(true)) {
1458 first_selected_stripable()->filter_enable_controllable(true)->set_value
1459 (!first_selected_stripable()->filter_enable_controllable(true)->get_value(), PBD::Controllable::NoGroup );
1466 LaunchControlXL::dm_mb_flt_frq (KnobID k, bool hpf)
1468 if (!first_selected_stripable()) {
1472 boost::shared_ptr<AutomationControl> ac;
1473 boost::shared_ptr<Knob> knob = knob_by_id (k);
1475 ac = first_selected_stripable()->filter_freq_controllable(true);
1477 ac = first_selected_stripable()->filter_freq_controllable(false);
1480 if (ac && check_pick_up(knob, ac)) {
1481 ac->set_value ( ac->interface_to_internal( knob->value() / 127.0), PBD::Controllable::UseGroup );
1486 LaunchControlXL::dm_mb_check_send_knob (KnobID k)
1488 if (!first_selected_stripable()) {
1489 return dev_nonexistant;
1492 uint8_t send = static_cast<uint8_t> (k) - 16 + 4 * send_bank_base();
1494 uint8_t dev_status = dev_nonexistant;
1496 if (first_selected_stripable()->send_enable_controllable(send)) {
1497 dev_status = dev_inactive;
1498 if (first_selected_stripable()->send_enable_controllable(send)->get_value()) {
1499 dev_status = dev_active;
1507 LaunchControlXL::dm_mb_check_send_button (uint8_t s)
1509 if (!first_selected_stripable()) {
1510 return dev_nonexistant;
1514 uint8_t send = s + 4 * send_bank_base();
1516 uint8_t dev_status = dev_nonexistant;
1518 if (first_selected_stripable()->send_enable_controllable(send)) {
1519 dev_status = dev_inactive;
1520 if (first_selected_stripable()->send_enable_controllable(send)->get_value()) {
1521 dev_status = dev_active;
1531 LaunchControlXL::dm_mb_sends (KnobID k)
1533 if (!first_selected_stripable()) {
1537 boost::shared_ptr<AutomationControl> ac;
1538 boost::shared_ptr<Knob> knob = knob_by_id (k);
1540 uint8_t send = static_cast<uint8_t> (k) - 16 + 4 * send_bank_base();
1541 DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose("dm_mb_send: knobid '%1'\n", k));
1542 DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose("dm_mb_send: send '%1'\n", (int)send));
1545 if (buttons_down.find(Device) != buttons_down.end()) { // Device button hold
1546 ac = first_selected_stripable()->send_pan_azi_controllable(send);
1548 ac = first_selected_stripable()->send_level_controllable(send);
1551 if (ac && check_pick_up(knob, ac)) {
1552 ac->set_value ( ac->interface_to_internal( knob->value() / 127.0), PBD::Controllable::UseGroup );
1557 LaunchControlXL::dm_mb_comp_enabled()
1559 if (!first_selected_stripable()) {
1560 return dev_nonexistant;
1563 uint8_t dev_status = dev_nonexistant;
1564 if (first_selected_stripable()->comp_enable_controllable()) {
1565 if (first_selected_stripable()->comp_enable_controllable()->get_value()) {
1566 dev_status = dev_active;
1568 dev_status = dev_inactive;
1576 LaunchControlXL::dm_mb_comp_switch()
1578 DEBUG_TRACE (DEBUG::LaunchControlXL, "dm_mb_comp_siwtch() \n");
1579 if (!first_selected_stripable()) {
1583 if (first_selected_stripable()->comp_enable_controllable()) {
1584 DEBUG_TRACE (DEBUG::LaunchControlXL, "comp_enable_controllable exists\n");
1585 DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose("comp_enable_controllable(): '%1'\n", first_selected_stripable()->comp_enable_controllable()->get_value() ));
1586 first_selected_stripable()->comp_enable_controllable()->set_value
1587 (!first_selected_stripable()->comp_enable_controllable()->get_value(), PBD::Controllable::NoGroup);
1593 LaunchControlXL::dm_mb_comp (KnobID k, CompParam c)
1595 if (!first_selected_stripable()) {
1599 boost::shared_ptr<AutomationControl> ac;
1600 boost::shared_ptr<Knob> knob = knob_by_id (k);
1604 ac = first_selected_stripable()->comp_makeup_controllable();
1607 ac = first_selected_stripable()->comp_mode_controllable();
1610 ac = first_selected_stripable()->comp_speed_controllable();
1614 if (ac && check_pick_up(knob, ac)) {
1615 ac->set_value ( ac->interface_to_internal( knob->value() / 127.0), PBD::Controllable::UseGroup );
1620 LaunchControlXL::dm_mb_comp_thresh (FaderID id) {
1622 if (!first_selected_stripable()) {
1626 boost::shared_ptr<AutomationControl> ac;
1627 boost::shared_ptr<Fader> fader;
1629 IDFaderMap::iterator f = id_fader_map.find(id);
1631 if (f != id_fader_map.end()) {
1635 ac = first_selected_stripable()->comp_threshold_controllable();
1636 if (ac && check_pick_up(fader, ac)) {
1637 ac->set_value ( ac->interface_to_internal( fader->value() / 127.0), PBD::Controllable::UseGroup );
1642 LaunchControlXL::dm_mb_has_tapedrive()
1644 if (!first_selected_stripable()) {
1645 return dev_nonexistant;
1648 uint8_t dev_status = dev_nonexistant;
1650 if (first_selected_stripable()->mixbus() || first_selected_stripable()->is_master()) {
1651 dev_status = dev_active;
1658 LaunchControlXL::dm_mb_tapedrive (KnobID k)
1660 if (!first_selected_stripable()) {
1664 boost::shared_ptr<AutomationControl> ac;
1665 boost::shared_ptr<Knob> knob = knob_by_id (k);
1667 ac = first_selected_stripable()->tape_drive_controllable();
1669 if (ac && check_pick_up(knob, ac)) {
1670 ac->set_value ( ac->interface_to_internal( knob->value() / 127.0), PBD::Controllable::UseGroup );
1675 LaunchControlXL::dm_mb_master_assign_enabled()
1677 if (!first_selected_stripable()) {
1678 return dev_nonexistant;
1681 uint8_t dev_status = dev_nonexistant;
1683 if (first_selected_stripable()->master_send_enable_controllable()) {
1684 if (first_selected_stripable()->master_send_enable_controllable()->get_value()) {
1685 dev_status = dev_active;
1687 dev_status = dev_inactive;
1695 LaunchControlXL::dm_mb_master_assign_switch()
1697 if (!first_selected_stripable()) {
1701 if (first_selected_stripable()->master_send_enable_controllable()) {
1702 first_selected_stripable()->master_send_enable_controllable()->set_value
1703 (!first_selected_stripable()->master_send_enable_controllable()->get_value(), PBD::Controllable::NoGroup );
1708 LaunchControlXL::dm_mb_send_switch(ButtonID id)
1710 if (!first_selected_stripable()) {
1714 boost::shared_ptr<Button> button = id_note_button_map[id];;
1716 uint8_t send = static_cast<uint8_t> (id) + 4 * send_bank_base();
1717 DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose("dm_mb_send: buttonid '%1'\n", (int)id));
1718 DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose("dm_mb_send: send '%1'\n", (int)send));
1720 if (first_selected_stripable()->send_enable_controllable(send)) {
1721 DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose("dm_mb_send: send '%1' exists\n", (int)send));
1722 first_selected_stripable()->send_enable_controllable(send)->set_value
1723 (!first_selected_stripable()->send_enable_controllable(send)->get_value(), PBD::Controllable::UseGroup);