mirror of https://github.com/PCSX2/pcsx2.git
spu2-x: stretcher: dampen the tempo adjustment to reduce resonance
I don't have a fully scientific explanation here, but it seems that with big buffers (~200ms and up), the stretcher adjustment can overshoot the target equilibrium back and forth, in effect never stabilizing. This commit makes it change slightly slower which somehow seems to improve its behavior. Sorry for not having a better explanation, as at this stage tuning the stretcher has become somewhat of a black magic. But hey, if it works... Tested with buffers from 30ms to 1000ms, and with playback speed and speed changes between 30% and 500%, and as far as I can tell it only makes it better. Fingers crossed.
This commit is contained in:
parent
3fc9643460
commit
22c9d882a8
|
@ -197,6 +197,13 @@ void SndBuffer::UpdateTempoChangeSoundTouch2()
|
|||
float tempoAdjust=bufferFullness/dynamicTargetFullness;
|
||||
float avgerage = addToAvg(tempoAdjust);
|
||||
tempoAdjust = avgerage;
|
||||
|
||||
// Dampen the adjustment to avoid overshoots (this means the average will compensate to the other side).
|
||||
// This is different than simply bigger averaging window since bigger window also has bigger "momentum",
|
||||
// so it's slower to slow down when it gets close to the equilibrium state and can therefore resonate.
|
||||
// The dampening (sqrt was chosen for no very good reason) manages to mostly prevent that.
|
||||
tempoAdjust = sqrt(tempoAdjust);
|
||||
|
||||
tempoAdjust = GetClamped( tempoAdjust, 0.05f, 10.0f);
|
||||
|
||||
if (tempoAdjust < 1)
|
||||
|
|
Loading…
Reference in New Issue