From 2972de1047b36d3f31c2e85f6e29b7b52682878f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 6 May 2011 00:20:40 -0700 Subject: Use function pointers to call the source mixer --- OpenAL32/Include/alSource.h | 12 +++++++++++- OpenAL32/Include/alu.h | 2 ++ OpenAL32/alSource.c | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) (limited to 'OpenAL32') diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index ee342f92..1b9d92ad 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -112,11 +112,21 @@ typedef struct ALsource } Params; ALvoid (*Update)(struct ALsource *self, const ALCcontext *context); + ALvoid (*DoMix)(struct ALsource *self, ALCdevice *Device, + const ALvoid *RESTRICT data, + ALuint *DataPosInt, ALuint *DataPosFrac, + ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize); + ALvoid (*DoHrtfMix)(struct ALsource *self, ALCdevice *Device, + const ALvoid *RESTRICT data, + ALuint *DataPosInt, ALuint *DataPosFrac, + ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize); // Index to itself ALuint source; } ALsource; -#define ALsource_Update(s,a) ((s)->Update(s,a)) +#define ALsource_Update(s,a) ((s)->Update(s,a)) +#define ALsource_DoMix(s,a,b,c,d,e,f,g) ((s)->DoMix(s,a,b,c,d,e,f,g)) +#define ALsource_DoHrtfMix(s,a,b,c,d,e,f,g) ((s)->DoHrtfMix(s,a,b,c,d,e,f,g)) ALvoid ReleaseALSources(ALCcontext *Context); diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index cc47cc1b..41ad5f6b 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -111,6 +111,7 @@ static __inline ALdouble cubic(ALdouble val0, ALdouble val1, ALdouble val2, ALdo } struct ALsource; +struct ALbuffer; ALvoid aluInitPanning(ALCdevice *Device); ALint aluCart2LUTpos(ALfloat re, ALfloat im); @@ -118,6 +119,7 @@ ALint aluCart2LUTpos(ALfloat re, ALfloat im); ALvoid CalcSourceParams(struct ALsource *ALSource, const ALCcontext *ALContext); ALvoid CalcNonAttnSourceParams(struct ALsource *ALSource, const ALCcontext *ALContext); +ALvoid SelectMixer(struct ALsource *Source, struct ALbuffer *Buffer); ALvoid MixSource(struct ALsource *Source, ALCdevice *Device, ALuint SamplesToDo); ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size); diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index d6e9b18a..fd77527f 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -570,6 +570,7 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue) Source->Update = CalcSourceParams; else Source->Update = CalcNonAttnSourceParams; + SelectMixer(Source, buffer); // Increment reference counter for buffer buffer->refcount++; @@ -1614,6 +1615,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A Source->Update = CalcSourceParams; else Source->Update = CalcNonAttnSourceParams; + SelectMixer(Source, buffer); Source->NeedsUpdate = AL_TRUE; } -- cgit v1.2.3