2 Copyright (C) 2009 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 "boost/lambda/lambda.hpp"
23 #include "ardour/session.h"
24 #include "ardour/track.h"
25 #include "ardour/monitor_control.h"
26 #include "ardour/dB.h"
27 #include "ardour/meter.h"
28 #include "ardour/phase_control.h"
29 #include "ardour/solo_isolate_control.h"
30 #include "ardour/solo_safe_control.h"
31 #include "ardour/route.h"
32 #include "ardour/send.h"
33 #include "ardour/processor.h"
34 #include "ardour/readonly_control.h"
37 #include "osc_select_observer.h"
45 using namespace ARDOUR;
46 using namespace ArdourSurface;
48 OSCSelectObserver::OSCSelectObserver (boost::shared_ptr<Stripable> s, lo_address a, uint32_t gm, std::bitset<32> fb)
55 addr = lo_address_new (lo_address_get_hostname(a) , lo_address_get_port(a));
58 if (feedback[0]) { // buttons are separate feedback
59 _strip->PropertyChanged.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::name_changed, this, boost::lambda::_1), OSC::instance());
60 name_changed (ARDOUR::Properties::name);
62 _strip->mute_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/mute"), _strip->mute_control()), OSC::instance());
63 change_message ("/select/mute", _strip->mute_control());
65 _strip->solo_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/solo"), _strip->solo_control()), OSC::instance());
66 change_message ("/select/solo", _strip->solo_control());
68 if (_strip->solo_isolate_control()) {
69 _strip->solo_isolate_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/solo_iso"), _strip->solo_isolate_control()), OSC::instance());
70 change_message ("/select/solo_iso", _strip->solo_isolate_control());
73 if (_strip->solo_safe_control()) {
74 _strip->solo_safe_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/solo_safe"), _strip->solo_safe_control()), OSC::instance());
75 change_message ("/select/solo_safe", _strip->solo_safe_control());
78 boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track> (_strip);
80 track->monitoring_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::monitor_status, this, track->monitoring_control()), OSC::instance());
81 monitor_status (track->monitoring_control());
84 boost::shared_ptr<AutomationControl> rec_controllable = _strip->rec_enable_control ();
85 if (rec_controllable) {
86 rec_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/recenable"), _strip->rec_enable_control()), OSC::instance());
87 change_message ("/select/recenable", _strip->rec_enable_control());
90 boost::shared_ptr<AutomationControl> recsafe_controllable = _strip->rec_safe_control ();
91 if (recsafe_controllable) {
92 recsafe_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/record_safe"), _strip->rec_safe_control()), OSC::instance());
93 change_message ("/select/record_safe", _strip->rec_safe_control());
96 boost::shared_ptr<AutomationControl> phase_controllable = _strip->phase_control ();
97 if (phase_controllable) {
98 phase_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/polarity"), _strip->phase_control()), OSC::instance());
99 change_message ("/select/polarity", _strip->phase_control());
104 if (feedback[1]) { // level controls
105 _strip->gain_control()->alist()->automation_state_changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_automation, this), OSC::instance());
106 _strip->gain_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_message, this), OSC::instance());
109 boost::shared_ptr<Controllable> trim_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->trim_control());
110 if (trim_controllable) {
111 trim_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::trim_message, this, X_("/select/trimdB"), _strip->trim_control()), OSC::instance());
112 trim_message ("/select/trimdB", _strip->trim_control());
115 boost::shared_ptr<Controllable> pan_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->pan_azimuth_control());
116 if (pan_controllable) {
117 pan_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/pan_stereo_position"), _strip->pan_azimuth_control()), OSC::instance());
118 change_message ("/select/pan_stereo_position", _strip->pan_azimuth_control());
121 boost::shared_ptr<Controllable> width_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->pan_width_control());
122 if (width_controllable) {
123 width_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/pan_stereo_width"), _strip->pan_width_control()), OSC::instance());
124 change_message ("/select/pan_stereo_width", _strip->pan_width_control());
128 if (feedback[13]) { // Well known controls
129 // Rest of possible pan controls... Untested because I can't find a way to get them in the GUI :)
130 if (_strip->pan_elevation_control ()) {
131 _strip->pan_elevation_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/pan_elevation_position"), _strip->pan_elevation_control()), OSC::instance());
132 change_message ("/select/pan_elevation_position", _strip->pan_elevation_control());
134 if (_strip->pan_frontback_control ()) {
135 _strip->pan_frontback_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/pan_frontback_position"), _strip->pan_frontback_control()), OSC::instance());
136 change_message ("/select/pan_frontback_position", _strip->pan_frontback_control());
138 if (_strip->pan_lfe_control ()) {
139 _strip->pan_lfe_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/pan_lfe_control"), _strip->pan_lfe_control()), OSC::instance());
140 change_message ("/select/pan_lfe_control", _strip->pan_lfe_control());
144 // detecting processor changes requires cast to route
145 boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route>(_strip);
147 r->processors_changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::send_restart, this, -1), OSC::instance());
153 if (_strip->comp_enable_controllable ()) {
154 _strip->comp_enable_controllable ()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::enable_message, this, X_("/select/comp_enable"), _strip->comp_enable_controllable()), OSC::instance());
155 enable_message ("/select/comp_enable", _strip->comp_enable_controllable());
157 if (_strip->comp_threshold_controllable ()) {
158 _strip->comp_threshold_controllable ()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/comp_threshold"), _strip->comp_threshold_controllable()), OSC::instance());
159 change_message ("/select/comp_threshold", _strip->comp_threshold_controllable());
161 if (_strip->comp_speed_controllable ()) {
162 _strip->comp_speed_controllable ()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/comp_speed"), _strip->comp_speed_controllable()), OSC::instance());
163 change_message ("/select/comp_speed", _strip->comp_speed_controllable());
165 if (_strip->comp_mode_controllable ()) {
166 _strip->comp_mode_controllable ()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::comp_mode, this), OSC::instance());
169 if (_strip->comp_makeup_controllable ()) {
170 _strip->comp_makeup_controllable ()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/comp_makeup"), _strip->comp_makeup_controllable()), OSC::instance());
171 change_message ("/select/comp_makeup", _strip->comp_makeup_controllable());
179 OSCSelectObserver::~OSCSelectObserver ()
181 strip_connections.drop_connections ();
182 // all strip buttons should be off and faders 0 and etc.
183 if (feedback[0]) { // buttons are separate feedback
184 send_float ("/select/expand", 0);
185 text_message ("/select/name", " ");
186 text_message ("/select/comment", " ");
187 send_float ("/select/mute", 0);
188 send_float ("/select/solo", 0);
189 send_float ("/select/recenable", 0);
190 send_float ("/select/record_safe", 0);
191 send_float ("/select/monitor_input", 0);
192 send_float ("/select/monitor_disk", 0);
193 send_float ("/select/polarity", 0);
194 send_float ("/select/n_inputs", 0);
195 send_float ("/select/n_outputs", 0);
197 if (feedback[1]) { // level controls
199 send_float ("/select/fader", 0);
201 send_float ("/select/gain", -193);
203 send_float ("/select/trimdB", 0);
204 send_float ("/select/pan_stereo_position", 0.5);
205 send_float ("/select/pan_stereo_width", 1);
208 send_float ("/select/signal", 0);
212 send_float ("/select/meter", 0);
214 send_float ("/select/meter", -193);
216 }else if (feedback[8]) {
217 send_float ("/select/meter", 0);
219 if (feedback[13]) { // Well known controls
220 send_float ("/select/pan_elevation_position", 0);
221 send_float ("/select/pan_frontback_position", .5);
222 send_float ("/select/pan_lfe_control", 0);
223 send_float ("/select/comp_enable", 0);
224 send_float ("/select/comp_threshold", 0);
225 send_float ("/select/comp_speed", 0);
226 send_float ("/select/comp_mode", 0);
227 text_message ("/select/comp_mode_name", " ");
228 text_message ("/select/comp_speed_name", " ");
229 send_float ("/select/comp_makeup", 0);
234 lo_address_free (addr);
238 OSCSelectObserver::send_init()
240 // we don't know how many there are, so find out.
244 if (_strip->send_level_controllable (nsends)) {
245 _strip->send_level_controllable(nsends)->Changed.connect (send_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::send_gain, this, nsends, _strip->send_level_controllable(nsends)), OSC::instance());
246 send_timeout.push_back (0);
247 send_gain (nsends, _strip->send_level_controllable(nsends));
251 if (_strip->send_enable_controllable (nsends)) {
252 _strip->send_enable_controllable(nsends)->Changed.connect (send_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::enable_message_with_id, this, X_("/select/send_enable"), nsends + 1, _strip->send_enable_controllable(nsends)), OSC::instance());
253 enable_message_with_id ("/select/send_enable", nsends + 1, _strip->send_enable_controllable(nsends));
256 boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route> (_strip);
258 // should never get here
259 send_float_with_id ("/select/send_enable", nsends + 1, 0);
261 boost::shared_ptr<Send> snd = boost::dynamic_pointer_cast<Send> (r->nth_send(nsends));
263 boost::shared_ptr<Processor> proc = boost::dynamic_pointer_cast<Processor> (snd);
264 proc->ActiveChanged.connect (send_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::send_enable, this, X_("/select/send_enable"), nsends + 1, proc), OSC::instance());
265 send_float_with_id ("/select/send_enable", nsends + 1, proc->enabled());
268 // this should get signalled by the route the send goes to, (TODO)
269 if (!gainmode && sends) { // if the gain control is there, this is too
270 text_with_id ("/select/send_name", nsends + 1, _strip->send_name(nsends));
272 // Send numbers are 0 based, OSC is 1 based so this gets incremented at the end
280 OSCSelectObserver::send_end ()
282 send_connections.drop_connections ();
283 for (uint32_t i = 1; i <= nsends; i++) {
285 send_float_with_id ("/select/send_fader", i, 0);
287 send_float_with_id ("/select/send_gain", i, -193);
290 send_float_with_id ("/select/send_enable", i, 0);
292 text_with_id ("/select/send_name", i, " ");
298 OSCSelectObserver::send_restart(int x)
305 OSCSelectObserver::tick ()
307 if (feedback[7] || feedback[8] || feedback[9]) { // meters enabled
309 if (_strip->peak_meter()) {
310 now_meter = _strip->peak_meter()->meter_level(0, MeterMCP);
314 if (now_meter < -144) now_meter = -193;
315 if (_last_meter != now_meter) {
316 if (feedback[7] || feedback[8]) {
317 string path = "/select/meter";
318 lo_message msg = lo_message_new ();
319 if (gainmode && feedback[7]) {
320 lo_message_add_float (msg, ((now_meter + 94) / 100));
321 lo_send_message (addr, path.c_str(), msg);
322 } else if ((!gainmode) && feedback[7]) {
323 lo_message_add_float (msg, now_meter);
324 lo_send_message (addr, path.c_str(), msg);
325 } else if (feedback[8]) {
326 uint32_t ledlvl = (uint32_t)(((now_meter + 54) / 3.75)-1);
327 uint16_t ledbits = ~(0xfff<<ledlvl);
328 lo_message_add_int32 (msg, ledbits);
329 lo_send_message (addr, path.c_str(), msg);
331 lo_message_free (msg);
334 string path = "/select/signal";
335 lo_message msg = lo_message_new ();
337 if (now_meter < -40) {
342 lo_message_add_float (msg, signal);
343 lo_send_message (addr, path.c_str(), msg);
344 lo_message_free (msg);
347 _last_meter = now_meter;
352 if (gain_timeout == 1) {
353 text_message ("/select/name", _strip->name());
358 if (as == ARDOUR::Play || as == ARDOUR::Touch) {
359 if(_last_gain != _strip->gain_control()->get_value()) {
360 _last_gain = _strip->gain_control()->get_value();
366 if (_strip->comp_enable_controllable()->get_value()) {
367 send_float ("/select/comp_redux", (float) _strip->comp_redux_controllable()->get_parameter ());
369 for (uint32_t i = 0; i < send_timeout.size(); i++) {
370 if (send_timeout[i]) {
371 if (send_timeout[i] == 1) {
372 text_with_id ("/select/send_name", i + 1, _strip->send_name(i));
382 OSCSelectObserver::name_changed (const PBD::PropertyChange& what_changed)
384 if (!what_changed.contains (ARDOUR::Properties::name)) {
392 text_message ("/select/name", _strip->name());
393 boost::shared_ptr<Route> route = boost::dynamic_pointer_cast<Route> (_strip);
395 //spit out the comment at the same time
396 text_message ("/select/comment", route->comment());
397 // lets tell the surface how many inputs this strip has
398 send_float ("/select/n_inputs", (float) route->n_inputs().n_total());
399 // lets tell the surface how many outputs this strip has
400 send_float ("/select/n_outputs", (float) route->n_outputs().n_total());
405 OSCSelectObserver::change_message (string path, boost::shared_ptr<Controllable> controllable)
407 lo_message msg = lo_message_new ();
408 float val = controllable->get_value();
410 lo_message_add_float (msg, (float) controllable->internal_to_interface (val));
412 lo_send_message (addr, path.c_str(), msg);
413 lo_message_free (msg);
417 OSCSelectObserver::enable_message (string path, boost::shared_ptr<Controllable> controllable)
419 float val = controllable->get_value();
421 send_float (path, 1);
423 send_float (path, 0);
429 OSCSelectObserver::change_message_with_id (string path, uint32_t id, boost::shared_ptr<Controllable> controllable)
431 lo_message msg = lo_message_new ();
432 float val = controllable->get_value();
434 path = set_path (path, id);
436 lo_message_add_int32 (msg, id);
439 lo_message_add_float (msg, (float) controllable->internal_to_interface (val));
441 lo_send_message (addr, path.c_str(), msg);
442 lo_message_free (msg);
446 OSCSelectObserver::enable_message_with_id (string path, uint32_t id, boost::shared_ptr<Controllable> controllable)
448 float val = controllable->get_value();
450 send_float_with_id (path, id, 1);
452 send_float_with_id (path, id, 0);
457 OSCSelectObserver::text_message (string path, std::string text)
459 lo_message msg = lo_message_new ();
461 lo_message_add_string (msg, text.c_str());
463 lo_send_message (addr, path.c_str(), msg);
464 lo_message_free (msg);
468 OSCSelectObserver::monitor_status (boost::shared_ptr<Controllable> controllable)
471 float val = controllable->get_value();
486 send_float ("/select/monitor_input", (float) input);
487 send_float ("/select/monitor_disk", (float) disk);
491 OSCSelectObserver::trim_message (string path, boost::shared_ptr<Controllable> controllable)
493 lo_message msg = lo_message_new ();
495 lo_message_add_float (msg, (float) accurate_coefficient_to_dB (controllable->get_value()));
497 lo_send_message (addr, path.c_str(), msg);
498 lo_message_free (msg);
502 OSCSelectObserver::gain_message ()
504 float value = _strip->gain_control()->get_value();
507 text_message ("/select/name", string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (value)));
509 send_float ("/select/fader", gain_to_slider_position (value));
512 send_float ("/select/gain", -200);
514 send_float ("/select/gain", accurate_coefficient_to_dB (value));
520 OSCSelectObserver::gain_automation ()
523 as = _strip->gain_control()->alist()->automation_state();
528 auto_name = "Manual";
547 send_float ("/select/fader/automation", output);
548 text_message ("/select/fader/automation_name", auto_name);
550 send_float ("/select/gain/automation", output);
551 text_message ("/select/gain/automation_name", auto_name);
558 OSCSelectObserver::send_gain (uint32_t id, boost::shared_ptr<PBD::Controllable> controllable)
560 lo_message msg = lo_message_new ();
565 db = controllable->get_value();
567 if (controllable->get_value() < 1e-15) {
570 db = accurate_coefficient_to_dB (controllable->get_value());
575 path = "/select/send_fader";
577 value = controllable->internal_to_interface (controllable->get_value());
579 value = gain_to_slider_position (controllable->get_value());
581 text_with_id ("/select/send_name" , id + 1, string_compose ("%1%2%3", std::fixed, std::setprecision(2), db));
582 if (send_timeout.size() > id) {
583 send_timeout[id] = 8;
586 path = "/select/send_gain";
591 path = set_path (path, id + 1);
593 lo_message_add_int32 (msg, id + 1);
596 lo_message_add_float (msg, value);
597 lo_send_message (addr, path.c_str(), msg);
598 lo_message_free (msg);
602 OSCSelectObserver::send_enable (string path, uint32_t id, boost::shared_ptr<Processor> proc)
604 // with no delay value is wrong
607 send_float_with_id ("/select/send_enable", id, proc->enabled());
611 OSCSelectObserver::text_with_id (string path, uint32_t id, string name)
613 lo_message msg = lo_message_new ();
615 path = set_path (path, id);
617 lo_message_add_int32 (msg, id);
620 lo_message_add_string (msg, name.c_str());
622 lo_send_message (addr, path.c_str(), msg);
623 lo_message_free (msg);
627 OSCSelectObserver::comp_mode ()
629 change_message ("/select/comp_mode", _strip->comp_mode_controllable());
630 text_message ("/select/comp_mode_name", _strip->comp_mode_name(_strip->comp_mode_controllable()->get_value()));
631 text_message ("/select/comp_speed_name", _strip->comp_speed_name(_strip->comp_mode_controllable()->get_value()));
635 OSCSelectObserver::eq_init()
637 // HPF and enable are special case, rest are in bands
638 if (_strip->filter_enable_controllable (true)) {
639 _strip->filter_enable_controllable (true)->Changed.connect (eq_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/eq_hpf/enable"), _strip->filter_enable_controllable (true)), OSC::instance());
640 change_message ("/select/eq_hpf/enable", _strip->filter_enable_controllable(true));
643 if (_strip->filter_enable_controllable (false)) {
644 _strip->filter_enable_controllable (false)->Changed.connect (eq_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/eq_lpf/enable"), _strip->filter_enable_controllable (false)), OSC::instance());
645 change_message ("/select/eq_lpf/enable", _strip->filter_enable_controllable(false));
648 if (_strip->filter_freq_controllable (true)) {
649 _strip->filter_freq_controllable (true)->Changed.connect (eq_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/eq_hpf/freq"), _strip->filter_freq_controllable (true)), OSC::instance());
650 change_message ("/select/eq_hpf/freq", _strip->filter_freq_controllable(true));
653 if (_strip->filter_freq_controllable (false)) {
654 _strip->filter_freq_controllable (false)->Changed.connect (eq_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/eq_lpf/freq"), _strip->filter_freq_controllable (false)), OSC::instance());
655 change_message ("/select/eq_lpf/freq", _strip->filter_freq_controllable(false));
658 if (_strip->filter_slope_controllable (true)) {
659 _strip->filter_slope_controllable (true)->Changed.connect (eq_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/eq_hpf/slope"), _strip->filter_slope_controllable (true)), OSC::instance());
660 change_message ("/select/eq_hpf/slope", _strip->filter_slope_controllable(true));
663 if (_strip->filter_slope_controllable (false)) {
664 _strip->filter_slope_controllable (false)->Changed.connect (eq_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/eq_lpf/slope"), _strip->filter_slope_controllable (false)), OSC::instance());
665 change_message ("/select/eq_lpf/slope", _strip->filter_slope_controllable(false));
668 if (_strip->eq_enable_controllable ()) {
669 _strip->eq_enable_controllable ()->Changed.connect (eq_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::enable_message, this, X_("/select/eq_enable"), _strip->eq_enable_controllable()), OSC::instance());
670 enable_message ("/select/eq_enable", _strip->eq_enable_controllable());
673 uint32_t eq_bands = _strip->eq_band_cnt ();
678 for (uint32_t i = 0; i < eq_bands; i++) {
679 if (_strip->eq_band_name(i).size()) {
680 text_with_id ("/select/eq_band_name", i + 1, _strip->eq_band_name (i));
682 if (_strip->eq_gain_controllable (i)) {
683 _strip->eq_gain_controllable(i)->Changed.connect (eq_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message_with_id, this, X_("/select/eq_gain"), i + 1, _strip->eq_gain_controllable(i)), OSC::instance());
684 change_message_with_id ("/select/eq_gain", i + 1, _strip->eq_gain_controllable(i));
686 if (_strip->eq_freq_controllable (i)) {
687 _strip->eq_freq_controllable(i)->Changed.connect (eq_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message_with_id, this, X_("/select/eq_freq"), i + 1, _strip->eq_freq_controllable(i)), OSC::instance());
688 change_message_with_id ("/select/eq_freq", i + 1, _strip->eq_freq_controllable(i));
690 if (_strip->eq_q_controllable (i)) {
691 _strip->eq_q_controllable(i)->Changed.connect (eq_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message_with_id, this, X_("/select/eq_q"), i + 1, _strip->eq_q_controllable(i)), OSC::instance());
692 change_message_with_id ("/select/eq_q", i + 1, _strip->eq_q_controllable(i));
694 if (_strip->eq_shape_controllable (i)) {
695 _strip->eq_shape_controllable(i)->Changed.connect (eq_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message_with_id, this, X_("/select/eq_shape"), i + 1, _strip->eq_shape_controllable(i)), OSC::instance());
696 change_message_with_id ("/select/eq_shape", i + 1, _strip->eq_shape_controllable(i));
702 OSCSelectObserver::eq_end ()
704 //need to check feedback for [13]
705 eq_connections.drop_connections ();
706 if (_strip->filter_freq_controllable (true)) {
707 send_float ("/select/eq_hpf", 0);
709 if (_strip->eq_enable_controllable ()) {
710 send_float ("/select/eq_enable", 0);
713 for (uint32_t i = 1; i <= _strip->eq_band_cnt (); i++) {
714 text_with_id ("/select/eq_band_name", i, " ");
715 send_float_with_id ("/select/eq_gain", i, 0);
716 send_float_with_id ("/select/eq_freq", i, 0);
717 send_float_with_id ("/select/eq_q", i, 0);
718 send_float_with_id ("/select/eq_shape", i, 0);
725 OSCSelectObserver::eq_restart(int x)
732 OSCSelectObserver::set_path (string path, uint32_t id)
735 path = string_compose ("%1/%2", path, id);
741 OSCSelectObserver::send_float (string path, float val)
743 lo_message msg = lo_message_new ();
744 lo_message_add_float (msg, val);
746 lo_send_message (addr, path.c_str(), msg);
747 lo_message_free (msg);
752 OSCSelectObserver::send_float_with_id (string path, uint32_t id, float val)
754 lo_message msg = lo_message_new ();
756 path = set_path (path, id);
758 lo_message_add_int32 (msg, id);
761 lo_message_add_float (msg, val);
763 lo_send_message (addr, path.c_str(), msg);
764 lo_message_free (msg);