diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-12-30 03:13:09 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-12-30 03:13:09 +0000 |
commit | 0d54bd75c7143b644cb09f81670291aaa2a7f8d6 (patch) | |
tree | b0bcb2459b753c9ac180742699e973f2bf72f1ae | |
parent | 3b079064e62facf91a35d2307709fc00feb0bb19 (diff) |
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
-rw-r--r-- | libs/ardour/ardour/panner.h | 14 |
1 files changed, 12 insertions, 2 deletions
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 */ |