OSC: add option to send /reply instead of #reply (OSC1.0 compat)
authorLen Ovens <len@ovenwerks.net>
Sat, 10 Jun 2017 14:28:15 +0000 (07:28 -0700)
committerLen Ovens <len@ovenwerks.net>
Sat, 10 Jun 2017 16:43:46 +0000 (09:43 -0700)
libs/surfaces/osc/osc.cc
libs/surfaces/osc/osc.h
libs/surfaces/osc/osc_gui.cc
libs/surfaces/osc/osc_gui.h

index 72d8010c3ffce6c332f96d32bc37e4cef32a5fb2..4b554e6f2b421ee7b257f2e8c04dab8990ef1c5a 100644 (file)
@@ -846,8 +846,13 @@ OSC::send_current_value (const char* path, lo_arg** argv, int argc, lo_message m
                        }
                }
        }
+       OSCSurface *sur = get_surface(get_address (msg));
 
-       lo_send_message (get_address (msg), "#reply", reply);
+       if (sur->feedback[14]) {
+               lo_send_message (get_address (msg), "/reply", reply);
+       } else {
+               lo_send_message (get_address (msg), "#reply", reply);
+       }
        lo_message_free (reply);
 }
 
@@ -869,6 +874,7 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_
        /* 15 for /#current_value plus 2 for /<path> */
 
        len = strlen (path);
+       OSCSurface *sur = get_surface(get_address (msg));
 
        if (strstr (path, "/automation")) {
                ret = set_automation (path, types, argv, argc, msg);
@@ -924,7 +930,11 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_
                        }
                }
 
-               lo_send_message (get_address (msg), "#reply", reply);
+               if (sur->feedback[14]) {
+                       lo_send_message (get_address (msg), "/reply", reply);
+               } else {
+                       lo_send_message (get_address (msg), "#reply", reply);
+               }
                lo_message_free (reply);
 
                ret = 0;
@@ -1239,7 +1249,11 @@ OSC::routes_list (lo_message msg)
                        //Automatically listen to stripables listed
                        listen_to_route(s, get_address (msg));
 
-                       lo_send_message (get_address (msg), "#reply", reply);
+                       if (sur->feedback[14]) {
+                               lo_send_message (get_address (msg), "/reply", reply);
+                       } else {
+                               lo_send_message (get_address (msg), "#reply", reply);
+                       }
                        lo_message_free (reply);
                }
        }
@@ -1257,7 +1271,11 @@ OSC::routes_list (lo_message msg)
                lo_message_add_int32 (reply, 0);
        }
 
-       lo_send_message (get_address (msg), "#reply", reply);
+       if (sur->feedback[14]) {
+               lo_send_message (get_address (msg), "/reply", reply);
+       } else {
+               lo_send_message (get_address (msg), "#reply", reply);
+       }
 
        lo_message_free (reply);
 }
index 5bb55113c0597484b61a150586e1d0c6ba624303..0f9cbeba7b02889476e17eec864d63134df1a742 100644 (file)
@@ -154,6 +154,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
                 * [11] - Send Playhead position as minutes seconds
                 * [12] - Send Playhead position like primary/secondary GUI clocks
                 * [13] - Send well known feedback (for /select/command
+                * [14] - use OSC 1.0 only (#reply -> /reply)
                 */
 
 
index a898cf74bed44490e2c24000fedd5fe35cc54bb1..b61dd35e990ae4fa11dd5c49f1fcab39691df948 100644 (file)
@@ -363,6 +363,12 @@ OSC_GUI::OSC_GUI (OSC& p)
        fbtable->attach (select_fb, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
        ++fn;
 
+       label = manage (new Gtk::Label(_("Use /reply instead of #reply:")));
+       label->set_alignment(1, .5);
+       fbtable->attach (*label, 0, 1, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
+       fbtable->attach (use_osc10, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
+       ++fn;
+
        fbtable->show_all ();
        append_page (*fbtable, _("Default Feedback"));
        // set strips and feedback from loaded default values
@@ -392,6 +398,7 @@ OSC_GUI::OSC_GUI (OSC& p)
        hp_min_sec.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::set_bitsets));
        hp_gui.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::set_bitsets));
        select_fb.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::set_bitsets));
+       use_osc10.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::set_bitsets));
        preset_busy = false;
 
 }
@@ -599,6 +606,7 @@ OSC_GUI::reshow_values ()
        hp_min_sec.set_active (def_feedback & 2048);
        //hp_gui.set_active (false); // we don't have this yet (Mixbus wants)
        select_fb.set_active(def_feedback & 8192);
+       use_osc10.set_active(def_feedback & 16384);
 
        calculate_strip_types ();
        calculate_feedback ();
@@ -650,6 +658,9 @@ OSC_GUI::calculate_feedback ()
        if (select_fb.get_active()) {
                fbvalue += 8192;
        }
+       if (use_osc10.get_active()) {
+               fbvalue += 16384;
+       }
 
        current_feedback.set_text(string_compose("%1", fbvalue));
 }
index ae3640c1eea8e56315dc77004c5af92fb80e1aac..3e651b70fc2b26ac36305df14a1aa7544d00f681 100644 (file)
@@ -106,6 +106,7 @@ private:
        Gtk::CheckButton hp_min_sec;
        Gtk::CheckButton hp_gui;
        Gtk::CheckButton select_fb;
+       Gtk::CheckButton use_osc10;
        int fbvalue;
        void set_bitsets ();