summaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-07-02 06:57:27 -0700
committerChris Robinson <[email protected]>2013-07-02 06:57:27 -0700
commit52096234e117273fba4b258d789a58580c56ba88 (patch)
treecefe47c1362c85a51a3cc46042c2c636295b578d /Alc
parent61c6a38f041ac5b7cf265eb718763d550119cf70 (diff)
Limit the source step to 10
This means the combination of the buffer frequency, source pitch, and doppler shift can't exceed 10x the device playback frequency. This is needed to keep the mixer from starving with a really high increment, causing small DstBufferSize values that require a lot of iterations.
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index dd7392fc..608db651 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -279,14 +279,9 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
ALbuffer *ALBuffer;
if((ALBuffer=BufferListItem->buffer) != NULL)
{
- ALsizei maxstep = BUFFERSIZE;
- maxstep -= ResamplerPadding[Resampler] +
- ResamplerPrePadding[Resampler] + 1;
- maxstep = mini(maxstep, INT_MAX>>FRACTIONBITS);
-
Pitch = Pitch * ALBuffer->Frequency / Frequency;
- if(Pitch > (ALfloat)maxstep)
- ALSource->Params.Step = maxstep<<FRACTIONBITS;
+ if(Pitch > 10.0f)
+ ALSource->Params.Step = 10<<FRACTIONBITS;
else
{
ALSource->Params.Step = fastf2i(Pitch*FRACTIONONE);
@@ -777,14 +772,9 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
{
/* Calculate fixed-point stepping value, based on the pitch, buffer
* frequency, and output frequency. */
- ALsizei maxstep = BUFFERSIZE;
- maxstep -= ResamplerPadding[Resampler] +
- ResamplerPrePadding[Resampler] + 1;
- maxstep = mini(maxstep, INT_MAX>>FRACTIONBITS);
-
Pitch = Pitch * ALBuffer->Frequency / Frequency;
- if(Pitch > (ALfloat)maxstep)
- ALSource->Params.Step = maxstep<<FRACTIONBITS;
+ if(Pitch > 10.0f)
+ ALSource->Params.Step = 10<<FRACTIONBITS;
else
{
ALSource->Params.Step = fastf2i(Pitch*FRACTIONONE);