From 121252347058fbf8a5af9e598a82ad98fc92f46c Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 13 Oct 2012 00:56:39 -0700 Subject: Implement the double and int64 source setters Note that currently the int64 setters do not range check before being passed to the int setters, erroneously chopping off the upper bits. --- Alc/ALc.c | 6 ++ OpenAL32/Include/alMain.h | 12 +++ OpenAL32/alSource.c | 253 +++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 267 insertions(+), 4 deletions(-) diff --git a/Alc/ALc.c b/Alc/ALc.c index eeaf54f9..3506777d 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -254,9 +254,15 @@ static const ALCfunction alcFunctions[] = { DECL(alDeferUpdatesSOFT), DECL(alProcessUpdatesSOFT), + DECL(alSourcedSOFT), + DECL(alSource3dSOFT), + DECL(alSourcedvSOFT), DECL(alGetSourcedSOFT), DECL(alGetSource3dSOFT), DECL(alGetSourcedvSOFT), + DECL(alSourcei64SOFT), + DECL(alSource3i64SOFT), + DECL(alSourcei64vSOFT), DECL(alGetSourcei64SOFT), DECL(alGetSource3i64SOFT), DECL(alGetSourcei64vSOFT), diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 9c44cfc6..b5c3493c 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -45,16 +45,28 @@ AL_API ALvoid AL_APIENTRY alProcessUpdatesSOFT(void); #define AL_SEC_OFFSET_LATENCY_SOFT 0x1201 typedef int64_t ALint64SOFT; typedef uint64_t ALuint64SOFT; +typedef void (AL_APIENTRY*LPALSOURCEDSOFT)(ALuint,ALenum,ALdouble); +typedef void (AL_APIENTRY*LPALSOURCE3DSOFT)(ALuint,ALenum,ALdouble,ALdouble,ALdouble); +typedef void (AL_APIENTRY*LPALSOURCEDVSOFT)(ALuint,ALenum,const ALdouble*); typedef void (AL_APIENTRY*LPALGETSOURCEDSOFT)(ALuint,ALenum,ALdouble*); typedef void (AL_APIENTRY*LPALGETSOURCE3DSOFT)(ALuint,ALenum,ALdouble*,ALdouble*,ALdouble*); typedef void (AL_APIENTRY*LPALGETSOURCEDVSOFT)(ALuint,ALenum,ALdouble*); +typedef void (AL_APIENTRY*LPALSOURCEI64SOFT)(ALuint,ALenum,ALint64SOFT); +typedef void (AL_APIENTRY*LPALSOURCE3I64SOFT)(ALuint,ALenum,ALint64SOFT,ALint64SOFT,ALint64SOFT); +typedef void (AL_APIENTRY*LPALSOURCEI64VSOFT)(ALuint,ALenum,const ALint64SOFT*); typedef void (AL_APIENTRY*LPALGETSOURCEI64SOFT)(ALuint,ALenum,ALint64SOFT*); typedef void (AL_APIENTRY*LPALGETSOURCE3I64SOFT)(ALuint,ALenum,ALint64SOFT*,ALint64SOFT*,ALint64SOFT*); typedef void (AL_APIENTRY*LPALGETSOURCEI64VSOFT)(ALuint,ALenum,ALint64SOFT*); #ifdef AL_ALEXT_PROTOTYPES +AL_API void AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble value); +AL_API void AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble value1, ALdouble value2, ALdouble value3); +AL_API void AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdouble *values); AL_API void AL_APIENTRY alGetSourcedSOFT(ALuint source, ALenum param, ALdouble *value); AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble *value1, ALdouble *value2, ALdouble *value3); AL_API void AL_APIENTRY alGetSourcedvSOFT(ALuint source, ALenum param, ALdouble *values); +AL_API void AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT value); +AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOFT value1, ALint64SOFT value2, ALint64SOFT value3); +AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALint64SOFT *values); AL_API void AL_APIENTRY alGetSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT *value); AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64SOFT *value1, ALint64SOFT *value2, ALint64SOFT *value3); AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64SOFT *values); diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 21ccb60a..d5a38c3a 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -953,7 +953,6 @@ AL_API ALvoid AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value) ALCcontext_DecRef(Context); } - AL_API ALvoid AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) { ALCcontext *Context; @@ -983,7 +982,6 @@ AL_API ALvoid AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1 ALCcontext_DecRef(Context); } - AL_API ALvoid AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat *values) { ALCcontext *Context; @@ -1029,6 +1027,128 @@ AL_API ALvoid AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat } +AL_API ALvoid AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble value) +{ + ALCcontext *Context; + ALsource *Source; + ALfloat fval; + + Context = GetContextRef(); + if(!Context) return; + + if((Source=LookupSource(Context, source)) == NULL) + alSetError(Context, AL_INVALID_NAME); + else switch(param) + { + 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_AIR_ABSORPTION_FACTOR: + case AL_ROOM_ROLLOFF_FACTOR: + case AL_DOPPLER_FACTOR: + case AL_SEC_OFFSET: + case AL_SAMPLE_OFFSET: + case AL_BYTE_OFFSET: + fval = value; + SetSourcefv(Source, Context, param, &fval); + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + } + + ALCcontext_DecRef(Context); +} + +AL_API ALvoid AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble value1, ALdouble value2, ALdouble value3) +{ + ALCcontext *Context; + ALsource *Source; + ALfloat fvals[3]; + + Context = GetContextRef(); + if(!Context) return; + + if((Source=LookupSource(Context, source)) == NULL) + alSetError(Context, AL_INVALID_NAME); + else switch(param) + { + case AL_POSITION: + case AL_VELOCITY: + case AL_DIRECTION: + fvals[0] = value1; + fvals[1] = value2; + fvals[2] = value3; + SetSourcefv(Source, Context, param, fvals); + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + } + + ALCcontext_DecRef(Context); +} + +AL_API ALvoid AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdouble *values) +{ + ALCcontext *Context; + ALsource *Source; + ALfloat fvals[3]; + + Context = GetContextRef(); + if(!Context) return; + + if((Source=LookupSource(Context, source)) == NULL) + alSetError(Context, AL_INVALID_NAME); + else if(!values) + alSetError(Context, AL_INVALID_VALUE); + else switch(param) + { + 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: + fvals[0] = values[0]; + SetSourcefv(Source, Context, param, fvals); + break; + + case AL_POSITION: + case AL_VELOCITY: + case AL_DIRECTION: + fvals[0] = values[0]; + fvals[1] = values[1]; + fvals[2] = values[2]; + SetSourcefv(Source, Context, param, fvals); + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + } + + ALCcontext_DecRef(Context); +} + + AL_API ALvoid AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value) { ALCcontext *Context; @@ -1069,7 +1189,6 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value) ALCcontext_DecRef(Context); } - AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3) { ALCcontext *Context; @@ -1100,7 +1219,6 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, AL ALCcontext_DecRef(Context); } - AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *values) { ALCcontext *Context; @@ -1149,6 +1267,133 @@ AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *val } +AL_API ALvoid AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT value) +{ + ALCcontext *Context; + ALsource *Source; + ALint ival; + + Context = GetContextRef(); + if(!Context) return; + + if((Source=LookupSource(Context, source)) == NULL) + alSetError(Context, AL_INVALID_NAME); + else switch(param) + { + case AL_MAX_DISTANCE: + case AL_ROLLOFF_FACTOR: + case AL_CONE_INNER_ANGLE: + case AL_CONE_OUTER_ANGLE: + case AL_REFERENCE_DISTANCE: + case AL_SOURCE_RELATIVE: + case AL_LOOPING: + case AL_BUFFER: + case AL_SOURCE_STATE: + case AL_SEC_OFFSET: + case AL_SAMPLE_OFFSET: + case AL_BYTE_OFFSET: + 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_DIRECT_CHANNELS_SOFT: + case AL_DISTANCE_MODEL: + ival = value; + SetSourceiv(Source, Context, param, &ival); + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + } + + ALCcontext_DecRef(Context); +} + +AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOFT value1, ALint64SOFT value2, ALint64SOFT value3) +{ + ALCcontext *Context; + ALsource *Source; + ALint ivals[3]; + + Context = GetContextRef(); + if(!Context) return; + + if((Source=LookupSource(Context, source)) == NULL) + alSetError(Context, AL_INVALID_NAME); + else switch(param) + { + case AL_POSITION: + case AL_VELOCITY: + case AL_DIRECTION: + case AL_AUXILIARY_SEND_FILTER: + ivals[0] = value1; + ivals[1] = value2; + ivals[2] = value3; + SetSourceiv(Source, Context, param, ivals); + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + } + + ALCcontext_DecRef(Context); +} + +AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALint64SOFT *values) +{ + ALCcontext *Context; + ALsource *Source; + ALint ivals[3]; + + Context = GetContextRef(); + if(!Context) return; + + if((Source=LookupSource(Context, source)) == NULL) + alSetError(Context, AL_INVALID_NAME); + else if(!values) + alSetError(Context, AL_INVALID_VALUE); + else switch(param) + { + 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: + case AL_DIRECT_CHANNELS_SOFT: + ivals[0] = values[0]; + SetSourceiv(Source, Context, param, ivals); + break; + + case AL_POSITION: + case AL_VELOCITY: + case AL_DIRECTION: + case AL_AUXILIARY_SEND_FILTER: + ivals[0] = values[0]; + ivals[1] = values[1]; + ivals[2] = values[2]; + SetSourceiv(Source, Context, param, ivals); + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + } + + ALCcontext_DecRef(Context); +} + + AL_API ALvoid AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *value) { ALCcontext *Context; -- cgit v1.2.3