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 "pbd/control_math.h"
25 #include "ardour/session.h"
26 #include "ardour/track.h"
27 #include "ardour/monitor_control.h"
28 #include "ardour/dB.h"
29 #include "ardour/meter.h"
30 #include "ardour/phase_control.h"
31 #include "ardour/solo_isolate_control.h"
32 #include "ardour/solo_safe_control.h"
33 #include "ardour/route.h"
34 #include "ardour/send.h"
35 #include "ardour/plugin.h"
36 #include "ardour/plugin_insert.h"
37 #include "ardour/processor.h"
38 #include "ardour/readonly_control.h"
41 #include "osc_select_observer.h"
49 using namespace ARDOUR;
50 using namespace ArdourSurface;
52 OSCSelectObserver::OSCSelectObserver (OSC& o, ArdourSurface::OSC::OSCSurface* su)
60 addr = lo_address_new_from_url (sur->remote_url.c_str());
61 std::cout << "select observer created\n";
65 OSCSelectObserver::~OSCSelectObserver ()
69 lo_address_free (addr);
73 OSCSelectObserver::no_strip ()
75 // This gets called on drop references
78 strip_connections.drop_connections ();
80 * The strip will sit idle at this point doing nothing until
81 * the surface has recalculated it's strip list and then calls
82 * refresh_strip. Otherwise refresh strip will get a strip address
83 * that does not exist... Crash
88 OSCSelectObserver::refresh_strip (bool force)
92 boost::shared_ptr<ARDOUR::Stripable> new_strip = sur->select;
93 if (_strip && (new_strip == _strip) && !force) {
97 std::cout << string_compose ("new select: %1\n", new_strip->name());
100 _strip->DropReferences.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::no_strip, this), OSC::instance());
102 gainmode = sur->gainmode;
103 feedback = sur->feedback;
112 _strip->PropertyChanged.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::name_changed, this, boost::lambda::_1), OSC::instance());
113 name_changed (ARDOUR::Properties::name);
115 _strip->mute_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/mute"), _strip->mute_control()), OSC::instance());
116 change_message ("/select/mute", _strip->mute_control());
118 _strip->solo_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/solo"), _strip->solo_control()), OSC::instance());
119 change_message ("/select/solo", _strip->solo_control());
121 if (_strip->solo_isolate_control()) {
122 _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());
123 change_message ("/select/solo_iso", _strip->solo_isolate_control());
126 if (_strip->solo_safe_control()) {
127 _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());
128 change_message ("/select/solo_safe", _strip->solo_safe_control());
131 boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track> (_strip);
133 track->monitoring_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::monitor_status, this, track->monitoring_control()), OSC::instance());
134 monitor_status (track->monitoring_control());
137 boost::shared_ptr<AutomationControl> rec_controllable = _strip->rec_enable_control ();
138 if (rec_controllable) {
139 rec_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/recenable"), _strip->rec_enable_control()), OSC::instance());
140 change_message ("/select/recenable", _strip->rec_enable_control());
143 boost::shared_ptr<AutomationControl> recsafe_controllable = _strip->rec_safe_control ();
144 if (recsafe_controllable) {
145 recsafe_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/record_safe"), _strip->rec_safe_control()), OSC::instance());
146 change_message ("/select/record_safe", _strip->rec_safe_control());
149 boost::shared_ptr<AutomationControl> phase_controllable = _strip->phase_control ();
150 if (phase_controllable) {
151 phase_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/polarity"), _strip->phase_control()), OSC::instance());
152 change_message ("/select/polarity", _strip->phase_control());
155 _strip->gain_control()->alist()->automation_state_changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_automation, this), OSC::instance());
156 _strip->gain_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_message, this), OSC::instance());
159 boost::shared_ptr<Controllable> trim_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->trim_control());
160 if (trim_controllable) {
161 trim_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::trim_message, this, X_("/select/trimdB"), _strip->trim_control()), OSC::instance());
162 trim_message ("/select/trimdB", _strip->trim_control());
165 boost::shared_ptr<Controllable> pan_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->pan_azimuth_control());
166 if (pan_controllable) {
167 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());
168 change_message ("/select/pan_stereo_position", _strip->pan_azimuth_control());
171 boost::shared_ptr<Controllable> width_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->pan_width_control());
172 if (width_controllable) {
173 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());
174 change_message ("/select/pan_stereo_width", _strip->pan_width_control());
177 // Rest of possible pan controls... Untested because I can't find a way to get them in the GUI :)
178 if (_strip->pan_elevation_control ()) {
179 _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());
180 change_message ("/select/pan_elevation_position", _strip->pan_elevation_control());
182 if (_strip->pan_frontback_control ()) {
183 _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());
184 change_message ("/select/pan_frontback_position", _strip->pan_frontback_control());
186 if (_strip->pan_lfe_control ()) {
187 _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());
188 change_message ("/select/pan_lfe_control", _strip->pan_lfe_control());
191 // sends, plugins and eq
192 // detecting processor changes is now in osc.cc
194 // but... MB master send enable is different
195 if (_strip->master_send_enable_controllable ()) {
196 _strip->master_send_enable_controllable ()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::enable_message, this, X_("/select/master_send_enable"), _strip->master_send_enable_controllable()), OSC::instance());
197 enable_message ("/select/master_send_enable", _strip->master_send_enable_controllable());
201 if (_strip->comp_enable_controllable ()) {
202 _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());
203 enable_message ("/select/comp_enable", _strip->comp_enable_controllable());
205 if (_strip->comp_threshold_controllable ()) {
206 _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());
207 change_message ("/select/comp_threshold", _strip->comp_threshold_controllable());
209 if (_strip->comp_speed_controllable ()) {
210 _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());
211 change_message ("/select/comp_speed", _strip->comp_speed_controllable());
213 if (_strip->comp_mode_controllable ()) {
214 _strip->comp_mode_controllable ()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::comp_mode, this), OSC::instance());
217 if (_strip->comp_makeup_controllable ()) {
218 _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());
219 change_message ("/select/comp_makeup", _strip->comp_makeup_controllable());
228 OSCSelectObserver::clear_observer ()
230 strip_connections.drop_connections ();
231 // all strip buttons should be off and faders 0 and etc.
232 _osc.float_message ("/select/expand", 0, addr);
233 _osc.text_message ("/select/name", " ", addr);
234 _osc.text_message ("/select/comment", " ", addr);
235 _osc.float_message ("/select/mute", 0, addr);
236 _osc.float_message ("/select/solo", 0, addr);
237 _osc.float_message ("/select/recenable", 0, addr);
238 _osc.float_message ("/select/record_safe", 0, addr);
239 _osc.float_message ("/select/monitor_input", 0, addr);
240 _osc.float_message ("/select/monitor_disk", 0, addr);
241 _osc.float_message ("/select/polarity", 0, addr);
242 _osc.float_message ("/select/n_inputs", 0, addr);
243 _osc.float_message ("/select/n_outputs", 0, addr);
245 _osc.float_message ("/select/fader", 0, addr);
247 _osc.float_message ("/select/gain", -193, addr);
249 _osc.float_message ("/select/trimdB", 0, addr);
250 _osc.float_message ("/select/pan_stereo_position", 0.5, addr);
251 _osc.float_message ("/select/pan_stereo_width", 1, addr);
253 _osc.float_message ("/select/signal", 0, addr);
257 _osc.float_message ("/select/meter", 0, addr);
259 _osc.float_message ("/select/meter", -193, addr);
261 }else if (feedback[8]) {
262 _osc.float_message ("/select/meter", 0, addr);
264 _osc.float_message ("/select/pan_elevation_position", 0, addr);
265 _osc.float_message ("/select/pan_frontback_position", .5, addr);
266 _osc.float_message ("/select/pan_lfe_control", 0, addr);
267 _osc.float_message ("/select/comp_enable", 0, addr);
268 _osc.float_message ("/select/comp_threshold", 0, addr);
269 _osc.float_message ("/select/comp_speed", 0, addr);
270 _osc.float_message ("/select/comp_mode", 0, addr);
271 _osc.text_message ("/select/comp_mode_name", " ", addr);
272 _osc.text_message ("/select/comp_speed_name", " ", addr);
273 _osc.float_message ("/select/comp_makeup", 0, addr);
280 OSCSelectObserver::renew_sends () {
286 OSCSelectObserver::renew_plugin () {
292 OSCSelectObserver::send_init()
294 // we don't know how many there are, so find out.
299 if (_strip->send_level_controllable (nsends)) {
308 // paging should be done in osc.cc in case there is no feedback
310 if (sur->send_page_size) {
311 send_size = sur->send_page_size;
314 uint32_t max_page = (uint32_t)(nsends / send_size) + 1;
315 if (sur->send_page < 1) {
317 } else if ((uint32_t)sur->send_page > max_page) {
318 sur->send_page = max_page;
320 uint32_t page_start = ((sur->send_page - 1) * send_size);
321 uint32_t last_send = sur->send_page * send_size;
323 send_timeout.push_back (2);
325 _last_send.push_back (0.0);
327 for (uint32_t s = page_start; s < last_send; ++s, ++c) {
329 bool send_valid = false;
330 if (_strip->send_level_controllable (s)) {
331 _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());
332 send_timeout.push_back (2);
333 _last_send.push_back (0.0);
334 send_gain (c, _strip->send_level_controllable(s));
338 if (_strip->send_enable_controllable (s)) {
339 _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());
340 enable_message_with_id ("/select/send_enable", c, _strip->send_enable_controllable(s));
341 } else if (send_valid) {
342 boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route> (_strip);
344 // should never get here
345 _osc.float_message_with_id ("/select/send_enable", c, 0, addr);
347 boost::shared_ptr<Send> snd = boost::dynamic_pointer_cast<Send> (r->nth_send(s));
349 boost::shared_ptr<Processor> proc = boost::dynamic_pointer_cast<Processor> (snd);
350 proc->ActiveChanged.connect (send_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::send_enable, this, X_("/select/send_enable"), c, proc), OSC::instance());
351 _osc.float_message_with_id ("/select/send_enable", c, proc->enabled(), addr);
354 if (!gainmode && send_valid) {
355 _osc.text_message_with_id ("/select/send_name", c, _strip->send_name(s), addr);
361 OSCSelectObserver::plugin_init()
363 if (!sur->plugin_id) {
367 boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route>(_strip);
372 // we have a plugin number now get the processor
373 boost::shared_ptr<Processor> proc = r->nth_plugin (sur->plugins[sur->plugin_id - 1]);
374 boost::shared_ptr<PluginInsert> pi;
375 if (!(pi = boost::dynamic_pointer_cast<PluginInsert>(proc))) {
378 boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
381 nplug_params = sur->plug_params.size ();
383 // default of 0 page size means show all
384 plug_size = nplug_params;
385 if (sur->plug_page_size) {
386 plug_size = sur->plug_page_size;
388 _osc.text_message ("/select/plugin/name", pip->name(), addr);
389 uint32_t page_end = nplug_params;
390 uint32_t max_page = 1;
391 if (plug_size && nplug_params) {
392 max_page = (uint32_t)((nplug_params - 1) / plug_size) + 1;
395 if (sur->plug_page < 1) {
398 if ((uint32_t)sur->plug_page > max_page) {
399 sur->plug_page = max_page;
401 uint32_t page_start = ((sur->plug_page - 1) * plug_size);
402 page_end = sur->plug_page * plug_size;
405 for ( uint32_t ppi = page_start; ppi < page_end; ++ppi, ++pid) {
406 if (ppi >= nplug_params) {
407 _osc.text_message_with_id ("/select/plugin/parameter/name", pid, " ", addr);
408 _osc.float_message_with_id ("/select/plugin/parameter", pid, 0, addr);
412 uint32_t controlid = pip->nth_parameter(sur->plug_params[ppi], ok);
416 ParameterDescriptor pd;
417 pip->get_parameter_descriptor(controlid, pd);
418 _osc.text_message_with_id ("/select/plugin/parameter/name", pid, pd.label, addr);
419 if ( pip->parameter_is_input(controlid)) {
420 boost::shared_ptr<AutomationControl> c = pi->automation_control(Evoral::Parameter(PluginAutomation, 0, controlid));
423 if (pd.integer_step && pd.upper == 1) {
426 c->Changed.connect (plugin_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::plugin_parameter_changed, this, pid, swtch, c), OSC::instance());
427 plugin_parameter_changed (pid, swtch, c);
434 OSCSelectObserver::send_end ()
436 send_connections.drop_connections ();
437 for (uint32_t i = 1; i <= send_size; i++) {
439 _osc.float_message_with_id ("/select/send_fader", i, 0, addr);
441 _osc.float_message_with_id ("/select/send_gain", i, -193, addr);
444 _osc.float_message_with_id ("/select/send_enable", i, 0, addr);
446 _osc.text_message_with_id ("/select/send_name", i, " ", addr);
448 // need to delete or clear send_timeout
449 send_timeout.clear();
454 OSCSelectObserver::plugin_parameter_changed (int pid, bool swtch, boost::shared_ptr<PBD::Controllable> controllable)
457 enable_message_with_id ("/select/plugin/parameter", pid, controllable);
459 change_message_with_id ("/select/plugin/parameter", pid, controllable);
464 OSCSelectObserver::plugin_end ()
466 plugin_connections.drop_connections ();
467 _osc.text_message ("/select/plugin/name", " ", addr);
468 for (uint32_t i = 1; i <= plug_size; i++) {
469 _osc.float_message_with_id ("/select/plugin/parameter", i, 0, addr);
471 _osc.text_message_with_id ("/select/plugin/parameter/name", i, " ", addr);
477 OSCSelectObserver::tick ()
482 if (feedback[7] || feedback[8] || feedback[9]) { // meters enabled
484 if (_strip->peak_meter()) {
485 now_meter = _strip->peak_meter()->meter_level(0, MeterMCP);
489 if (now_meter < -144) now_meter = -193;
490 if (_last_meter != now_meter) {
491 if (feedback[7] || feedback[8]) {
492 string path = "/select/meter";
493 if (gainmode && feedback[7]) {
494 _osc.float_message (path, ((now_meter + 94) / 100), addr);
495 } else if ((!gainmode) && feedback[7]) {
496 _osc.float_message (path, now_meter, addr);
497 } else if (feedback[8]) {
498 uint32_t ledlvl = (uint32_t)(((now_meter + 54) / 3.75)-1);
499 uint16_t ledbits = ~(0xfff<<ledlvl);
500 _osc.float_message (path, ledbits, addr);
504 string path = "/select/signal";
506 if (now_meter < -40) {
511 _osc.float_message (path, signal, addr);
514 _last_meter = now_meter;
518 if (gain_timeout == 1) {
519 _osc.text_message ("/select/name", _strip->name(), addr);
524 if (as == ARDOUR::Play || as == ARDOUR::Touch) {
525 if(_last_gain != _strip->gain_control()->get_value()) {
526 _last_gain = _strip->gain_control()->get_value();
530 if (_strip->comp_redux_controllable() && _strip->comp_enable_controllable() && _strip->comp_enable_controllable()->get_value()) {
531 float new_value = _strip->comp_redux_controllable()->get_parameter();
532 if (_comp_redux != new_value) {
533 _osc.float_message ("/select/comp_redux", new_value, addr);
534 _comp_redux = new_value;
537 for (uint32_t i = 1; i <= send_timeout.size(); i++) {
538 if (send_timeout[i]) {
539 if (send_timeout[i] == 1) {
540 uint32_t pg_offset = (sur->send_page - 1) * sur->send_page_size;
541 _osc.text_message_with_id ("/select/send_name", i, _strip->send_name(pg_offset + i - 1), addr);
549 OSCSelectObserver::name_changed (const PBD::PropertyChange& what_changed)
551 if (!what_changed.contains (ARDOUR::Properties::name)) {
559 _osc.text_message ("/select/name", _strip->name(), addr);
560 boost::shared_ptr<Route> route = boost::dynamic_pointer_cast<Route> (_strip);
562 //spit out the comment at the same time
563 _osc.text_message ("/select/comment", route->comment(), addr);
564 // lets tell the surface how many inputs this strip has
565 _osc.float_message ("/select/n_inputs", (float) route->n_inputs().n_total(), addr);
566 // lets tell the surface how many outputs this strip has
567 _osc.float_message ("/select/n_outputs", (float) route->n_outputs().n_total(), addr);
572 OSCSelectObserver::change_message (string path, boost::shared_ptr<Controllable> controllable)
574 float val = controllable->get_value();
576 _osc.float_message (path, (float) controllable->internal_to_interface (val), addr);
580 OSCSelectObserver::enable_message (string path, boost::shared_ptr<Controllable> controllable)
582 float val = controllable->get_value();
584 _osc.float_message (path, 1, addr);
586 _osc.float_message (path, 0, addr);
592 OSCSelectObserver::change_message_with_id (string path, uint32_t id, boost::shared_ptr<Controllable> controllable)
594 float val = controllable->get_value();
596 _osc.float_message_with_id (path, id, (float) controllable->internal_to_interface (val), addr);
600 OSCSelectObserver::enable_message_with_id (string path, uint32_t id, boost::shared_ptr<Controllable> controllable)
602 float val = controllable->get_value();
604 _osc.float_message_with_id (path, id, 1, addr);
606 _osc.float_message_with_id (path, id, 0, addr);
611 OSCSelectObserver::monitor_status (boost::shared_ptr<Controllable> controllable)
614 float val = controllable->get_value();
629 _osc.float_message ("/select/monitor_input", (float) input, addr);
630 _osc.float_message ("/select/monitor_disk", (float) disk, addr);
634 OSCSelectObserver::trim_message (string path, boost::shared_ptr<Controllable> controllable)
636 if (_last_trim != controllable->get_value()) {
637 _last_trim = controllable->get_value();
642 _osc.float_message (path, (float) accurate_coefficient_to_dB (controllable->get_value()), addr);
646 OSCSelectObserver::gain_message ()
648 float value = _strip->gain_control()->get_value();
649 if (_last_gain != value) {
656 _osc.text_message ("/select/name", string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (value)), addr);
658 _osc.float_message ("/select/fader", _strip->gain_control()->internal_to_interface (value), addr);
661 _osc.float_message ("/select/gain", -200, addr);
663 _osc.float_message ("/select/gain", accurate_coefficient_to_dB (value), addr);
669 OSCSelectObserver::gain_automation ()
672 as = _strip->gain_control()->alist()->automation_state();
677 auto_name = "Manual";
696 _osc.float_message ("/select/fader/automation", output, addr);
697 _osc.text_message ("/select/fader/automation_name", auto_name, addr);
699 _osc.float_message ("/select/gain/automation", output, addr);
700 _osc.text_message ("/select/gain/automation_name", auto_name, addr);
707 OSCSelectObserver::send_gain (uint32_t id, boost::shared_ptr<PBD::Controllable> controllable)
709 if (_last_send[id] != controllable->get_value()) {
710 _last_send[id] = controllable->get_value();
718 db = controllable->get_value();
720 if (controllable->get_value() < 1e-15) {
723 db = accurate_coefficient_to_dB (controllable->get_value());
728 path = "/select/send_fader";
729 value = controllable->internal_to_interface (controllable->get_value());
730 _osc.text_message_with_id ("/select/send_name" , id, string_compose ("%1%2%3", std::fixed, std::setprecision(2), db), addr);
731 if (send_timeout.size() > id) {
732 send_timeout[id] = 8;
735 path = "/select/send_gain";
739 _osc.float_message_with_id (path, id, value, addr);
743 OSCSelectObserver::send_enable (string path, uint32_t id, boost::shared_ptr<Processor> proc)
745 // with no delay value is wrong
748 _osc.float_message_with_id ("/select/send_enable", id, proc->enabled(), addr);
752 OSCSelectObserver::comp_mode ()
754 change_message ("/select/comp_mode", _strip->comp_mode_controllable());
755 _osc.text_message ("/select/comp_mode_name", _strip->comp_mode_name(_strip->comp_mode_controllable()->get_value()), addr);
756 _osc.text_message ("/select/comp_speed_name", _strip->comp_speed_name(_strip->comp_mode_controllable()->get_value()), addr);
760 OSCSelectObserver::eq_init()
762 // HPF and enable are special case, rest are in bands
763 if (_strip->filter_enable_controllable (true)) {
764 _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());
765 change_message ("/select/eq_hpf/enable", _strip->filter_enable_controllable(true));
768 if (_strip->filter_enable_controllable (false)) {
769 _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());
770 change_message ("/select/eq_lpf/enable", _strip->filter_enable_controllable(false));
773 if (_strip->filter_freq_controllable (true)) {
774 _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());
775 change_message ("/select/eq_hpf/freq", _strip->filter_freq_controllable(true));
778 if (_strip->filter_freq_controllable (false)) {
779 _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());
780 change_message ("/select/eq_lpf/freq", _strip->filter_freq_controllable(false));
783 if (_strip->filter_slope_controllable (true)) {
784 _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());
785 change_message ("/select/eq_hpf/slope", _strip->filter_slope_controllable(true));
788 if (_strip->filter_slope_controllable (false)) {
789 _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());
790 change_message ("/select/eq_lpf/slope", _strip->filter_slope_controllable(false));
793 if (_strip->eq_enable_controllable ()) {
794 _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());
795 enable_message ("/select/eq_enable", _strip->eq_enable_controllable());
798 uint32_t eq_bands = _strip->eq_band_cnt ();
803 for (uint32_t i = 0; i < eq_bands; i++) {
804 if (_strip->eq_band_name(i).size()) {
805 _osc.text_message_with_id ("/select/eq_band_name", i + 1, _strip->eq_band_name (i), addr);
807 if (_strip->eq_gain_controllable (i)) {
808 _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());
809 change_message_with_id ("/select/eq_gain", i + 1, _strip->eq_gain_controllable(i));
811 if (_strip->eq_freq_controllable (i)) {
812 _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());
813 change_message_with_id ("/select/eq_freq", i + 1, _strip->eq_freq_controllable(i));
815 if (_strip->eq_q_controllable (i)) {
816 _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());
817 change_message_with_id ("/select/eq_q", i + 1, _strip->eq_q_controllable(i));
819 if (_strip->eq_shape_controllable (i)) {
820 _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());
821 change_message_with_id ("/select/eq_shape", i + 1, _strip->eq_shape_controllable(i));
827 OSCSelectObserver::eq_end ()
829 eq_connections.drop_connections ();
830 if (_strip->filter_freq_controllable (true)) {
831 _osc.float_message ("/select/eq_hpf", 0, addr);
833 if (_strip->eq_enable_controllable ()) {
834 _osc.float_message ("/select/eq_enable", 0, addr);
837 for (uint32_t i = 1; i <= _strip->eq_band_cnt (); i++) {
838 _osc.text_message_with_id ("/select/eq_band_name", i, " ", addr);
839 _osc.float_message_with_id ("/select/eq_gain", i, 0, addr);
840 _osc.float_message_with_id ("/select/eq_freq", i, 0, addr);
841 _osc.float_message_with_id ("/select/eq_q", i, 0, addr);
842 _osc.float_message_with_id ("/select/eq_shape", i, 0, addr);
849 OSCSelectObserver::eq_restart(int x)
856 OSCSelectObserver::set_path (string path, uint32_t id)
859 path = string_compose ("%1/%2", path, id);