diff options
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 48 | ||||
-rw-r--r-- | OpenAL32/alBuffer.c | 17 | ||||
-rw-r--r-- | OpenAL32/alFilter.c | 22 | ||||
-rw-r--r-- | OpenAL32/alListener.c | 80 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 270 |
5 files changed, 240 insertions, 197 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 9d25ce23..6fba29ee 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -244,6 +244,14 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum para { ALCcontext *Context; + switch(param) + { + case AL_EFFECTSLOT_EFFECT: + case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: + alAuxiliaryEffectSloti(effectslot, param, piValues[0]); + return; + } + Context = GetContextSuspended(); if(!Context) return; @@ -251,11 +259,6 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum para { switch(param) { - case AL_EFFECTSLOT_EFFECT: - case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: - alAuxiliaryEffectSloti(effectslot, param, piValues[0]); - break; - default: alSetError(Context, AL_INVALID_ENUM); break; @@ -301,6 +304,13 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum para { ALCcontext *Context; + switch(param) + { + case AL_EFFECTSLOT_GAIN: + alAuxiliaryEffectSlotf(effectslot, param, pflValues[0]); + return; + } + Context = GetContextSuspended(); if(!Context) return; @@ -308,10 +318,6 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum para { switch(param) { - case AL_EFFECTSLOT_GAIN: - alAuxiliaryEffectSlotf(effectslot, param, pflValues[0]); - break; - default: alSetError(Context, AL_INVALID_ENUM); break; @@ -358,6 +364,14 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum p { ALCcontext *Context; + switch(param) + { + case AL_EFFECTSLOT_EFFECT: + case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: + alGetAuxiliaryEffectSloti(effectslot, param, piValues); + return; + } + Context = GetContextSuspended(); if(!Context) return; @@ -365,11 +379,6 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum p { switch(param) { - case AL_EFFECTSLOT_EFFECT: - case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: - alGetAuxiliaryEffectSloti(effectslot, param, piValues); - break; - default: alSetError(Context, AL_INVALID_ENUM); break; @@ -412,6 +421,13 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum p { ALCcontext *Context; + switch(param) + { + case AL_EFFECTSLOT_GAIN: + alGetAuxiliaryEffectSlotf(effectslot, param, pflValues); + return; + } + Context = GetContextSuspended(); if(!Context) return; @@ -419,10 +435,6 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum p { switch(param) { - case AL_EFFECTSLOT_GAIN: - alGetAuxiliaryEffectSlotf(effectslot, param, pflValues); - break; - default: alSetError(Context, AL_INVALID_ENUM); break; diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index 36ec3aeb..ac3a85af 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -921,6 +921,16 @@ AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum eParam, ALint* plVal ALCdevice *device; ALbuffer *ALBuf; + switch(eParam) + { + case AL_FREQUENCY: + case AL_BITS: + case AL_CHANNELS: + case AL_SIZE: + alGetBufferi(buffer, eParam, plValues); + return; + } + pContext = GetContextSuspended(); if(!pContext) return; @@ -933,13 +943,6 @@ AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum eParam, ALint* plVal { switch(eParam) { - case AL_FREQUENCY: - case AL_BITS: - case AL_CHANNELS: - case AL_SIZE: - alGetBufferi(buffer, eParam, plValues); - break; - case AL_LOOP_POINTS_SOFT: plValues[0] = ALBuf->LoopStart; plValues[1] = ALBuf->LoopEnd; diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c index b16dc073..c740e4ff 100644 --- a/OpenAL32/alFilter.c +++ b/OpenAL32/alFilter.c @@ -187,6 +187,13 @@ AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, ALint *piValue ALCcontext *Context; ALCdevice *Device; + switch(param) + { + case AL_FILTER_TYPE: + alFilteri(filter, param, piValues[0]); + return; + } + Context = GetContextSuspended(); if(!Context) return; @@ -195,10 +202,6 @@ AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, ALint *piValue { switch(param) { - case AL_FILTER_TYPE: - alFilteri(filter, param, piValues[0]); - break; - default: alSetError(Context, AL_INVALID_ENUM); break; @@ -316,6 +319,13 @@ AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piVa ALCcontext *Context; ALCdevice *Device; + switch(param) + { + case AL_FILTER_TYPE: + alGetFilteri(filter, param, piValues); + return; + } + Context = GetContextSuspended(); if(!Context) return; @@ -324,10 +334,6 @@ AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piVa { switch(param) { - case AL_FILTER_TYPE: - alGetFilteri(filter, param, piValues); - break; - default: alSetError(Context, AL_INVALID_ENUM); break; diff --git a/OpenAL32/alListener.c b/OpenAL32/alListener.c index b3c192dc..6fb621d4 100644 --- a/OpenAL32/alListener.c +++ b/OpenAL32/alListener.c @@ -126,9 +126,6 @@ AL_API ALvoid AL_APIENTRY alListenerfv(ALenum eParam, const ALfloat *pflValues) ALCcontext *pContext; ALboolean updateWorld = AL_FALSE; - pContext = GetContextSuspended(); - if(!pContext) return; - if(pflValues) { switch(eParam) @@ -136,13 +133,22 @@ AL_API ALvoid AL_APIENTRY alListenerfv(ALenum eParam, const ALfloat *pflValues) case AL_GAIN: case AL_METERS_PER_UNIT: alListenerf(eParam, pflValues[0]); - break; + return; case AL_POSITION: case AL_VELOCITY: alListener3f(eParam, pflValues[0], pflValues[1], pflValues[2]); - break; + return; + } + } + pContext = GetContextSuspended(); + if(!pContext) return; + + if(pflValues) + { + switch(eParam) + { case AL_ORIENTATION: // AT then UP pContext->Listener.Forward[0] = pflValues[0]; @@ -201,16 +207,19 @@ AL_API void AL_APIENTRY alListener3i(ALenum eParam, ALint lValue1, ALint lValue2 { ALCcontext *pContext; - pContext = GetContextSuspended(); - if(!pContext) return; - switch(eParam) { case AL_POSITION: case AL_VELOCITY: alListener3f(eParam, (ALfloat)lValue1, (ALfloat)lValue2, (ALfloat)lValue3); - break; + return; + } + + pContext = GetContextSuspended(); + if(!pContext) return; + switch(eParam) + { default: alSetError(pContext, AL_INVALID_ENUM); break; @@ -332,6 +341,19 @@ AL_API ALvoid AL_APIENTRY alGetListenerfv(ALenum eParam, ALfloat *pflValues) { ALCcontext *pContext; + switch(eParam) + { + case AL_GAIN: + case AL_METERS_PER_UNIT: + alGetListenerf(eParam, pflValues); + return; + + case AL_POSITION: + case AL_VELOCITY: + alGetListener3f(eParam, pflValues+0, pflValues+1, pflValues+2); + return; + } + pContext = GetContextSuspended(); if(!pContext) return; @@ -339,26 +361,6 @@ AL_API ALvoid AL_APIENTRY alGetListenerfv(ALenum eParam, ALfloat *pflValues) { switch(eParam) { - case AL_GAIN: - pflValues[0] = pContext->Listener.Gain; - break; - - case AL_METERS_PER_UNIT: - pflValues[0] = pContext->Listener.MetersPerUnit; - break; - - case AL_POSITION: - pflValues[0] = pContext->Listener.Position[0]; - pflValues[1] = pContext->Listener.Position[1]; - pflValues[2] = pContext->Listener.Position[2]; - break; - - case AL_VELOCITY: - pflValues[0] = pContext->Listener.Velocity[0]; - pflValues[1] = pContext->Listener.Velocity[1]; - pflValues[2] = pContext->Listener.Velocity[2]; - break; - case AL_ORIENTATION: // AT then UP pflValues[0] = pContext->Listener.Forward[0]; @@ -443,6 +445,14 @@ AL_API void AL_APIENTRY alGetListeneriv(ALenum eParam, ALint* plValues) { ALCcontext *pContext; + switch(eParam) + { + case AL_POSITION: + case AL_VELOCITY: + alGetListener3i(eParam, plValues+0, plValues+1, plValues+2); + return; + } + pContext = GetContextSuspended(); if(!pContext) return; @@ -450,18 +460,6 @@ AL_API void AL_APIENTRY alGetListeneriv(ALenum eParam, ALint* plValues) { switch(eParam) { - case AL_POSITION: - plValues[0] = (ALint)pContext->Listener.Position[0]; - plValues[1] = (ALint)pContext->Listener.Position[1]; - plValues[2] = (ALint)pContext->Listener.Position[2]; - break; - - case AL_VELOCITY: - plValues[0] = (ALint)pContext->Listener.Velocity[0]; - plValues[1] = (ALint)pContext->Listener.Velocity[1]; - plValues[2] = (ALint)pContext->Listener.Velocity[2]; - break; - case AL_ORIENTATION: // AT then UP plValues[0] = (ALint)pContext->Listener.Forward[0]; diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 7dc4a2a9..fd163804 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -442,6 +442,37 @@ AL_API ALvoid AL_APIENTRY alSourcefv(ALuint source, ALenum eParam, const ALfloat { ALCcontext *pContext; + if(pflValues) + { + switch(eParam) + { + case AL_PITCH: + case AL_CONE_INNER_ANGLE: + case AL_CONE_OUTER_ANGLE: + case AL_GAIN: + case AL_MAX_DISTANCE: + case AL_ROLLOFF_FACTOR: + case AL_REFERENCE_DISTANCE: + case AL_MIN_GAIN: + case AL_MAX_GAIN: + case AL_CONE_OUTER_GAIN: + case AL_CONE_OUTER_GAINHF: + case AL_SEC_OFFSET: + case AL_SAMPLE_OFFSET: + case AL_BYTE_OFFSET: + case AL_AIR_ABSORPTION_FACTOR: + case AL_ROOM_ROLLOFF_FACTOR: + alSourcef(source, eParam, pflValues[0]); + return; + + case AL_POSITION: + case AL_VELOCITY: + case AL_DIRECTION: + alSource3f(source, eParam, pflValues[0], pflValues[1], pflValues[2]); + return; + } + } + pContext = GetContextSuspended(); if(!pContext) return; @@ -451,31 +482,6 @@ AL_API ALvoid AL_APIENTRY alSourcefv(ALuint source, ALenum eParam, const ALfloat { switch(eParam) { - case AL_PITCH: - case AL_CONE_INNER_ANGLE: - case AL_CONE_OUTER_ANGLE: - case AL_GAIN: - case AL_MAX_DISTANCE: - case AL_ROLLOFF_FACTOR: - case AL_REFERENCE_DISTANCE: - case AL_MIN_GAIN: - case AL_MAX_GAIN: - case AL_CONE_OUTER_GAIN: - case AL_CONE_OUTER_GAINHF: - case AL_SEC_OFFSET: - case AL_SAMPLE_OFFSET: - case AL_BYTE_OFFSET: - case AL_AIR_ABSORPTION_FACTOR: - case AL_ROOM_ROLLOFF_FACTOR: - alSourcef(source, eParam, pflValues[0]); - break; - - case AL_POSITION: - case AL_VELOCITY: - case AL_DIRECTION: - alSource3f(source, eParam, pflValues[0], pflValues[1], pflValues[2]); - break; - default: alSetError(pContext, AL_INVALID_ENUM); break; @@ -497,6 +503,17 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue) ALsource *Source; ALbufferlistitem *BufferListItem; + switch(eParam) + { + case AL_MAX_DISTANCE: + case AL_ROLLOFF_FACTOR: + case AL_CONE_INNER_ANGLE: + case AL_CONE_OUTER_ANGLE: + case AL_REFERENCE_DISTANCE: + alSourcef(source, eParam, (ALfloat)lValue); + return; + } + pContext = GetContextSuspended(); if(!pContext) return; @@ -506,14 +523,6 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue) switch(eParam) { - case AL_MAX_DISTANCE: - case AL_ROLLOFF_FACTOR: - case AL_CONE_INNER_ANGLE: - case AL_CONE_OUTER_ANGLE: - case AL_REFERENCE_DISTANCE: - alSourcef(source, eParam, (ALfloat)lValue); - break; - case AL_SOURCE_RELATIVE: if(lValue == AL_FALSE || lValue == AL_TRUE) { @@ -706,6 +715,15 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum eParam, ALint lValue1, ALCcontext *pContext; ALsource *Source; + switch(eParam) + { + case AL_POSITION: + case AL_VELOCITY: + case AL_DIRECTION: + alSource3f(source, eParam, (ALfloat)lValue1, (ALfloat)lValue2, (ALfloat)lValue3); + return; + } + pContext = GetContextSuspended(); if(!pContext) return; @@ -713,14 +731,8 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum eParam, ALint lValue1, { ALCdevice *device = pContext->Device; - switch (eParam) + switch(eParam) { - case AL_POSITION: - case AL_VELOCITY: - case AL_DIRECTION: - alSource3f(source, eParam, (ALfloat)lValue1, (ALfloat)lValue2, (ALfloat)lValue3); - break; - case AL_AUXILIARY_SEND_FILTER: { ALeffectslot *ALEffectSlot = NULL; ALfilter *ALFilter = NULL; @@ -769,6 +781,39 @@ AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum eParam, const ALint* pl { ALCcontext *pContext; + if(plValues) + { + switch(eParam) + { + case AL_SOURCE_RELATIVE: + case AL_CONE_INNER_ANGLE: + case AL_CONE_OUTER_ANGLE: + case AL_LOOPING: + case AL_BUFFER: + case AL_SOURCE_STATE: + case AL_SEC_OFFSET: + case AL_SAMPLE_OFFSET: + case AL_BYTE_OFFSET: + case AL_MAX_DISTANCE: + case AL_ROLLOFF_FACTOR: + case AL_REFERENCE_DISTANCE: + case AL_DIRECT_FILTER: + case AL_DIRECT_FILTER_GAINHF_AUTO: + case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO: + case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO: + case AL_DISTANCE_MODEL: + alSourcei(source, eParam, plValues[0]); + return; + + case AL_POSITION: + case AL_VELOCITY: + case AL_DIRECTION: + case AL_AUXILIARY_SEND_FILTER: + alSource3i(source, eParam, plValues[0], plValues[1], plValues[2]); + return; + } + } + pContext = GetContextSuspended(); if(!pContext) return; @@ -778,33 +823,6 @@ AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum eParam, const ALint* pl { switch(eParam) { - case AL_SOURCE_RELATIVE: - case AL_CONE_INNER_ANGLE: - case AL_CONE_OUTER_ANGLE: - case AL_LOOPING: - case AL_BUFFER: - case AL_SOURCE_STATE: - case AL_SEC_OFFSET: - case AL_SAMPLE_OFFSET: - case AL_BYTE_OFFSET: - case AL_MAX_DISTANCE: - case AL_ROLLOFF_FACTOR: - case AL_REFERENCE_DISTANCE: - case AL_DIRECT_FILTER: - case AL_DIRECT_FILTER_GAINHF_AUTO: - case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO: - case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO: - case AL_DISTANCE_MODEL: - alSourcei(source, eParam, plValues[0]); - break; - - case AL_POSITION: - case AL_VELOCITY: - case AL_DIRECTION: - case AL_AUXILIARY_SEND_FILTER: - alSource3i(source, eParam, plValues[0], plValues[1], plValues[2]); - break; - default: alSetError(pContext, AL_INVALID_ENUM); break; @@ -970,6 +988,35 @@ AL_API ALvoid AL_APIENTRY alGetSourcefv(ALuint source, ALenum eParam, ALfloat *p ALdouble Offsets[2]; ALdouble updateLen; + switch(eParam) + { + case AL_PITCH: + case AL_GAIN: + case AL_MIN_GAIN: + case AL_MAX_GAIN: + case AL_MAX_DISTANCE: + case AL_ROLLOFF_FACTOR: + case AL_DOPPLER_FACTOR: + case AL_CONE_OUTER_GAIN: + case AL_SEC_OFFSET: + case AL_SAMPLE_OFFSET: + case AL_BYTE_OFFSET: + case AL_CONE_INNER_ANGLE: + case AL_CONE_OUTER_ANGLE: + case AL_REFERENCE_DISTANCE: + case AL_CONE_OUTER_GAINHF: + case AL_AIR_ABSORPTION_FACTOR: + case AL_ROOM_ROLLOFF_FACTOR: + alGetSourcef(source, eParam, pflValues); + return; + + case AL_POSITION: + case AL_VELOCITY: + case AL_DIRECTION: + alGetSource3f(source, eParam, pflValues+0, pflValues+1, pflValues+2); + return; + } + pContext = GetContextSuspended(); if(!pContext) return; @@ -979,32 +1026,6 @@ AL_API ALvoid AL_APIENTRY alGetSourcefv(ALuint source, ALenum eParam, ALfloat *p { switch(eParam) { - case AL_PITCH: - case AL_GAIN: - case AL_MIN_GAIN: - case AL_MAX_GAIN: - case AL_MAX_DISTANCE: - case AL_ROLLOFF_FACTOR: - case AL_DOPPLER_FACTOR: - case AL_CONE_OUTER_GAIN: - case AL_SEC_OFFSET: - case AL_SAMPLE_OFFSET: - case AL_BYTE_OFFSET: - case AL_CONE_INNER_ANGLE: - case AL_CONE_OUTER_ANGLE: - case AL_REFERENCE_DISTANCE: - case AL_CONE_OUTER_GAINHF: - case AL_AIR_ABSORPTION_FACTOR: - case AL_ROOM_ROLLOFF_FACTOR: - alGetSourcef(source, eParam, pflValues); - break; - - case AL_POSITION: - case AL_VELOCITY: - case AL_DIRECTION: - alGetSource3f(source, eParam, pflValues+0, pflValues+1, pflValues+2); - break; - case AL_SAMPLE_RW_OFFSETS_SOFT: case AL_BYTE_RW_OFFSETS_SOFT: updateLen = (ALdouble)pContext->Device->UpdateSize / @@ -1202,6 +1223,39 @@ AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum eParam, ALint* plVal ALdouble Offsets[2]; ALdouble updateLen; + switch(eParam) + { + case AL_SOURCE_RELATIVE: + case AL_CONE_INNER_ANGLE: + case AL_CONE_OUTER_ANGLE: + case AL_LOOPING: + case AL_BUFFER: + case AL_SOURCE_STATE: + case AL_BUFFERS_QUEUED: + case AL_BUFFERS_PROCESSED: + case AL_SEC_OFFSET: + case AL_SAMPLE_OFFSET: + case AL_BYTE_OFFSET: + case AL_MAX_DISTANCE: + case AL_ROLLOFF_FACTOR: + case AL_DOPPLER_FACTOR: + case AL_REFERENCE_DISTANCE: + case AL_SOURCE_TYPE: + case AL_DIRECT_FILTER: + case AL_DIRECT_FILTER_GAINHF_AUTO: + case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO: + case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO: + case AL_DISTANCE_MODEL: + alGetSourcei(source, eParam, plValues); + return; + + case AL_POSITION: + case AL_VELOCITY: + case AL_DIRECTION: + alGetSource3i(source, eParam, plValues+0, plValues+1, plValues+2); + return; + } + pContext = GetContextSuspended(); if(!pContext) return; @@ -1211,36 +1265,6 @@ AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum eParam, ALint* plVal { switch(eParam) { - case AL_SOURCE_RELATIVE: - case AL_CONE_INNER_ANGLE: - case AL_CONE_OUTER_ANGLE: - case AL_LOOPING: - case AL_BUFFER: - case AL_SOURCE_STATE: - case AL_BUFFERS_QUEUED: - case AL_BUFFERS_PROCESSED: - case AL_SEC_OFFSET: - case AL_SAMPLE_OFFSET: - case AL_BYTE_OFFSET: - case AL_MAX_DISTANCE: - case AL_ROLLOFF_FACTOR: - case AL_DOPPLER_FACTOR: - case AL_REFERENCE_DISTANCE: - case AL_SOURCE_TYPE: - case AL_DIRECT_FILTER: - case AL_DIRECT_FILTER_GAINHF_AUTO: - case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO: - case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO: - case AL_DISTANCE_MODEL: - alGetSourcei(source, eParam, plValues); - break; - - case AL_POSITION: - case AL_VELOCITY: - case AL_DIRECTION: - alGetSource3i(source, eParam, plValues+0, plValues+1, plValues+2); - break; - case AL_SAMPLE_RW_OFFSETS_SOFT: case AL_BYTE_RW_OFFSETS_SOFT: updateLen = (ALdouble)pContext->Device->UpdateSize / |