diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-01-31 21:52:14 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-01-31 21:52:14 -0500 |
commit | 27b565d5ccef3c79737a6aa717ccafc4959bac5d (patch) | |
tree | 14aa43e779469cd12c0ef4ff6f1eb6de4be99990 /libs | |
parent | dd40138d38615a42716e0abab9d69505c1bd6ff5 (diff) |
mackie: make vselect events and pot events handle toggle/enumeration controls correctly (or more correctly
Diffstat (limited to 'libs')
-rw-r--r-- | libs/surfaces/mackie/strip.cc | 61 |
1 files changed, 53 insertions, 8 deletions
diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index cc36224fd6..1d8e87555d 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -802,12 +802,26 @@ Strip::vselect_event (Button&, ButtonState bs) if (control->toggled()) { if (control->toggled()) { - control->set_value (!control->get_value(), Controllable::NoGroup); + control->set_value (!control->get_value(), Controllable::UseGroup); + } + + } else if (control->desc().enumeration || control->desc().integer_step) { + + double val = control->get_value (); + if (val <= control->upper() - 1.0) { + control->set_value (val + 1.0, Controllable::UseGroup); + } else { + control->set_value (control->lower(), Controllable::UseGroup); } } + } else { - /* Send mode: press enables/disables the relevant send */ + /* Send mode: press enables/disables the relevant + * send, but the vpot is bound to the send-level so we + * need to lookup the enable/disable control + * explicitly. + */ boost::shared_ptr<Route> r = _surface->mcp().subview_route(); @@ -1123,12 +1137,43 @@ Strip::handle_pot (Pot& pot, float delta) if (!ac) { return; } - double p = pot.get_value (); - p += delta; - // fader and pot should be the same and fader is hard coded 0 -> 1 - p = max (0.0, p); - p = min (1.0, p); - pot.set_value (p); + + if (ac->toggled()) { + + /* make it like a single-step, directional switch */ + + if (delta > 0) { + pot.set_value (1.0); + } else { + pot.set_value (0.0); + } + + } else if (ac->desc().enumeration || ac->desc().integer_step) { + + /* use Controllable::get_value() to avoid the + * "scaling-to-interface" that takes place in + * Control::get_value() via the pot member. + * + * an enumeration with 4 values will have interface values of + * 0.0, 0.25, 0.5 and 0.75 or some similar oddness. Lets not + * deal with that. + */ + + if (delta > 0) { + ac->set_value (min (ac->upper(), ac->get_value() + 1.0), Controllable::UseGroup); + } else { + ac->set_value (max (ac->lower(), ac->get_value() - 1.0), Controllable::UseGroup); + } + + } else { + + double p = pot.get_value (); + p += delta; + // fader and pot should be the same and fader is hard coded 0 -> 1 + p = max (0.0, p); + p = min (1.0, p); + pot.set_value (p); + } } void |