summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorLen Ovens <len@ovenwerks.net>2017-12-15 09:43:03 -0800
committerLen Ovens <len@ovenwerks.net>2017-12-15 09:43:48 -0800
commit886244feeaa6de7dada852846e1f1166233adf1f (patch)
tree03a9fa0d571f6188f0a226ca1781e4a7c1212af8 /libs
parent559344d99d237ee5f9c8995919956446d32daade (diff)
OSC: Add Sorted or not to custom strip list
fix bug where processor_changed sometimes gets null address
Diffstat (limited to 'libs')
-rw-r--r--libs/surfaces/osc/osc.cc83
-rw-r--r--libs/surfaces/osc/osc.h10
2 files changed, 61 insertions, 32 deletions
diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc
index 80d45b0bc7..d186e5f367 100644
--- a/libs/surfaces/osc/osc.cc
+++ b/libs/surfaces/osc/osc.cc
@@ -415,7 +415,7 @@ OSC::register_callbacks()
REGISTER_CALLBACK (serv, "/refresh", "f", refresh_surface);
REGISTER_CALLBACK (serv, "/strip/list", "", routes_list);
REGISTER_CALLBACK (serv, "/strip/list", "f", routes_list);
- REGISTER_CALLBACK (serv, "/strip/custom/enable", "f", custom_enable);
+ REGISTER_CALLBACK (serv, "/strip/custom/mode", "f", custom_mode);
REGISTER_CALLBACK (serv, "/strip/custom/clear", "f", custom_clear);
REGISTER_CALLBACK (serv, "/strip/custom/clear", "", custom_clear);
REGISTER_CALLBACK (serv, "/surface/list", "", surface_list);
@@ -835,7 +835,7 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_
if (strcmp (path, "/strip/listen") == 0) {
if (argc <= 0) {
PBD::warning << "OSC: Wrong number of parameters." << endmsg;
- } else if (sur->custom_enable) {
+ } else if (sur->custom_mode) {
PBD::warning << "OSC: Can't add strips with custom enabled." << endmsg;
} else {
for (int n = 0; n < argc; ++n) {
@@ -851,7 +851,7 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_
if (strcmp (path, "/strip/ignore") == 0) {
if (argc <= 0) {
PBD::warning << "OSC: Wrong number of parameters." << endmsg;
- } else if (!sur->custom_enable) {
+ } else if (!sur->custom_mode) {
PBD::warning << "OSC: Can't remove strips without custom enabled." << endmsg;
} else {
for (int n = 0; n < argc; ++n) {
@@ -1251,7 +1251,7 @@ OSC::surface_list (lo_message msg)
OSCSurface* sur = &_surface[it];
cerr << string_compose (" Surface: %1 URL: %2\n", it, sur->remote_url);
cerr << string_compose (" Number of strips: %1 Bank size: %2 Current Bank %3\n", sur->nstrips, sur->bank_size, sur->bank);
- cerr << string_compose (" Use Custom: %1 Custom Strips: %2\n", sur->custom_enable, sur->custom_strips.size ());
+ cerr << string_compose (" Use Custom: %1 Custom Strips: %2\n", sur->custom_mode, sur->custom_strips.size ());
bool ug = false;
if (sur->usegroup == PBD::Controllable::UseGroup) {
ug = true;
@@ -1290,7 +1290,7 @@ OSC::custom_clear (lo_message msg)
return 0;
}
OSCSurface *sur = get_surface(get_address (msg), true);
- sur->custom_enable = false;
+ sur->custom_mode = 0;
sur->custom_strips.clear ();
sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, false, sur->custom_strips);
sur->nstrips = sur->strips.size();
@@ -1298,7 +1298,7 @@ OSC::custom_clear (lo_message msg)
}
int
-OSC::custom_enable (float state, lo_message msg)
+OSC::custom_mode (float state, lo_message msg)
{
if (!session) {
return 0;
@@ -1307,17 +1307,21 @@ OSC::custom_enable (float state, lo_message msg)
if (state > 0){
if (sur->custom_strips.size () == 0) {
PBD::warning << "No custom strips set to enable" << endmsg;
- sur->custom_enable = false;
+ sur->custom_mode = 0;
return -1;
} else {
- sur->custom_enable = true;
- sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, true, sur->custom_strips);
+ if (sur->bank_size) {
+ sur->custom_mode = (uint32_t) state | 0x4;
+ } else {
+ sur->custom_mode = (uint32_t) state;
+ }
+ sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, sur->custom_mode, sur->custom_strips);
sur->nstrips = sur->custom_strips.size();
return set_bank (1, msg);
}
} else {
- sur->custom_enable = false;
- sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, false, sur->custom_strips);
+ sur->custom_mode = 0;
+ sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, 0, sur->custom_strips);
sur->nstrips = sur->strips.size();
return set_bank (1, msg);
}
@@ -1812,6 +1816,9 @@ OSC::set_surface (uint32_t b_size, uint32_t strips, uint32_t fb, uint32_t gm, ui
}
OSCSurface *s = get_surface(get_address (msg), true);
s->bank_size = b_size;
+ if (s->custom_mode && b_size) {
+ s->custom_mode = s->custom_mode | 0x4;
+ }
s->strip_types = strips;
s->feedback = fb;
s->gainmode = gm;
@@ -1845,6 +1852,9 @@ OSC::set_surface_bank_size (uint32_t bs, lo_message msg)
}
OSCSurface *s = get_surface(get_address (msg), true);
s->bank_size = bs;
+ if (s->custom_mode && bs) {
+ s->custom_mode = s->custom_mode | 0x4;
+ }
if (s->linkset) {
set_link (s->linkset, s->linkid, get_address (msg));
} else {
@@ -1955,7 +1965,7 @@ OSC::get_surface (lo_address addr , bool quiet)
s.gainmode = default_gainmode;
s.usegroup = PBD::Controllable::NoGroup;
s.custom_strips.clear ();
- s.custom_enable = false;
+ s.custom_mode = 0;
s.sel_obs = 0;
s.expand = 0;
s.expand_enable = false;
@@ -2001,9 +2011,9 @@ void
OSC::strip_feedback (OSCSurface* sur, bool new_bank_size)
{
if (sur->custom_strips.size () == 0) {
- sur->custom_enable = false;
+ sur->custom_mode = 0;
}
- sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, sur->custom_enable, sur->custom_strips);
+ sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, sur->custom_mode, sur->custom_strips);
sur->nstrips = sur->strips.size();
if (new_bank_size || (!sur->feedback[0] && !sur->feedback[1])) {
// delete old observers
@@ -3695,11 +3705,11 @@ OSC::_strip_select (boost::shared_ptr<Stripable> s, lo_address addr)
sur->sel_obs = 0;
}
}
-
// need to set monitor for processor changed signal (for paging)
+ string address = lo_address_get_url (addr);
boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route>(s);
if (r) {
- r->processors_changed.connect (sur->proc_connection, MISSING_INVALIDATOR, boost::bind (&OSC::processor_changed, this, addr), this);
+ r->processors_changed.connect (sur->proc_connection, MISSING_INVALIDATOR, boost::bind (&OSC::processor_changed, this, address), this);
_sel_plugin (sur->plugin_id, addr);
}
@@ -3707,8 +3717,9 @@ OSC::_strip_select (boost::shared_ptr<Stripable> s, lo_address addr)
}
void
-OSC::processor_changed (lo_address addr)
+OSC::processor_changed (string address)
{
+ lo_address addr = lo_address_new_from_url (address.c_str());
OSCSurface *sur = get_surface (addr);
_sel_plugin (sur->plugin_id, addr);
if (sur->sel_obs) {
@@ -5307,16 +5318,17 @@ struct StripableByPresentationOrder
};
OSC::Sorted
-OSC::get_sorted_stripables(std::bitset<32> types, bool cue, bool custom, Sorted my_list)
+OSC::get_sorted_stripables(std::bitset<32> types, bool cue, uint32_t custom, Sorted my_list)
{
Sorted sorted;
StripableList stripables;
+ StripableList custom_list;
// fetch all stripables
session->get_stripables (stripables);
-
if (custom) {
uint32_t nstps = my_list.size ();
+ // check each custom strip to see if it still exists
boost::shared_ptr<Stripable> s;
for (uint32_t i = 0; i < nstps; i++) {
bool exists = false;
@@ -5330,14 +5342,27 @@ OSC::get_sorted_stripables(std::bitset<32> types, bool cue, bool custom, Sorted
}
if(!exists) {
my_list[i] = boost::shared_ptr<Stripable>();
+ } else {
+ custom_list.push_back (s);
}
}
- return my_list;
+ if (custom == 1) {
+ return my_list;
+ } else {
+ stripables = custom_list;
+ }
}
// Look for stripables that match bit in sur->strip_types
for (StripableList::iterator it = stripables.begin(); it != stripables.end(); ++it) {
boost::shared_ptr<Stripable> s = *it;
+ if (!s) {
+ break;
+ }
+ if (custom == 2) {
+ // banking off use all valid custom strips
+ sorted.push_back (s);
+ } else
if ((!cue) && (!types[9]) && (s->presentation_info().flags() & PresentationInfo::Hidden)) {
// do nothing... skip it
} else if (types[8] && (s->is_selected())) {
@@ -5385,14 +5410,18 @@ OSC::get_sorted_stripables(std::bitset<32> types, bool cue, bool custom, Sorted
}
}
}
- sort (sorted.begin(), sorted.end(), StripableByPresentationOrder());
- // Master/Monitor might be anywhere... we put them at the end - Sorry ;)
- if (types[5]) {
- sorted.push_back (session->master_out());
+ if (!custom || (custom & 0x2)) {
+ sort (sorted.begin(), sorted.end(), StripableByPresentationOrder());
}
- if (types[6]) {
- if (session->monitor_out()) {
- sorted.push_back (session->monitor_out());
+ if (!custom) {
+ // Master/Monitor might be anywhere... we put them at the end - Sorry ;)
+ if (types[5]) {
+ sorted.push_back (session->master_out());
+ }
+ if (types[6]) {
+ if (session->monitor_out()) {
+ sorted.push_back (session->monitor_out());
+ }
}
}
return sorted;
diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h
index 34d024f4cf..b63b667fda 100644
--- a/libs/surfaces/osc/osc.h
+++ b/libs/surfaces/osc/osc.h
@@ -118,7 +118,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
};
typedef std::vector<boost::shared_ptr<ARDOUR::Stripable> > Sorted;
- Sorted get_sorted_stripables(std::bitset<32> types, bool cue, bool custom, Sorted my_list);
+ Sorted get_sorted_stripables(std::bitset<32> types, bool cue, uint32_t custom, Sorted my_list);
typedef std::map<boost::shared_ptr<ARDOUR::AutomationControl>, uint32_t> FakeTouchMap;
FakeTouchMap _touch_timeout;
@@ -135,7 +135,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
int gainmode; // what kind of faders do we have Gain db or position 0 to 1?
PBD::Controllable::GroupControlDisposition usegroup; // current group disposition
Sorted custom_strips; // a sorted list of user selected strips
- int custom_enable; // use custom strip list
+ uint32_t custom_mode; // use custom strip list
Sorted strips; // list of stripables for this surface
// strips
uint32_t bank; // current bank
@@ -511,7 +511,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
PATH_CALLBACK1_MSG(sel_eq_lpf_enable,f);
PATH_CALLBACK1_MSG(sel_eq_lpf_slope,f);
PATH_CALLBACK1_MSG(sel_expand,i);
- PATH_CALLBACK1_MSG(custom_enable,f);
+ PATH_CALLBACK1_MSG(custom_mode,f);
#define PATH_CALLBACK2(name,arg1type,arg2type) \
static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
@@ -660,7 +660,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
int set_surface_gainmode (uint32_t gm, lo_message msg);
int refresh_surface (lo_message msg);
int custom_clear (lo_message msg);
- int custom_enable (float state, lo_message msg);
+ int custom_mode (float state, lo_message msg);
// select
int sel_send_pagesize (uint32_t size, lo_message msg);
int sel_send_page (int page, lo_message msg);
@@ -670,7 +670,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
int _sel_plugin (int id, lo_address addr);
int sel_plugin_activate (float state, lo_message msg);
int select_plugin_parameter (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg);
- void processor_changed (lo_address addr);
+ void processor_changed (std::string remote_url);
int scrub (float delta, lo_message msg);
int jog (float delta, lo_message msg);