diff options
author | Chris Robinson <[email protected]> | 2011-07-11 00:51:18 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-07-11 00:51:18 -0700 |
commit | 51c09e94b84d386b51d130a540a2669a514061bb (patch) | |
tree | 965b888f95e024043c57269969b6a8c12331a237 | |
parent | 22ccaf7f4ab0d3ac7d0e71f08d630a7c0f80af03 (diff) |
Avoid some alGet* duplication
-rw-r--r-- | OpenAL32/alState.c | 100 |
1 files changed, 44 insertions, 56 deletions
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c index 41eec7a5..bcf03e1b 100644 --- a/OpenAL32/alState.c +++ b/OpenAL32/alState.c @@ -282,29 +282,26 @@ AL_API ALvoid AL_APIENTRY alGetBooleanv(ALenum pname,ALboolean *data) { ALCcontext *Context; - Context = GetLockedContext(); - if(!Context) return; - if(data) { switch(pname) { case AL_DOPPLER_FACTOR: - *data = (ALboolean)((Context->DopplerFactor != 0.0f) ? AL_TRUE : AL_FALSE); - break; - case AL_DOPPLER_VELOCITY: - *data = (ALboolean)((Context->DopplerVelocity != 0.0f) ? AL_TRUE : AL_FALSE); - break; - case AL_DISTANCE_MODEL: - *data = (ALboolean)((Context->DistanceModel == AL_INVERSE_DISTANCE_CLAMPED) ? AL_TRUE : AL_FALSE); - break; - case AL_SPEED_OF_SOUND: - *data = (ALboolean)((Context->flSpeedOfSound != 0.0f) ? AL_TRUE : AL_FALSE); - break; + *data = alGetBoolean(pname); + return; + } + } + + Context = GetLockedContext(); + if(!Context) return; + if(data) + { + switch(pname) + { default: alSetError(Context, AL_INVALID_ENUM); break; @@ -323,29 +320,26 @@ AL_API ALvoid AL_APIENTRY alGetDoublev(ALenum pname,ALdouble *data) { ALCcontext *Context; - Context = GetLockedContext(); - if(!Context) return; - if(data) { switch(pname) { case AL_DOPPLER_FACTOR: - *data = (double)Context->DopplerFactor; - break; - case AL_DOPPLER_VELOCITY: - *data = (double)Context->DopplerVelocity; - break; - case AL_DISTANCE_MODEL: - *data = (double)Context->DistanceModel; - break; - case AL_SPEED_OF_SOUND: - *data = (double)Context->flSpeedOfSound; - break; + *data = alGetDouble(pname); + return; + } + } + + Context = GetLockedContext(); + if(!Context) return; + if(data) + { + switch(pname) + { default: alSetError(Context, AL_INVALID_ENUM); break; @@ -364,29 +358,26 @@ AL_API ALvoid AL_APIENTRY alGetFloatv(ALenum pname,ALfloat *data) { ALCcontext *Context; - Context = GetLockedContext(); - if(!Context) return; - if(data) { switch(pname) { case AL_DOPPLER_FACTOR: - *data = Context->DopplerFactor; - break; - case AL_DOPPLER_VELOCITY: - *data = Context->DopplerVelocity; - break; - case AL_DISTANCE_MODEL: - *data = (float)Context->DistanceModel; - break; - case AL_SPEED_OF_SOUND: - *data = Context->flSpeedOfSound; - break; + *data = alGetFloat(pname); + return; + } + } + + Context = GetLockedContext(); + if(!Context) return; + if(data) + { + switch(pname) + { default: alSetError(Context, AL_INVALID_ENUM); break; @@ -405,29 +396,26 @@ AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname,ALint *data) { ALCcontext *Context; - Context = GetLockedContext(); - if(!Context) return; - if(data) { switch(pname) { case AL_DOPPLER_FACTOR: - *data = (ALint)Context->DopplerFactor; - break; - case AL_DOPPLER_VELOCITY: - *data = (ALint)Context->DopplerVelocity; - break; - case AL_DISTANCE_MODEL: - *data = (ALint)Context->DistanceModel; - break; - case AL_SPEED_OF_SOUND: - *data = (ALint)Context->flSpeedOfSound; - break; + *data = alGetInteger(pname); + return; + } + } + + Context = GetLockedContext(); + if(!Context) return; + if(data) + { + switch(pname) + { default: alSetError(Context, AL_INVALID_ENUM); break; |