diff options
author | Robin Gareus <robin@gareus.org> | 2020-03-21 04:14:26 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-03-21 19:46:38 +0100 |
commit | 628d704d4e4cff43dac497166412831eede6ef41 (patch) | |
tree | dcf2dd970fc2516a032a3bdb45b788b777ced395 /gtk2_ardour/mono_panner.cc | |
parent | 875f6943802dbd8d38eab67641bebcaa74ec670b (diff) |
Panner GUI: fix detent in center
Previously the dead-zone was too small (1/360). The mono/balance
panner GUI has a throw of 180 deg L<>R.
Also snapping to center didn't allow to smoothly move out of the
center. The accumulated_delta as directly applied. This caused
jumps by 4.5. degrees.
This commit reduces the deadzone to 1 degree of the azimuth
around the center.
Diffstat (limited to 'gtk2_ardour/mono_panner.cc')
-rw-r--r-- | gtk2_ardour/mono_panner.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/gtk2_ardour/mono_panner.cc b/gtk2_ardour/mono_panner.cc index 7a1c77b5f0..e7b959fe44 100644 --- a/gtk2_ardour/mono_panner.cc +++ b/gtk2_ardour/mono_panner.cc @@ -422,9 +422,8 @@ MonoPanner::on_motion_notify_event (GdkEventMotion* ev) int w = get_width(); double delta = (ev->x - last_drag_x) / (double) w; - /* create a detent close to the center */ - - if (!detented && ARDOUR::Panner::equivalent (position_control->get_value(), 0.5)) { + /* create a detent close to the center, at approx 1/180 deg */ + if (!detented && fabsf (position_control->get_value() - .5) < 0.006) { detented = true; /* snap to center */ position_control->set_value (0.5, Controllable::NoGroup); @@ -435,10 +434,10 @@ MonoPanner::on_motion_notify_event (GdkEventMotion* ev) /* have we pulled far enough to escape ? */ - if (fabs (accumulated_delta) >= 0.025) { - position_control->set_value (position_control->get_value() + accumulated_delta, Controllable::NoGroup); + if (fabs (accumulated_delta) >= 0.048) { + position_control->set_value (position_control->get_value() + (accumulated_delta > 0 ? 0.006 : -0.006), Controllable::NoGroup); detented = false; - accumulated_delta = false; + accumulated_delta = 0; } } else { double pv = position_control->get_value(); // 0..1.0 ; 0 = left |