summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorLen Ovens <len@ovenwerks.net>2016-07-06 19:28:41 -0700
committerLen Ovens <len@ovenwerks.net>2016-07-06 19:28:41 -0700
commitd40cc6f6f980686c4f1b0f3cd0126fe7ce80cf88 (patch)
tree9133708bc757c695625a656e094013d82afd361f /libs
parent44fcbd988ccb0f8dc8bdecc71bf8baf820e0bad4 (diff)
OSC: Make sure selected strip is corrected when it's stripable vanishes
Diffstat (limited to 'libs')
-rw-r--r--libs/surfaces/osc/osc.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc
index f9d4f7dc57..f13ade8eb4 100644
--- a/libs/surfaces/osc/osc.cc
+++ b/libs/surfaces/osc/osc.cc
@@ -1225,7 +1225,7 @@ OSC::get_surface (lo_address addr)
}
// if we do this when OSC is started we get the wrong stripable
// we don't need this until we actually have a surface to deal with
- if (!_select) {
+ if (!_select || (_select != ControlProtocol::first_selected_stripable())) {
gui_selection_changed();
}
@@ -1305,6 +1305,10 @@ OSC::recalcbanks ()
void
OSC::_recalcbanks ()
{
+ if (!_select || (_select != ControlProtocol::first_selected_stripable())) {
+ _select = ControlProtocol::first_selected_stripable();
+ }
+
// do a set_bank for each surface we know about.
for (uint32_t it = 0; it < _surface.size(); ++it) {
OSCSurface* sur = &_surface[it];
@@ -1347,7 +1351,7 @@ OSC::_set_bank (uint32_t bank_start, lo_address addr)
// revert any expand to select
s->expand = 0;
s->expand_enable = false;
- _strip_select (_select, addr);
+ _strip_select (ControlProtocol::first_selected_stripable(), addr);
// undo all listeners for this url
StripableList stripables;
@@ -1371,11 +1375,12 @@ OSC::_set_bank (uint32_t bank_start, lo_address addr)
b_size = s->bank_size;
}
- // Do limits checking - high end still not quite right
+ // Do limits checking
if (bank_start < 1) bank_start = 1;
if (b_size >= s->nstrips) {
bank_start = 1;
} else if (bank_start > ((s->nstrips - b_size) + 1)) {
+ // top bank is always filled if there are enough strips for at least one bank
bank_start = (uint32_t)((s->nstrips - b_size) + 1);
}
//save bank in case we have had to change it
@@ -1988,7 +1993,7 @@ OSC::strip_expand (int ssid, int yn, lo_message msg)
if (yn) {
s = get_strip (ssid, lo_message_get_source (msg));
} else {
- s = _select;
+ s = ControlProtocol::first_selected_stripable();
}
return _strip_select (s, lo_message_get_source (msg));
@@ -2098,7 +2103,7 @@ OSC::sel_expand (uint32_t state, lo_message msg)
if (state && sur->expand) {
s = get_strip (sur->expand, lo_message_get_source (msg));
} else {
- s = _select;
+ s = ControlProtocol::first_selected_stripable();
}
return _strip_select (s, lo_message_get_source (msg));