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.
This commit is contained in:
Robin Gareus 2020-03-21 04:14:26 +01:00
parent 875f694380
commit 628d704d4e
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04

View file

@ -422,9 +422,8 @@ MonoPanner::on_motion_notify_event (GdkEventMotion* ev)
int w = get_width(); int w = get_width();
double delta = (ev->x - last_drag_x) / (double) w; double delta = (ev->x - last_drag_x) / (double) w;
/* create a detent close to the center */ /* create a detent close to the center, at approx 1/180 deg */
if (!detented && fabsf (position_control->get_value() - .5) < 0.006) {
if (!detented && ARDOUR::Panner::equivalent (position_control->get_value(), 0.5)) {
detented = true; detented = true;
/* snap to center */ /* snap to center */
position_control->set_value (0.5, Controllable::NoGroup); 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 ? */ /* have we pulled far enough to escape ? */
if (fabs (accumulated_delta) >= 0.025) { if (fabs (accumulated_delta) >= 0.048) {
position_control->set_value (position_control->get_value() + accumulated_delta, Controllable::NoGroup); position_control->set_value (position_control->get_value() + (accumulated_delta > 0 ? 0.006 : -0.006), Controllable::NoGroup);
detented = false; detented = false;
accumulated_delta = false; accumulated_delta = 0;
} }
} else { } else {
double pv = position_control->get_value(); // 0..1.0 ; 0 = left double pv = position_control->get_value(); // 0..1.0 ; 0 = left