diff options
-rw-r--r-- | Alc/ALu.c | 6 | ||||
-rw-r--r-- | Alc/mixer.c | 4 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 24 |
3 files changed, 16 insertions, 18 deletions
@@ -151,8 +151,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext) ALbuffer *ALBuffer; if((ALBuffer=BufferListItem->buffer) != NULL) { - ALsizei maxstep = STACK_DATA_SIZE/sizeof(ALfloat) / - ALSource->NumChannels; + ALsizei maxstep = BUFFERSIZE / ALSource->NumChannels; maxstep -= ResamplerPadding[Resampler] + ResamplerPrePadding[Resampler] + 1; maxstep = mini(maxstep, INT_MAX>>FRACTIONBITS); @@ -645,8 +644,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) { /* Calculate fixed-point stepping value, based on the pitch, buffer * frequency, and output frequency. */ - ALsizei maxstep = STACK_DATA_SIZE/sizeof(ALfloat) / - ALSource->NumChannels; + ALsizei maxstep = BUFFERSIZE / ALSource->NumChannels; maxstep -= ResamplerPadding[Resampler] + ResamplerPrePadding[Resampler] + 1; maxstep = mini(maxstep, INT_MAX>>FRACTIONBITS); diff --git a/Alc/mixer.c b/Alc/mixer.c index affe4a80..d6686402 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -226,7 +226,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) do { const ALuint BufferPrePadding = ResamplerPrePadding[Resampler]; const ALuint BufferPadding = ResamplerPadding[Resampler]; - ALfloat StackData[STACK_DATA_SIZE/sizeof(ALfloat)]; + ALfloat StackData[BUFFERSIZE]; ALfloat *SrcData = StackData; ALuint SrcDataSize = 0; ALuint BufferSize; @@ -239,7 +239,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) DataSize64 += BufferPadding+BufferPrePadding; DataSize64 *= NumChannels; - BufferSize = (ALuint)mini64(DataSize64, STACK_DATA_SIZE/sizeof(ALfloat)); + BufferSize = (ALuint)mini64(DataSize64, BUFFERSIZE); BufferSize /= NumChannels; if(Source->SourceType == AL_STATIC) diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 7402fa0e..85d44221 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -154,25 +154,25 @@ enum DistanceModel { DefaultDistanceModel = InverseDistanceClamped }; -#define BUFFERSIZE 4096 - -#define FRACTIONBITS (14) -#define FRACTIONONE (1<<FRACTIONBITS) -#define FRACTIONMASK (FRACTIONONE-1) -/* Size for temporary stack storage of buffer data. Must be a multiple of the - * size of ALfloat, ie, 4. Larger values need more stack, while smaller values - * may need more iterations. The value needs to be a sensible size, however, as - * it constrains the max stepping value used for mixing. +/* Size for temporary storage of buffer data, in ALfloats. Larger values need + * more stack, while smaller values may need more iterations. The value needs + * to be a sensible size, however, as it constrains the max stepping value used + * for mixing, as well as the maximum number of samples per mixing iteration. * The mixer requires being able to do two samplings per mixing loop. A 16KB * buffer can hold 512 sample frames for a 7.1 float buffer. With the cubic * resampler (which requires 3 padding sample frames), this limits the maximum * step to about 508. This means that buffer_freq*source_pitch cannot exceed - * device_freq*508 for an 8-channel 32-bit buffer. */ -#ifndef STACK_DATA_SIZE -#define STACK_DATA_SIZE 16384 + * device_freq*508 for an 8-channel 32-bit buffer. + */ +#ifndef BUFFERSIZE +#define BUFFERSIZE 4096 #endif +#define FRACTIONBITS (14) +#define FRACTIONONE (1<<FRACTIONBITS) +#define FRACTIONMASK (FRACTIONONE-1) + static __inline ALfloat minf(ALfloat a, ALfloat b) { return ((a > b) ? b : a); } |