From 0d54bd75c7143b644cb09f81670291aaa2a7f8d6 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 30 Dec 2010 03:13:09 +0000 Subject: quantize conversion from L/R fraction to azimuth to 1 degree increments (given that humans have this as their rough perceptual limit) git-svn-id: svn://localhost/ardour2/branches/3.0@8380 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/panner.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'libs/ardour/ardour') diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 9d6a248de0..b07167862e 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -140,13 +140,23 @@ class BaseStereoPanner : public StreamPanner static double azimuth_to_lr_fract (double azi) { /* 180.0 degrees=> left => 0.0 */ /* 0.0 degrees => right => 1.0 */ - return 1.0 - (azi/180.0); + + /* humans can only distinguish 1 degree of arc between two positions, + so force azi back to an integral value before computing + */ + + return 1.0 - (rint(azi)/180.0); } static double lr_fract_to_azimuth (double fract) { /* fract = 0.0 => degrees = 180.0 => left */ /* fract = 1.0 => degrees = 0.0 => right */ - return 180.0 - (fract * 180.0); + + /* humans can only distinguish 1 degree of arc between two positions, + so force azi back to an integral value after computing + */ + + return rint (180.0 - (fract * 180.0)); } /* old school automation loading */ -- cgit v1.2.3