From 1cb29ece08cc6b43bb4b93e71d7139fc1cf8c919 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 26 Nov 2010 01:21:46 -0800 Subject: [PATCH] Make a FRACTIONONE macro, and use it --- Alc/ALu.c | 8 ++++---- Alc/mixer.c | 16 ++++++++-------- OpenAL32/Include/alu.h | 3 ++- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Alc/ALu.c b/Alc/ALu.c index b7471132..9619f595 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -124,10 +124,10 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext) if(Pitch > (float)MAX_PITCH) ALSource->Params.Step = MAX_PITCH< 0.0f)) - ALSource->Params.Step = 1<Params.Step = FRACTIONONE; else { - ALSource->Params.Step = Pitch*(1<Params.Step = Pitch*FRACTIONONE; if(ALSource->Params.Step == 0) ALSource->Params.Step = 1; } @@ -596,10 +596,10 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) if(Pitch > (float)MAX_PITCH) ALSource->Params.Step = MAX_PITCH< 0.0f)) - ALSource->Params.Step = 1<Params.Step = FRACTIONONE; else { - ALSource->Params.Step = Pitch*(1<Params.Step = Pitch*FRACTIONONE; if(ALSource->Params.Step == 0) ALSource->Params.Step = 1; } diff --git a/Alc/mixer.c b/Alc/mixer.c index 74af356d..9fae065e 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -40,26 +40,26 @@ static __inline ALdouble point32(const ALfloat *vals, ALint step, ALint frac) { return vals[0]; (void)step; (void)frac; } static __inline ALdouble lerp32(const ALfloat *vals, ALint step, ALint frac) -{ return lerp(vals[0], vals[step], frac * (1.0/(1<queue; BuffersPlayed = Source->BuffersInQueue; @@ -864,7 +864,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) } SrcData += BUFFER_PREPADDING*FrameSize; - switch((increment != (1<Resampler : POINT_RESAMPLER) + switch((increment != FRACTIONONE) ? Source->Resampler : POINT_RESAMPLER) { case POINT_RESAMPLER: if(Bytes == 4) diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 4c05b733..05055bd1 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -78,7 +78,8 @@ typedef enum { #define BUFFERSIZE 8192 #define FRACTIONBITS (14) -#define FRACTIONMASK ((1<