13
0

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
This commit is contained in:
Paul Davis 2010-12-30 03:13:09 +00:00
parent 3b079064e6
commit 0d54bd75c7

View File

@ -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 */