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/plugin.h"
34 #include "ardour/plugin_insert.h"
35 #include "ardour/processor.h"
36 #include "ardour/readonly_control.h"
39 #include "osc_select_observer.h"
47 using namespace ARDOUR;
48 using namespace ArdourSurface;
50 OSCSelectObserver::OSCSelectObserver (boost::shared_ptr<Stripable> s, lo_address a, ArdourSurface::OSC::OSCSurface* su)
56 addr = lo_address_new (lo_address_get_hostname(a) , lo_address_get_port(a));
57 gainmode = sur->gainmode;
58 feedback = sur->feedback;
62 if (feedback[0]) { // buttons are separate feedback
63 _strip->PropertyChanged.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::name_changed, this, boost::lambda::_1), OSC::instance());
64 name_changed (ARDOUR::Properties::name);
66 _strip->mute_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/mute"), _strip->mute_control()), OSC::instance());
67 change_message ("/select/mute", _strip->mute_control());
69 _strip->solo_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/solo"), _strip->solo_control()), OSC::instance());
70 change_message ("/select/solo", _strip->solo_control());
72 if (_strip->solo_isolate_control()) {
73 _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());
74 change_message ("/select/solo_iso", _strip->solo_isolate_control());
77 if (_strip->solo_safe_control()) {
78 _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());
79 change_message ("/select/solo_safe", _strip->solo_safe_control());
82 boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track> (_strip);
84 track->monitoring_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::monitor_status, this, track->monitoring_control()), OSC::instance());
85 monitor_status (track->monitoring_control());
88 boost::shared_ptr<AutomationControl> rec_controllable = _strip->rec_enable_control ();
89 if (rec_controllable) {
90 rec_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/recenable"), _strip->rec_enable_control()), OSC::instance());
91 change_message ("/select/recenable", _strip->rec_enable_control());
94 boost::shared_ptr<AutomationControl> recsafe_controllable = _strip->rec_safe_control ();
95 if (recsafe_controllable) {
96 recsafe_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/record_safe"), _strip->rec_safe_control()), OSC::instance());
97 change_message ("/select/record_safe", _strip->rec_safe_control());
100 boost::shared_ptr<AutomationControl> phase_controllable = _strip->phase_control ();
101 if (phase_controllable) {
102 phase_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/polarity"), _strip->phase_control()), OSC::instance());
103 change_message ("/select/polarity", _strip->phase_control());
108 if (feedback[1]) { // level controls
109 _strip->gain_control()->alist()->automation_state_changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_automation, this), OSC::instance());
110 _strip->gain_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_message, this), OSC::instance());
113 boost::shared_ptr<Controllable> trim_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->trim_control());
114 if (trim_controllable) {
115 trim_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::trim_message, this, X_("/select/trimdB"), _strip->trim_control()), OSC::instance());
116 trim_message ("/select/trimdB", _strip->trim_control());
119 boost::shared_ptr<Controllable> pan_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->pan_azimuth_control());
120 if (pan_controllable) {
121 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());
122 change_message ("/select/pan_stereo_position", _strip->pan_azimuth_control());
125 boost::shared_ptr<Controllable> width_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->pan_width_control());
126 if (width_controllable) {
127 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());
128 change_message ("/select/pan_stereo_width", _strip->pan_width_control());
132 if (feedback[13]) { // Well known controls
133 // Rest of possible pan controls... Untested because I can't find a way to get them in the GUI :)
134 if (_strip->pan_elevation_control ()) {
135 _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());
136 change_message ("/select/pan_elevation_position", _strip->pan_elevation_control());
138 if (_strip->pan_frontback_control ()) {
139 _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());
140 change_message ("/select/pan_frontback_position", _strip->pan_frontback_control());
142 if (_strip->pan_lfe_control ()) {
143 _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());
144 change_message ("/select/pan_lfe_control", _strip->pan_lfe_control());
147 // sends, plugins and eq
148 // detecting processor changes is now in osc.cc
151 if (_strip->comp_enable_controllable ()) {
152 _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());
153 enable_message ("/select/comp_enable", _strip->comp_enable_controllable());
155 if (_strip->comp_threshold_controllable ()) {
156 _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());
157 change_message ("/select/comp_threshold", _strip->comp_threshold_controllable());
159 if (_strip->comp_speed_controllable ()) {
160 _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());
161 change_message ("/select/comp_speed", _strip->comp_speed_controllable());
163 if (_strip->comp_mode_controllable ()) {
164 _strip->comp_mode_controllable ()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::comp_mode, this), OSC::instance());
167 if (_strip->comp_makeup_controllable ()) {
168 _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());
169 change_message ("/select/comp_makeup", _strip->comp_makeup_controllable());
177 OSCSelectObserver::~OSCSelectObserver ()
179 strip_connections.drop_connections ();
180 // all strip buttons should be off and faders 0 and etc.
181 if (feedback[0]) { // buttons are separate feedback
182 send_float ("/select/expand", 0);
183 text_message ("/select/name", " ");
184 text_message ("/select/comment", " ");
185 send_float ("/select/mute", 0);
186 send_float ("/select/solo", 0);
187 send_float ("/select/recenable", 0);
188 send_float ("/select/record_safe", 0);
189 send_float ("/select/monitor_input", 0);
190 send_float ("/select/monitor_disk", 0);
191 send_float ("/select/polarity", 0);
192 send_float ("/select/n_inputs", 0);
193 send_float ("/select/n_outputs", 0);
195 if (feedback[1]) { // level controls
197 send_float ("/select/fader", 0);
199 send_float ("/select/gain", -193);
201 send_float ("/select/trimdB", 0);
202 send_float ("/select/pan_stereo_position", 0.5);
203 send_float ("/select/pan_stereo_width", 1);
206 send_float ("/select/signal", 0);
210 send_float ("/select/meter", 0);
212 send_float ("/select/meter", -193);
214 }else if (feedback[8]) {
215 send_float ("/select/meter", 0);
217 if (feedback[13]) { // Well known controls
218 send_float ("/select/pan_elevation_position", 0);
219 send_float ("/select/pan_frontback_position", .5);
220 send_float ("/select/pan_lfe_control", 0);
221 send_float ("/select/comp_enable", 0);
222 send_float ("/select/comp_threshold", 0);
223 send_float ("/select/comp_speed", 0);
224 send_float ("/select/comp_mode", 0);
225 text_message ("/select/comp_mode_name", " ");
226 text_message ("/select/comp_speed_name", " ");
227 send_float ("/select/comp_makeup", 0);
233 lo_address_free (addr);
237 OSCSelectObserver::renew_sends () {
243 OSCSelectObserver::renew_plugin () {
249 OSCSelectObserver::send_init()
251 // we don't know how many there are, so find out.
256 if (_strip->send_level_controllable (nsends)) {
265 // paging should be done in osc.cc in case there is no feedback
267 if (sur->send_page_size) {
268 send_size = sur->send_page_size;
271 uint32_t max_page = (uint32_t)(nsends / send_size) + 1;
272 if (sur->send_page < 1) {
274 } else if ((uint32_t)sur->send_page > max_page) {
275 sur->send_page = max_page;
277 uint32_t page_start = ((sur->send_page - 1) * send_size);
278 uint32_t last_send = sur->send_page * send_size;
281 for (uint32_t s = page_start; s < last_send; ++s, ++c) {
283 bool send_valid = false;
284 if (_strip->send_level_controllable (s)) {
285 _strip->send_level_controllable(s)->Changed.connect (send_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::send_gain, this, c, _strip->send_level_controllable(s)), OSC::instance());
286 send_timeout.push_back (0);
287 send_gain (c, _strip->send_level_controllable(s));
291 if (_strip->send_enable_controllable (s)) {
292 _strip->send_enable_controllable(s)->Changed.connect (send_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::enable_message_with_id, this, X_("/select/send_enable"), c, _strip->send_enable_controllable(s)), OSC::instance());
293 enable_message_with_id ("/select/send_enable", c, _strip->send_enable_controllable(s));
294 } else if (send_valid) {
295 boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route> (_strip);
297 // should never get here
298 send_float_with_id ("/select/send_enable", c, 0);
300 boost::shared_ptr<Send> snd = boost::dynamic_pointer_cast<Send> (r->nth_send(s));
302 boost::shared_ptr<Processor> proc = boost::dynamic_pointer_cast<Processor> (snd);
303 proc->ActiveChanged.connect (send_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::send_enable, this, X_("/select/send_enable"), c, proc), OSC::instance());
304 send_float_with_id ("/select/send_enable", c, proc->enabled());
307 if (!gainmode && send_valid) {
308 text_with_id ("/select/send_name", c, _strip->send_name(s));
314 OSCSelectObserver::plugin_init()
316 if (!sur->plugin_id) {
320 boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route>(_strip);
325 // we have a plugin number now get the processor
326 boost::shared_ptr<Processor> proc = r->nth_plugin (sur->plugin_id - 1);
327 boost::shared_ptr<PluginInsert> pi;
328 if (!(pi = boost::dynamic_pointer_cast<PluginInsert>(proc))) {
331 boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
334 nplug_params = sur->plug_params.size ();
336 // default of 0 page size means show all
337 plug_size = nplug_params;
338 if (sur->plug_page_size) {
339 plug_size = sur->plug_page_size;
341 text_message ("/select/plugin/name", pip->name());
342 uint32_t page_end = nplug_params;
343 uint32_t max_page = 1;
345 max_page = (uint32_t)((nplug_params - 1) / plug_size) + 1;
348 if (sur->plug_page < 1) {
351 if ((uint32_t)sur->plug_page > max_page) {
352 sur->plug_page = max_page;
354 uint32_t page_start = ((sur->plug_page - 1) * plug_size);
355 page_end = sur->plug_page * plug_size;
358 for ( uint32_t ppi = page_start; ppi < page_end; ++ppi, ++pid) {
359 if (ppi >= nplug_params) {
360 text_with_id ("/select/plugin/parameter/name", pid, " ");
361 send_float_with_id ("/select/plugin/parameter", pid, 0);
365 uint32_t controlid = pip->nth_parameter(sur->plug_params[ppi], ok);
369 ParameterDescriptor pd;
370 pip->get_parameter_descriptor(controlid, pd);
371 text_with_id ("/select/plugin/parameter/name", pid, pd.label);
372 if ( pip->parameter_is_input(controlid)) {
373 boost::shared_ptr<AutomationControl> c = pi->automation_control(Evoral::Parameter(PluginAutomation, 0, controlid));
376 if (pd.integer_step && pd.upper == 1) {
379 c->Changed.connect (plugin_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::plugin_parameter_changed, this, pid, swtch, c), OSC::instance());
380 plugin_parameter_changed (pid, swtch, c);
387 OSCSelectObserver::send_end ()
389 send_connections.drop_connections ();
390 for (uint32_t i = 1; i <= send_size; i++) {
392 send_float_with_id ("/select/send_fader", i, 0);
394 send_float_with_id ("/select/send_gain", i, -193);
397 send_float_with_id ("/select/send_enable", i, 0);
399 text_with_id ("/select/send_name", i, " ");
401 // need to delete or clear send_timeout
402 send_timeout.clear();
407 OSCSelectObserver::plugin_parameter_changed (int pid, bool swtch, boost::shared_ptr<PBD::Controllable> controllable)
410 enable_message_with_id ("/select/plugin/parameter", pid, controllable);
412 change_message_with_id ("/select/plugin/parameter", pid, controllable);
417 OSCSelectObserver::plugin_end ()
419 plugin_connections.drop_connections ();
420 text_message ("/select/plugin/name", " ");
421 for (uint32_t i = 1; i <= plug_size; i++) {
422 send_float_with_id ("/select/plugin/parameter", i, 0);
424 text_with_id ("/select/plugin/parameter/name", i, " ");
430 OSCSelectObserver::tick ()
432 if (feedback[7] || feedback[8] || feedback[9]) { // meters enabled
434 if (_strip->peak_meter()) {
435 now_meter = _strip->peak_meter()->meter_level(0, MeterMCP);
439 if (now_meter < -144) now_meter = -193;
440 if (_last_meter != now_meter) {
441 if (feedback[7] || feedback[8]) {
442 string path = "/select/meter";
443 lo_message msg = lo_message_new ();
444 if (gainmode && feedback[7]) {
445 lo_message_add_float (msg, ((now_meter + 94) / 100));
446 lo_send_message (addr, path.c_str(), msg);
447 } else if ((!gainmode) && feedback[7]) {
448 lo_message_add_float (msg, now_meter);
449 lo_send_message (addr, path.c_str(), msg);
450 } else if (feedback[8]) {
451 uint32_t ledlvl = (uint32_t)(((now_meter + 54) / 3.75)-1);
452 uint16_t ledbits = ~(0xfff<<ledlvl);
453 lo_message_add_int32 (msg, ledbits);
454 lo_send_message (addr, path.c_str(), msg);
456 lo_message_free (msg);
459 string path = "/select/signal";
460 lo_message msg = lo_message_new ();
462 if (now_meter < -40) {
467 lo_message_add_float (msg, signal);
468 lo_send_message (addr, path.c_str(), msg);
469 lo_message_free (msg);
472 _last_meter = now_meter;
477 if (gain_timeout == 1) {
478 text_message ("/select/name", _strip->name());
483 if (as == ARDOUR::Play || as == ARDOUR::Touch) {
484 if(_last_gain != _strip->gain_control()->get_value()) {
485 _last_gain = _strip->gain_control()->get_value();
491 if (_strip->comp_redux_controllable()) {
492 if (_strip->comp_redux_controllable()->get_parameter()) {
493 send_float ("/select/comp_redux", (float) _strip->comp_redux_controllable()->get_parameter ());
496 for (uint32_t i = 0; i < send_timeout.size(); i++) {
497 if (send_timeout[i]) {
498 if (send_timeout[i] == 1) {
499 text_with_id ("/select/send_name", i + 1, _strip->send_name(i));
509 OSCSelectObserver::name_changed (const PBD::PropertyChange& what_changed)
511 if (!what_changed.contains (ARDOUR::Properties::name)) {
519 text_message ("/select/name", _strip->name());
520 boost::shared_ptr<Route> route = boost::dynamic_pointer_cast<Route> (_strip);
522 //spit out the comment at the same time
523 text_message ("/select/comment", route->comment());
524 // lets tell the surface how many inputs this strip has
525 send_float ("/select/n_inputs", (float) route->n_inputs().n_total());
526 // lets tell the surface how many outputs this strip has
527 send_float ("/select/n_outputs", (float) route->n_outputs().n_total());
532 OSCSelectObserver::change_message (string path, boost::shared_ptr<Controllable> controllable)
534 lo_message msg = lo_message_new ();
535 float val = controllable->get_value();
537 lo_message_add_float (msg, (float) controllable->internal_to_interface (val));
539 lo_send_message (addr, path.c_str(), msg);
540 lo_message_free (msg);
544 OSCSelectObserver::enable_message (string path, boost::shared_ptr<Controllable> controllable)
546 float val = controllable->get_value();
548 send_float (path, 1);
550 send_float (path, 0);
556 OSCSelectObserver::change_message_with_id (string path, uint32_t id, boost::shared_ptr<Controllable> controllable)
558 lo_message msg = lo_message_new ();
559 float val = controllable->get_value();
561 path = set_path (path, id);
563 lo_message_add_int32 (msg, id);
566 lo_message_add_float (msg, (float) controllable->internal_to_interface (val));
568 lo_send_message (addr, path.c_str(), msg);
569 lo_message_free (msg);
573 OSCSelectObserver::enable_message_with_id (string path, uint32_t id, boost::shared_ptr<Controllable> controllable)
575 float val = controllable->get_value();
577 send_float_with_id (path, id, 1);
579 send_float_with_id (path, id, 0);
584 OSCSelectObserver::text_message (string path, std::string text)
586 lo_message msg = lo_message_new ();
588 lo_message_add_string (msg, text.c_str());
590 lo_send_message (addr, path.c_str(), msg);
591 lo_message_free (msg);
595 OSCSelectObserver::monitor_status (boost::shared_ptr<Controllable> controllable)
598 float val = controllable->get_value();
613 send_float ("/select/monitor_input", (float) input);
614 send_float ("/select/monitor_disk", (float) disk);
618 OSCSelectObserver::trim_message (string path, boost::shared_ptr<Controllable> controllable)
620 lo_message msg = lo_message_new ();
622 lo_message_add_float (msg, (float) accurate_coefficient_to_dB (controllable->get_value()));
624 lo_send_message (addr, path.c_str(), msg);
625 lo_message_free (msg);
629 OSCSelectObserver::gain_message ()
631 float value = _strip->gain_control()->get_value();
634 text_message ("/select/name", string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (value)));
636 send_float ("/select/fader", gain_to_slider_position (value));
639 send_float ("/select/gain", -200);
641 send_float ("/select/gain", accurate_coefficient_to_dB (value));
647 OSCSelectObserver::gain_automation ()
650 as = _strip->gain_control()->alist()->automation_state();
655 auto_name = "Manual";
674 send_float ("/select/fader/automation", output);
675 text_message ("/select/fader/automation_name", auto_name);
677 send_float ("/select/gain/automation", output);
678 text_message ("/select/gain/automation_name", auto_name);
685 OSCSelectObserver::send_gain (uint32_t id, boost::shared_ptr<PBD::Controllable> controllable)
687 lo_message msg = lo_message_new ();
692 db = controllable->get_value();
694 if (controllable->get_value() < 1e-15) {
697 db = accurate_coefficient_to_dB (controllable->get_value());
702 path = "/select/send_fader";
704 value = controllable->internal_to_interface (controllable->get_value());
706 value = gain_to_slider_position (controllable->get_value());
708 text_with_id ("/select/send_name" , id, string_compose ("%1%2%3", std::fixed, std::setprecision(2), db));
709 if (send_timeout.size() > id) {
710 send_timeout[id] = 8;
713 path = "/select/send_gain";
718 path = set_path (path, id);
720 lo_message_add_int32 (msg, id);
723 lo_message_add_float (msg, value);
724 lo_send_message (addr, path.c_str(), msg);
725 lo_message_free (msg);
729 OSCSelectObserver::send_enable (string path, uint32_t id, boost::shared_ptr<Processor> proc)
731 // with no delay value is wrong
734 send_float_with_id ("/select/send_enable", id, proc->enabled());
738 OSCSelectObserver::text_with_id (string path, uint32_t id, string name)
740 lo_message msg = lo_message_new ();
742 path = set_path (path, id);
744 lo_message_add_int32 (msg, id);
747 lo_message_add_string (msg, name.c_str());
749 lo_send_message (addr, path.c_str(), msg);
750 lo_message_free (msg);
754 OSCSelectObserver::comp_mode ()
756 change_message ("/select/comp_mode", _strip->comp_mode_controllable());
757 text_message ("/select/comp_mode_name", _strip->comp_mode_name(_strip->comp_mode_controllable()->get_value()));
758 text_message ("/select/comp_speed_name", _strip->comp_speed_name(_strip->comp_mode_controllable()->get_value()));
762 OSCSelectObserver::eq_init()
764 // HPF and enable are special case, rest are in bands
765 if (_strip->filter_enable_controllable (true)) {
766 _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());
767 change_message ("/select/eq_hpf/enable", _strip->filter_enable_controllable(true));
770 if (_strip->filter_enable_controllable (false)) {
771 _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());
772 change_message ("/select/eq_lpf/enable", _strip->filter_enable_controllable(false));
775 if (_strip->filter_freq_controllable (true)) {
776 _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());
777 change_message ("/select/eq_hpf/freq", _strip->filter_freq_controllable(true));
780 if (_strip->filter_freq_controllable (false)) {
781 _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());
782 change_message ("/select/eq_lpf/freq", _strip->filter_freq_controllable(false));
785 if (_strip->filter_slope_controllable (true)) {
786 _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());
787 change_message ("/select/eq_hpf/slope", _strip->filter_slope_controllable(true));
790 if (_strip->filter_slope_controllable (false)) {
791 _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());
792 change_message ("/select/eq_lpf/slope", _strip->filter_slope_controllable(false));
795 if (_strip->eq_enable_controllable ()) {
796 _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());
797 enable_message ("/select/eq_enable", _strip->eq_enable_controllable());
800 uint32_t eq_bands = _strip->eq_band_cnt ();
805 for (uint32_t i = 0; i < eq_bands; i++) {
806 if (_strip->eq_band_name(i).size()) {
807 text_with_id ("/select/eq_band_name", i + 1, _strip->eq_band_name (i));
809 if (_strip->eq_gain_controllable (i)) {
810 _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());
811 change_message_with_id ("/select/eq_gain", i + 1, _strip->eq_gain_controllable(i));
813 if (_strip->eq_freq_controllable (i)) {
814 _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());
815 change_message_with_id ("/select/eq_freq", i + 1, _strip->eq_freq_controllable(i));
817 if (_strip->eq_q_controllable (i)) {
818 _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());
819 change_message_with_id ("/select/eq_q", i + 1, _strip->eq_q_controllable(i));
821 if (_strip->eq_shape_controllable (i)) {
822 _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());
823 change_message_with_id ("/select/eq_shape", i + 1, _strip->eq_shape_controllable(i));
829 OSCSelectObserver::eq_end ()
831 //need to check feedback for [13]
832 eq_connections.drop_connections ();
833 if (_strip->filter_freq_controllable (true)) {
834 send_float ("/select/eq_hpf", 0);
836 if (_strip->eq_enable_controllable ()) {
837 send_float ("/select/eq_enable", 0);
840 for (uint32_t i = 1; i <= _strip->eq_band_cnt (); i++) {
841 text_with_id ("/select/eq_band_name", i, " ");
842 send_float_with_id ("/select/eq_gain", i, 0);
843 send_float_with_id ("/select/eq_freq", i, 0);
844 send_float_with_id ("/select/eq_q", i, 0);
845 send_float_with_id ("/select/eq_shape", i, 0);
852 OSCSelectObserver::eq_restart(int x)
859 OSCSelectObserver::set_path (string path, uint32_t id)
862 path = string_compose ("%1/%2", path, id);
868 OSCSelectObserver::send_float (string path, float val)
870 lo_message msg = lo_message_new ();
871 lo_message_add_float (msg, val);
873 lo_send_message (addr, path.c_str(), msg);
874 lo_message_free (msg);
879 OSCSelectObserver::send_float_with_id (string path, uint32_t id, float val)
881 lo_message msg = lo_message_new ();
883 path = set_path (path, id);
885 lo_message_add_int32 (msg, id);
888 lo_message_add_float (msg, val);
890 lo_send_message (addr, path.c_str(), msg);
891 lo_message_free (msg);