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)
61 addr = lo_address_new_from_url (sur->remote_url.c_str());
62 gainmode = sur->gainmode;
63 feedback = sur->feedback;
64 in_line = feedback[2];
66 send_page_size = sur->send_page_size;
69 OSCSelectObserver::~OSCSelectObserver ()
73 lo_address_free (addr);
77 OSCSelectObserver::no_strip ()
79 // This gets called on drop references
82 strip_connections.drop_connections ();
83 send_connections.drop_connections ();
84 plugin_connections.drop_connections ();
85 eq_connections.drop_connections ();
87 * The strip will sit idle at this point doing nothing until
88 * the surface has recalculated it's strip list and then calls
89 * refresh_strip. Otherwise refresh strip will get a strip address
90 * that does not exist... Crash
95 OSCSelectObserver::refresh_strip (bool force)
99 Glib::usleep(100); // let tick finish
102 // this has to be done first because expand may change with no strip change
103 if (sur->expand_enable) {
104 _osc.float_message ("/select/expand", 1.0, addr);
106 _osc.float_message ("/select/expand", 0.0, addr);
109 boost::shared_ptr<ARDOUR::Stripable> new_strip = sur->select;
110 if (_strip && (new_strip == _strip) && !force) {
121 _strip->DropReferences.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::no_strip, this), OSC::instance());
130 _strip->PropertyChanged.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::name_changed, this, boost::lambda::_1), OSC::instance());
131 name_changed (ARDOUR::Properties::name);
133 _strip->mute_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/mute"), _strip->mute_control()), OSC::instance());
134 change_message ("/select/mute", _strip->mute_control());
136 _strip->solo_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/solo"), _strip->solo_control()), OSC::instance());
137 change_message ("/select/solo", _strip->solo_control());
139 if (_strip->solo_isolate_control()) {
140 _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());
141 change_message ("/select/solo_iso", _strip->solo_isolate_control());
144 if (_strip->solo_safe_control()) {
145 _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());
146 change_message ("/select/solo_safe", _strip->solo_safe_control());
149 boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track> (_strip);
151 track->monitoring_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::monitor_status, this, track->monitoring_control()), OSC::instance());
152 monitor_status (track->monitoring_control());
155 boost::shared_ptr<AutomationControl> rec_controllable = _strip->rec_enable_control ();
156 if (rec_controllable) {
157 rec_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/recenable"), _strip->rec_enable_control()), OSC::instance());
158 change_message ("/select/recenable", _strip->rec_enable_control());
161 boost::shared_ptr<AutomationControl> recsafe_controllable = _strip->rec_safe_control ();
162 if (recsafe_controllable) {
163 recsafe_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/record_safe"), _strip->rec_safe_control()), OSC::instance());
164 change_message ("/select/record_safe", _strip->rec_safe_control());
167 boost::shared_ptr<AutomationControl> phase_controllable = _strip->phase_control ();
168 if (phase_controllable) {
169 phase_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/polarity"), _strip->phase_control()), OSC::instance());
170 change_message ("/select/polarity", _strip->phase_control());
173 _strip->gain_control()->alist()->automation_state_changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_automation, this), OSC::instance());
174 _strip->gain_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_message, this), OSC::instance());
177 boost::shared_ptr<Controllable> trim_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->trim_control());
178 if (trim_controllable) {
179 trim_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::trim_message, this, X_("/select/trimdB"), _strip->trim_control()), OSC::instance());
180 trim_message ("/select/trimdB", _strip->trim_control());
183 boost::shared_ptr<Controllable> pan_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->pan_azimuth_control());
184 if (pan_controllable) {
185 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());
186 change_message ("/select/pan_stereo_position", _strip->pan_azimuth_control());
189 boost::shared_ptr<Controllable> width_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->pan_width_control());
190 if (width_controllable) {
191 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());
192 change_message ("/select/pan_stereo_width", _strip->pan_width_control());
195 // Rest of possible pan controls... Untested because I can't find a way to get them in the GUI :)
196 if (_strip->pan_elevation_control ()) {
197 _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());
198 change_message ("/select/pan_elevation_position", _strip->pan_elevation_control());
200 if (_strip->pan_frontback_control ()) {
201 _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());
202 change_message ("/select/pan_frontback_position", _strip->pan_frontback_control());
204 if (_strip->pan_lfe_control ()) {
205 _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());
206 change_message ("/select/pan_lfe_control", _strip->pan_lfe_control());
209 // sends, plugins and eq
210 // detecting processor changes is now in osc.cc
212 // but... MB master send enable is different
213 if (_strip->master_send_enable_controllable ()) {
214 _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());
215 enable_message ("/select/master_send_enable", _strip->master_send_enable_controllable());
219 if (_strip->comp_enable_controllable ()) {
220 _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());
221 enable_message ("/select/comp_enable", _strip->comp_enable_controllable());
223 if (_strip->comp_threshold_controllable ()) {
224 _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());
225 change_message ("/select/comp_threshold", _strip->comp_threshold_controllable());
227 if (_strip->comp_speed_controllable ()) {
228 _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());
229 change_message ("/select/comp_speed", _strip->comp_speed_controllable());
231 if (_strip->comp_mode_controllable ()) {
232 _strip->comp_mode_controllable ()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::comp_mode, this), OSC::instance());
235 if (_strip->comp_makeup_controllable ()) {
236 _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());
237 change_message ("/select/comp_makeup", _strip->comp_makeup_controllable());
248 OSCSelectObserver::clear_observer ()
251 strip_connections.drop_connections ();
252 // all strip buttons should be off and faders 0 and etc.
253 _osc.float_message ("/select/expand", 0, addr);
254 _osc.text_message ("/select/name", " ", addr);
255 _osc.text_message ("/select/comment", " ", addr);
256 _osc.float_message ("/select/mute", 0, addr);
257 _osc.float_message ("/select/solo", 0, addr);
258 _osc.float_message ("/select/recenable", 0, addr);
259 _osc.float_message ("/select/record_safe", 0, addr);
260 _osc.float_message ("/select/monitor_input", 0, addr);
261 _osc.float_message ("/select/monitor_disk", 0, addr);
262 _osc.float_message ("/select/polarity", 0, addr);
263 _osc.float_message ("/select/n_inputs", 0, addr);
264 _osc.float_message ("/select/n_outputs", 0, addr);
266 _osc.float_message ("/select/fader", 0, addr);
268 _osc.float_message ("/select/gain", -193, addr);
270 _osc.float_message ("/select/trimdB", 0, addr);
271 _osc.float_message ("/select/pan_stereo_position", 0.5, addr);
272 _osc.float_message ("/select/pan_stereo_width", 1, addr);
274 _osc.float_message ("/select/signal", 0, addr);
278 _osc.float_message ("/select/meter", 0, addr);
280 _osc.float_message ("/select/meter", -193, addr);
282 }else if (feedback[8]) {
283 _osc.float_message ("/select/meter", 0, addr);
285 _osc.float_message ("/select/pan_elevation_position", 0, addr);
286 _osc.float_message ("/select/pan_frontback_position", .5, addr);
287 _osc.float_message ("/select/pan_lfe_control", 0, addr);
288 _osc.float_message ("/select/comp_enable", 0, addr);
289 _osc.float_message ("/select/comp_threshold", 0, addr);
290 _osc.float_message ("/select/comp_speed", 0, addr);
291 _osc.float_message ("/select/comp_mode", 0, addr);
292 _osc.text_message ("/select/comp_mode_name", " ", addr);
293 _osc.text_message ("/select/comp_speed_name", " ", addr);
294 _osc.float_message ("/select/comp_makeup", 0, addr);
295 _osc.float_message ("/select/expand", 0.0, addr);
302 OSCSelectObserver::renew_sends () {
308 OSCSelectObserver::renew_plugin () {
314 OSCSelectObserver::send_init()
316 // we don't know how many there are, so find out.
321 if (_strip->send_level_controllable (nsends)) {
330 // paging should be done in osc.cc in case there is no feedback
332 if (send_page_size) {
333 send_size = send_page_size;
336 uint32_t max_page = (uint32_t)(nsends / send_size) + 1;
337 if (sur->send_page < 1) {
339 } else if ((uint32_t)sur->send_page > max_page) {
340 sur->send_page = max_page;
342 uint32_t page_start = ((sur->send_page - 1) * send_size);
343 uint32_t last_send = sur->send_page * send_size;
345 send_timeout.push_back (2);
347 _last_send.push_back (0.0);
349 for (uint32_t s = page_start; s < last_send; ++s, ++c) {
351 bool send_valid = false;
352 if (_strip->send_level_controllable (s)) {
353 _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());
354 send_timeout.push_back (2);
355 _last_send.push_back (0.0);
356 send_gain (c, _strip->send_level_controllable(s));
360 if (_strip->send_enable_controllable (s)) {
361 _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());
362 enable_message_with_id ("/select/send_enable", c, _strip->send_enable_controllable(s));
363 } else if (send_valid) {
364 boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route> (_strip);
366 // should never get here
367 _osc.float_message_with_id ("/select/send_enable", c, 0, in_line, addr);
369 boost::shared_ptr<Send> snd = boost::dynamic_pointer_cast<Send> (r->nth_send(s));
371 boost::shared_ptr<Processor> proc = boost::dynamic_pointer_cast<Processor> (snd);
372 proc->ActiveChanged.connect (send_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::send_enable, this, X_("/select/send_enable"), c, proc), OSC::instance());
373 _osc.float_message_with_id ("/select/send_enable", c, proc->enabled(), in_line, addr);
376 if (!gainmode && send_valid) {
377 _osc.text_message_with_id ("/select/send_name", c, _strip->send_name(s), in_line, addr);
383 OSCSelectObserver::plugin_init()
385 if (!sur->plugin_id || !sur->plugins.size ()) {
389 boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route>(_strip);
394 // we have a plugin number now get the processor
395 boost::shared_ptr<Processor> proc = r->nth_plugin (sur->plugins[sur->plugin_id - 1]);
396 boost::shared_ptr<PluginInsert> pi;
397 if (!(pi = boost::dynamic_pointer_cast<PluginInsert>(proc))) {
400 boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
403 nplug_params = sur->plug_params.size ();
405 // default of 0 page size means show all
406 plug_size = nplug_params;
407 if (sur->plug_page_size) {
408 plug_size = sur->plug_page_size;
410 _osc.text_message ("/select/plugin/name", pip->name(), addr);
411 uint32_t page_end = nplug_params;
412 uint32_t max_page = 1;
413 if (plug_size && nplug_params) {
414 max_page = (uint32_t)((nplug_params - 1) / plug_size) + 1;
417 if (sur->plug_page < 1) {
420 if ((uint32_t)sur->plug_page > max_page) {
421 sur->plug_page = max_page;
423 uint32_t page_start = ((sur->plug_page - 1) * plug_size);
424 page_end = sur->plug_page * plug_size;
427 for ( uint32_t ppi = page_start; ppi < page_end; ++ppi, ++pid) {
428 if (ppi >= nplug_params) {
429 _osc.text_message_with_id ("/select/plugin/parameter/name", pid, " ", in_line, addr);
430 _osc.float_message_with_id ("/select/plugin/parameter", pid, 0, in_line, addr);
434 uint32_t controlid = pip->nth_parameter(sur->plug_params[ppi], ok);
438 ParameterDescriptor pd;
439 pip->get_parameter_descriptor(controlid, pd);
440 _osc.text_message_with_id ("/select/plugin/parameter/name", pid, pd.label, in_line, addr);
441 if ( pip->parameter_is_input(controlid)) {
442 boost::shared_ptr<AutomationControl> c = pi->automation_control(Evoral::Parameter(PluginAutomation, 0, controlid));
445 if (pd.integer_step && pd.upper == 1) {
448 c->Changed.connect (plugin_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::plugin_parameter_changed, this, pid, swtch, c), OSC::instance());
449 plugin_parameter_changed (pid, swtch, c);
456 OSCSelectObserver::send_end ()
458 send_connections.drop_connections ();
459 for (uint32_t i = 1; i <= send_size; i++) {
461 _osc.float_message_with_id ("/select/send_fader", i, 0, in_line, addr);
463 _osc.float_message_with_id ("/select/send_gain", i, -193, in_line, addr);
466 _osc.float_message_with_id ("/select/send_enable", i, 0, in_line, addr);
468 _osc.text_message_with_id ("/select/send_name", i, " ", in_line, addr);
470 // need to delete or clear send_timeout
471 send_timeout.clear();
476 OSCSelectObserver::plugin_parameter_changed (int pid, bool swtch, boost::shared_ptr<PBD::Controllable> controllable)
479 enable_message_with_id ("/select/plugin/parameter", pid, controllable);
481 change_message_with_id ("/select/plugin/parameter", pid, controllable);
486 OSCSelectObserver::plugin_end ()
488 plugin_connections.drop_connections ();
489 _osc.text_message ("/select/plugin/name", " ", addr);
490 for (uint32_t i = 1; i <= plug_size; i++) {
491 _osc.float_message_with_id ("/select/plugin/parameter", i, 0, in_line, addr);
493 _osc.text_message_with_id ("/select/plugin/parameter/name", i, " ", in_line, addr);
499 OSCSelectObserver::tick ()
505 if (feedback[7] || feedback[8] || feedback[9]) { // meters enabled
507 if (_strip->peak_meter()) {
508 now_meter = _strip->peak_meter()->meter_level(0, MeterMCP);
512 if (now_meter < -144) now_meter = -193;
513 if (_last_meter != now_meter) {
514 if (feedback[7] || feedback[8]) {
515 string path = "/select/meter";
516 if (gainmode && feedback[7]) {
517 _osc.float_message (path, ((now_meter + 94) / 100), addr);
518 } else if ((!gainmode) && feedback[7]) {
519 _osc.float_message (path, now_meter, addr);
520 } else if (feedback[8]) {
521 uint32_t ledlvl = (uint32_t)(((now_meter + 54) / 3.75)-1);
522 uint16_t ledbits = ~(0xfff<<ledlvl);
523 _osc.float_message (path, ledbits, addr);
527 string path = "/select/signal";
529 if (now_meter < -40) {
534 _osc.float_message (path, signal, addr);
537 _last_meter = now_meter;
541 if (gain_timeout == 1) {
542 _osc.text_message ("/select/name", _strip->name(), addr);
547 if (as == ARDOUR::Play || as == ARDOUR::Touch) {
548 if(_last_gain != _strip->gain_control()->get_value()) {
549 _last_gain = _strip->gain_control()->get_value();
553 if (_strip->comp_redux_controllable() && _strip->comp_enable_controllable() && _strip->comp_enable_controllable()->get_value()) {
554 float new_value = _strip->comp_redux_controllable()->get_parameter();
555 if (_comp_redux != new_value) {
556 _osc.float_message ("/select/comp_redux", new_value, addr);
557 _comp_redux = new_value;
560 for (uint32_t i = 1; i <= send_timeout.size(); i++) {
561 if (send_timeout[i]) {
562 if (send_timeout[i] == 1) {
563 uint32_t pg_offset = (sur->send_page - 1) * send_page_size;
564 _osc.text_message_with_id ("/select/send_name", i, _strip->send_name(pg_offset + i - 1), in_line, addr);
573 OSCSelectObserver::name_changed (const PBD::PropertyChange& what_changed)
575 if (!what_changed.contains (ARDOUR::Properties::name)) {
583 _osc.text_message ("/select/name", _strip->name(), addr);
584 boost::shared_ptr<Route> route = boost::dynamic_pointer_cast<Route> (_strip);
586 //spit out the comment at the same time
587 _osc.text_message ("/select/comment", route->comment(), addr);
588 // lets tell the surface how many inputs this strip has
589 _osc.float_message ("/select/n_inputs", (float) route->n_inputs().n_total(), addr);
590 // lets tell the surface how many outputs this strip has
591 _osc.float_message ("/select/n_outputs", (float) route->n_outputs().n_total(), addr);
596 OSCSelectObserver::change_message (string path, boost::shared_ptr<Controllable> controllable)
598 float val = controllable->get_value();
600 _osc.float_message (path, (float) controllable->internal_to_interface (val), addr);
604 OSCSelectObserver::enable_message (string path, boost::shared_ptr<Controllable> controllable)
606 float val = controllable->get_value();
608 _osc.float_message (path, 1, addr);
610 _osc.float_message (path, 0, addr);
616 OSCSelectObserver::change_message_with_id (string path, uint32_t id, boost::shared_ptr<Controllable> controllable)
618 float val = controllable->get_value();
620 _osc.float_message_with_id (path, id, (float) controllable->internal_to_interface (val), in_line, addr);
624 OSCSelectObserver::enable_message_with_id (string path, uint32_t id, boost::shared_ptr<Controllable> controllable)
626 float val = controllable->get_value();
628 _osc.float_message_with_id (path, id, 1, in_line, addr);
630 _osc.float_message_with_id (path, id, 0, in_line, addr);
635 OSCSelectObserver::monitor_status (boost::shared_ptr<Controllable> controllable)
638 float val = controllable->get_value();
653 _osc.float_message ("/select/monitor_input", (float) input, addr);
654 _osc.float_message ("/select/monitor_disk", (float) disk, addr);
658 OSCSelectObserver::trim_message (string path, boost::shared_ptr<Controllable> controllable)
660 if (_last_trim != controllable->get_value()) {
661 _last_trim = controllable->get_value();
666 _osc.float_message (path, (float) accurate_coefficient_to_dB (controllable->get_value()), addr);
670 OSCSelectObserver::gain_message ()
672 float value = _strip->gain_control()->get_value();
673 if (_last_gain != value) {
680 _osc.text_message ("/select/name", string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (value)), addr);
682 _osc.float_message ("/select/fader", _strip->gain_control()->internal_to_interface (value), addr);
685 _osc.float_message ("/select/gain", -200, addr);
687 _osc.float_message ("/select/gain", accurate_coefficient_to_dB (value), addr);
693 OSCSelectObserver::gain_automation ()
696 as = _strip->gain_control()->alist()->automation_state();
701 auto_name = "Manual";
720 _osc.float_message ("/select/fader/automation", output, addr);
721 _osc.text_message ("/select/fader/automation_name", auto_name, addr);
723 _osc.float_message ("/select/gain/automation", output, addr);
724 _osc.text_message ("/select/gain/automation_name", auto_name, addr);
731 OSCSelectObserver::send_gain (uint32_t id, boost::shared_ptr<PBD::Controllable> controllable)
733 if (_last_send[id] != controllable->get_value()) {
734 _last_send[id] = controllable->get_value();
742 db = controllable->get_value();
744 if (controllable->get_value() < 1e-15) {
747 db = accurate_coefficient_to_dB (controllable->get_value());
752 path = "/select/send_fader";
753 value = controllable->internal_to_interface (controllable->get_value());
754 _osc.text_message_with_id ("/select/send_name" , id, string_compose ("%1%2%3", std::fixed, std::setprecision(2), db), in_line, addr);
755 if (send_timeout.size() > id) {
756 send_timeout[id] = 8;
759 path = "/select/send_gain";
763 _osc.float_message_with_id (path, id, value, in_line, addr);
767 OSCSelectObserver::send_enable (string path, uint32_t id, boost::shared_ptr<Processor> proc)
769 // with no delay value is wrong
772 _osc.float_message_with_id ("/select/send_enable", id, proc->enabled(), in_line, addr);
776 OSCSelectObserver::comp_mode ()
778 change_message ("/select/comp_mode", _strip->comp_mode_controllable());
779 _osc.text_message ("/select/comp_mode_name", _strip->comp_mode_name(_strip->comp_mode_controllable()->get_value()), addr);
780 _osc.text_message ("/select/comp_speed_name", _strip->comp_speed_name(_strip->comp_mode_controllable()->get_value()), addr);
784 OSCSelectObserver::eq_init()
786 // HPF and enable are special case, rest are in bands
787 if (_strip->filter_enable_controllable (true)) {
788 _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());
789 change_message ("/select/eq_hpf/enable", _strip->filter_enable_controllable(true));
792 if (_strip->filter_enable_controllable (false)) {
793 _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());
794 change_message ("/select/eq_lpf/enable", _strip->filter_enable_controllable(false));
797 if (_strip->filter_freq_controllable (true)) {
798 _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());
799 change_message ("/select/eq_hpf/freq", _strip->filter_freq_controllable(true));
802 if (_strip->filter_freq_controllable (false)) {
803 _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());
804 change_message ("/select/eq_lpf/freq", _strip->filter_freq_controllable(false));
807 if (_strip->filter_slope_controllable (true)) {
808 _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());
809 change_message ("/select/eq_hpf/slope", _strip->filter_slope_controllable(true));
812 if (_strip->filter_slope_controllable (false)) {
813 _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());
814 change_message ("/select/eq_lpf/slope", _strip->filter_slope_controllable(false));
817 if (_strip->eq_enable_controllable ()) {
818 _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());
819 enable_message ("/select/eq_enable", _strip->eq_enable_controllable());
822 eq_bands = _strip->eq_band_cnt ();
830 for (int i = 0; i < eq_bands; i++) {
831 if (_strip->eq_band_name(i).size()) {
832 _osc.text_message_with_id ("/select/eq_band_name", i + 1, _strip->eq_band_name (i), in_line, addr);
834 if (_strip->eq_gain_controllable (i)) {
835 _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());
836 change_message_with_id ("/select/eq_gain", i + 1, _strip->eq_gain_controllable(i));
838 if (_strip->eq_freq_controllable (i)) {
839 _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());
840 change_message_with_id ("/select/eq_freq", i + 1, _strip->eq_freq_controllable(i));
842 if (_strip->eq_q_controllable (i)) {
843 _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());
844 change_message_with_id ("/select/eq_q", i + 1, _strip->eq_q_controllable(i));
846 if (_strip->eq_shape_controllable (i)) {
847 _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());
848 change_message_with_id ("/select/eq_shape", i + 1, _strip->eq_shape_controllable(i));
854 OSCSelectObserver::eq_end ()
856 eq_connections.drop_connections ();
857 _osc.float_message ("/select/eq_hpf", 0, addr);
858 _osc.float_message ("/select/eq_enable", 0, addr);
860 for (int i = 1; i <= eq_bands; i++) {
861 _osc.text_message_with_id ("/select/eq_band_name", i, " ", in_line, addr);
862 _osc.float_message_with_id ("/select/eq_gain", i, 0, in_line, addr);
863 _osc.float_message_with_id ("/select/eq_freq", i, 0, in_line, addr);
864 _osc.float_message_with_id ("/select/eq_q", i, 0, in_line, addr);
865 _osc.float_message_with_id ("/select/eq_shape", i, 0, in_line, addr);
872 OSCSelectObserver::eq_restart(int x)