+void
+OSCRouteObserver::set_link_ready (uint32_t not_ready)
+{
+ if (not_ready) {
+ clear_strip ();
+ switch (ssid) {
+ case 1:
+ _osc.text_message_with_id ("/strip/name", ssid, "Device", in_line, addr);
+ break;
+ case 2:
+ _osc.text_message_with_id ("/strip/name", ssid, string_compose ("%1", not_ready), in_line, addr);
+ break;
+ case 3:
+ _osc.text_message_with_id ("/strip/name", ssid, "Missing", in_line, addr);
+ break;
+ case 4:
+ _osc.text_message_with_id ("/strip/name", ssid, "from", in_line, addr);
+ break;
+ case 5:
+ _osc.text_message_with_id ("/strip/name", ssid, "Linkset", in_line, addr);
+ break;
+ default:
+ break;
+ }
+ } else {
+ refresh_strip (_strip, true);
+ }
+}
+
+void
+OSCRouteObserver::clear_strip ()
+{
+ _init = true;
+
+ strip_connections.drop_connections ();
+
+ // all strip buttons should be off and faders 0 and etc.
+ _osc.float_message_with_id ("/strip/expand", ssid, 0, in_line, addr);
+ if (feedback[0]) { // buttons are separate feedback
+ _osc.text_message_with_id ("/strip/name", ssid, " ", in_line, addr);
+ _osc.float_message_with_id ("/strip/mute", ssid, 0, in_line, addr);
+ _osc.float_message_with_id ("/strip/solo", ssid, 0, in_line, addr);
+ _osc.float_message_with_id ("/strip/recenable", ssid, 0, in_line, addr);
+ _osc.float_message_with_id ("/strip/record_safe", ssid, 0, in_line, addr);
+ _osc.float_message_with_id ("/strip/monitor_input", ssid, 0, in_line, addr);
+ _osc.float_message_with_id ("/strip/monitor_disk", ssid, 0, in_line, addr);
+ _osc.float_message_with_id ("/strip/gui_select", ssid, 0, in_line, addr);
+ _osc.float_message_with_id ("/strip/select", ssid, 0, in_line, addr);
+ }
+ if (feedback[1]) { // level controls
+ if (gainmode) {
+ _osc.float_message_with_id ("/strip/fader", ssid, 0, in_line, addr);
+ } else {
+ _osc.float_message_with_id ("/strip/gain", ssid, -193, in_line, addr);
+ }
+ _osc.float_message_with_id ("/strip/trimdB", ssid, 0, in_line, addr);
+ _osc.float_message_with_id ("/strip/pan_stereo_position", ssid, 0.5, in_line, addr);
+ }
+ if (feedback[9]) {
+ _osc.float_message_with_id ("/strip/signal", ssid, 0, in_line, addr);
+ }
+ if (feedback[7]) {
+ if (gainmode) {
+ _osc.float_message_with_id ("/strip/meter", ssid, 0, in_line, addr);
+ } else {
+ _osc.float_message_with_id ("/strip/meter", ssid, -193, in_line, addr);
+ }
+ }else if (feedback[8]) {
+ _osc.float_message_with_id ("/strip/meter", ssid, 0, in_line, addr);
+ }
+}
+
+
+void
+OSCRouteObserver::tick ()
+{
+ if (_init) {
+ return;
+ }
+ _tick_busy = true;
+ if (feedback[7] || feedback[8] || feedback[9]) { // meters enabled
+ // the only meter here is master
+ float now_meter;
+ if (_strip->peak_meter()) {
+ now_meter = _strip->peak_meter()->meter_level(0, MeterMCP);
+ } else {
+ now_meter = -193;
+ }
+ if (now_meter < -120) now_meter = -193;
+ if (_last_meter != now_meter) {
+ if (feedback[7] || feedback[8]) {
+ if (gainmode && feedback[7]) {
+ _osc.float_message_with_id ("/strip/meter", ssid, ((now_meter + 94) / 100), in_line, addr);
+ } else if ((!gainmode) && feedback[7]) {
+ _osc.float_message_with_id ("/strip/meter", ssid, now_meter, in_line, addr);
+ } else if (feedback[8]) {
+ uint32_t ledlvl = (uint32_t)(((now_meter + 54) / 3.75)-1);
+ uint16_t ledbits = ~(0xfff<<ledlvl);
+ _osc.int_message_with_id ("/strip/meter", ssid, ledbits, in_line, addr);
+ }
+ }
+ if (feedback[9]) {
+ float signal;
+ if (now_meter < -40) {
+ signal = 0;
+ } else {
+ signal = 1;
+ }
+ _osc.float_message_with_id ("/strip/signal", ssid, signal, in_line, addr);
+ }
+ }
+ _last_meter = now_meter;
+
+ }
+ if (feedback[1]) {
+ if (gain_timeout) {
+ if (gain_timeout == 1) {
+ _osc.text_message_with_id ("/strip/name", ssid, _strip->name(), in_line, addr);
+ }
+ gain_timeout--;
+ }
+ if (trim_timeout) {
+ if (trim_timeout == 1) {
+ _osc.text_message_with_id ("/strip/name", ssid, _strip->name(), in_line, addr);
+ }
+ trim_timeout--;
+ }
+ if (as == ARDOUR::Play || as == ARDOUR::Touch) {
+ if(_last_gain != _strip->gain_control()->get_value()) {
+ _last_gain = _strip->gain_control()->get_value();
+ send_gain_message ();
+ }
+ }
+ }
+ _tick_busy = false;