From 69603bb76e897706d60647c121d8aeb5313f2858 Mon Sep 17 00:00:00 2001 From: Len Ovens Date: Fri, 10 Nov 2017 08:38:08 -0800 Subject: [PATCH] OSC link: make whole link set follow strip_types strip should not run periodic when blank - crash fix --- libs/surfaces/osc/osc.cc | 40 +++++++++++++++++++++++++ libs/surfaces/osc/osc.h | 1 + libs/surfaces/osc/osc_route_observer.cc | 1 - 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 74f4cec155..a7af9c1b10 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -1469,6 +1469,42 @@ OSC::set_link (uint32_t set, uint32_t id, lo_address addr) return 0; } +void +OSC::link_strip_types (uint32_t linkset, uint32_t striptypes) +{ + LinkSet *ls = 0; + + if (!linkset) { + return; + } + std::map::iterator it; + it = link_sets.find(linkset); + if (it == link_sets.end()) { + // this should never happen... but + return; + } + ls = &link_sets[linkset]; + ls->strip_types = striptypes; + for (uint32_t dv = 1; dv < ls->urls.size(); dv++) { + OSCSurface *su; + + if (ls->urls[dv] != "") { + string url = ls->urls[dv]; + su = get_surface (lo_address_new_from_url (url.c_str()), true); + if (su->linkset == linkset) { + su->strip_types = striptypes; + if (su->strip_types[10]) { + su->usegroup = PBD::Controllable::UseGroup; + } else { + su->usegroup = PBD::Controllable::NoGroup; + } + } else { + ls->urls[dv] = ""; + } + } + } +} + void OSC::surface_link_state (LinkSet * set) { @@ -1763,6 +1799,7 @@ OSC::set_surface (uint32_t b_size, uint32_t strips, uint32_t fb, uint32_t gm, ui s->plug_page_size = pi_size; if (s->linkset) { set_link (s->linkset, s->linkid, get_address (msg)); + link_strip_types (s->linkset, s->strip_types.to_ulong()); } else { // set bank and strip feedback strip_feedback(s, true); @@ -1805,6 +1842,9 @@ OSC::set_surface_strip_types (uint32_t st, lo_message msg) } else { s->usegroup = PBD::Controllable::NoGroup; } + if (s->linkset) { + link_strip_types (s->linkset, st); + } // set bank and strip feedback _set_bank (1, get_address (msg)); diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index 00e15074b7..c1ba89cca7 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -322,6 +322,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI int link_check (uint32_t linkset); int set_link (uint32_t set, uint32_t id, lo_address addr); void surface_link_state (LinkSet * set); + void link_strip_types (uint32_t linkset, uint32_t striptypes); #define OSC_DEBUG \ if (_debugmode == All) { \ diff --git a/libs/surfaces/osc/osc_route_observer.cc b/libs/surfaces/osc/osc_route_observer.cc index 48c5a24ec3..8438cb0c58 100644 --- a/libs/surfaces/osc/osc_route_observer.cc +++ b/libs/surfaces/osc/osc_route_observer.cc @@ -120,7 +120,6 @@ OSCRouteObserver::refresh_strip (boost::shared_ptr new_strip, if (!_strip) { // this strip is blank and should be cleared clear_strip (); - _init = false; return; } _strip->DropReferences.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::no_strip, this), OSC::instance());