diff options
author | Len Ovens <len@ovenwerks.net> | 2017-05-11 20:46:16 -0700 |
---|---|---|
committer | Len Ovens <len@ovenwerks.net> | 2017-05-12 07:29:29 -0700 |
commit | 774ebc42e3d14f3b4ca318cf75124b9ac00e160e (patch) | |
tree | bbde5fb4ce832eb9c05bbb36abb26c9851b6bf6c /libs/surfaces | |
parent | eb3f50e15c9f9ed1880c59fecd6f8b3edcc05820 (diff) |
OSC: Create new surface struct for ALL incoming messages
Diffstat (limited to 'libs/surfaces')
-rw-r--r-- | libs/surfaces/osc/osc.cc | 22 | ||||
-rw-r--r-- | libs/surfaces/osc/osc.h | 10 |
2 files changed, 28 insertions, 4 deletions
diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 9d422eea6f..9f079e602f 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -874,6 +874,7 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_ } else if (!strncmp (path, "/access_action/", 15)) { + check_surface (msg); if (!(argc && !argv[0]->i)) { std::string action_path = path; @@ -883,6 +884,7 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_ ret = 0; } else if (strcmp (path, "/strip/listen") == 0) { + check_surface (msg); cerr << "set up listener\n"; @@ -914,6 +916,7 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_ } else if (strcmp (path, "/strip/ignore") == 0) { + check_surface (msg); for (int n = 0; n < argc; ++n) { @@ -1004,6 +1007,9 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_ int ssid = atoi (&path[17]); ret = sel_eq_shape (ssid, argv[0]->f, msg); } + if (ret) { + check_surface (msg); + } if ((ret && _debugmode != Off)) { debugmsg (_("Unhandled OSC message"), path, types, argv, argc); @@ -1393,6 +1399,16 @@ OSC::set_surface_gainmode (uint32_t gm, lo_message msg) return 0; } +int +OSC::check_surface (lo_message msg) +{ + if (!session) { + return -1; + } + get_surface(get_address (msg)); + return 0; +} + OSC::OSCSurface * OSC::get_surface (lo_address addr) { @@ -1707,6 +1723,7 @@ OSC::transport_frame (lo_message msg) if (!session) { return; } + check_surface (msg); framepos_t pos = session->transport_frame (); lo_message reply = lo_message_new (); @@ -1723,6 +1740,7 @@ OSC::transport_speed (lo_message msg) if (!session) { return; } + check_surface (msg); double ts = session->transport_speed (); lo_message reply = lo_message_new (); @@ -1739,6 +1757,7 @@ OSC::record_enabled (lo_message msg) if (!session) { return; } + check_surface (msg); int re = (int)session->get_record_enabled (); lo_message reply = lo_message_new (); @@ -1753,6 +1772,7 @@ int OSC::scrub (float delta, lo_message msg) { if (!session) return -1; + check_surface (msg); scrub_place = session->transport_frame (); @@ -1963,6 +1983,7 @@ int OSC::master_set_pan_stereo_position (float position, lo_message msg) { if (!session) return -1; + OSCSurface *sur = get_surface(get_address (msg)); float endposition = .5; boost::shared_ptr<Stripable> s = session->master_out(); @@ -1973,7 +1994,6 @@ OSC::master_set_pan_stereo_position (float position, lo_message msg) endposition = s->pan_azimuth_control()->internal_to_interface (s->pan_azimuth_control()->get_value ()); } } - OSCSurface *sur = get_surface(get_address (msg)); if (sur->feedback[4]) { lo_message reply = lo_message_new (); diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index eeadcf2c6c..902e0e73d6 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -217,6 +217,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest> std::string get_unix_server_url (); lo_address get_address (lo_message msg); OSCSurface * get_surface (lo_address addr); + int check_surface (lo_message msg); uint32_t get_sid (boost::shared_ptr<ARDOUR::Stripable> strip, lo_address addr); boost::shared_ptr<ARDOUR::Stripable> get_strip (uint32_t ssid, lo_address addr); void global_feedback (std::bitset<32> feedback, lo_address addr, uint32_t gainmode); @@ -285,8 +286,9 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest> static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \ return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \ } \ - int cb_ ## name (const char *path, const char *types, lo_arg ** argv, int argc, void *) { \ + int cb_ ## name (const char *path, const char *types, lo_arg ** argv, int argc, void *data) { \ OSC_DEBUG; \ + check_surface (data); \ if (argc > 0 && !strcmp (types, "f") && argv[0]->f != 1.0) { return 0; } \ name (); \ return 0; \ @@ -352,8 +354,9 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest> static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \ return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \ } \ - int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *) { \ + int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \ OSC_DEBUG; \ + check_surface (data); \ if (argc > 0) { \ name (optional argv[0]->type); \ } \ @@ -427,8 +430,9 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest> static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \ return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \ } \ - int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *) { \ + int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \ OSC_DEBUG; \ + check_surface (data); \ if (argc > 1) { \ name (argv[0]->arg1type, argv[1]->arg2type); \ } \ |