13
0

stereo-panner: clamp width during processing to valid range

This commit is contained in:
Robin Gareus 2014-01-15 14:07:02 +01:00
parent ab838a1260
commit c8f9405386

View File

@ -165,6 +165,11 @@ Panner2in2out::update ()
double width = this->width ();
const double direction_as_lr_fract = position ();
double const wrange = min (position(), (1 - position())) * 2;
if (fabs(width) > wrange) {
width = (width > 0 ? wrange : -wrange);
}
if (width < 0.0) {
width = -width;
pos[0] = direction_as_lr_fract + (width/2.0); // left signal lr_fract
@ -428,6 +433,8 @@ Panner2in2out::distribute_one_automated (AudioBuffer& srcbuf, BufferSet& obufs,
panR = position[n] + (width[n]/2.0f); // center - width/2
}
panR = max(0.f, min(1.f, panR));
const float panL = 1 - panR;
/* note that are overwriting buffers, but its OK