From 628d704d4e4cff43dac497166412831eede6ef41 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 21 Mar 2020 04:14:26 +0100 Subject: [PATCH] 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. --- gtk2_ardour/mono_panner.cc | 11 +++++------ 1 file 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