diff options
author | Chris Robinson <[email protected]> | 2009-04-12 16:01:10 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-04-12 16:01:10 -0700 |
commit | 55c790c9ff28acad5e5da365bee8a6f693d21796 (patch) | |
tree | 09d387064dc5beece6a9d8cfeb3b034c7f5ea0d3 /OpenAL32/alEffect.c | |
parent | 65b69f33085ac9381f683e92655acba0e4622675 (diff) |
Add the Echo effect
Diffstat (limited to 'OpenAL32/alEffect.c')
-rw-r--r-- | OpenAL32/alEffect.c | 153 |
1 files changed, 152 insertions, 1 deletions
diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index 939b663f..4455a230 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -170,7 +170,8 @@ ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue) if(param == AL_EFFECT_TYPE) { ALboolean isOk = (iValue == AL_EFFECT_NULL || - (iValue == AL_EFFECT_REVERB && !DisabledEffects[REVERB])); + (iValue == AL_EFFECT_REVERB && !DisabledEffects[REVERB]) || + (iValue == AL_EFFECT_ECHO && !DisabledEffects[ECHO])); if(isOk) InitEffectParams(ALEffect, iValue); @@ -193,6 +194,15 @@ ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue) break; } } + else if(ALEffect->type == AL_EFFECT_ECHO) + { + switch(param) + { + default: + alSetError(AL_INVALID_ENUM); + break; + } + } else alSetError(AL_INVALID_ENUM); } @@ -230,6 +240,15 @@ ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, ALint *piValues) break; } } + else if(ALEffect->type == AL_EFFECT_ECHO) + { + switch(param) + { + default: + alSetError(AL_INVALID_ENUM); + break; + } + } else alSetError(AL_INVALID_ENUM); } @@ -343,6 +362,50 @@ ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue) break; } } + else if(ALEffect->type == AL_EFFECT_ECHO) + { + switch(param) + { + case AL_ECHO_DELAY: + if(flValue >= AL_ECHO_MIN_DELAY && flValue <= AL_ECHO_MAX_DELAY) + ALEffect->Echo.Delay = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_ECHO_LRDELAY: + if(flValue >= AL_ECHO_MIN_LRDELAY && flValue <= AL_ECHO_MAX_LRDELAY) + ALEffect->Echo.LRDelay = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_ECHO_DAMPING: + if(flValue >= AL_ECHO_MIN_DAMPING && flValue <= AL_ECHO_MAX_DAMPING) + ALEffect->Echo.Damping = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_ECHO_FEEDBACK: + if(flValue >= AL_ECHO_MIN_FEEDBACK && flValue <= AL_ECHO_MAX_FEEDBACK) + ALEffect->Echo.Feedback = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_ECHO_SPREAD: + if(flValue >= AL_ECHO_MIN_SPREAD && flValue <= AL_ECHO_MAX_SPREAD) + ALEffect->Echo.Spread = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + default: + alSetError(AL_INVALID_ENUM); + break; + } + } else alSetError(AL_INVALID_ENUM); } @@ -387,6 +450,23 @@ ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflValues) break; } } + else if(ALEffect->type == AL_EFFECT_ECHO) + { + switch(param) + { + case AL_ECHO_DELAY: + case AL_ECHO_LRDELAY: + case AL_ECHO_DAMPING: + case AL_ECHO_FEEDBACK: + case AL_ECHO_SPREAD: + alEffectf(effect, param, pflValues[0]); + break; + + default: + alSetError(AL_INVALID_ENUM); + break; + } + } else alSetError(AL_INVALID_ENUM); } @@ -424,6 +504,15 @@ ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue) break; } } + else if(ALEffect->type == AL_EFFECT_ECHO) + { + switch(param) + { + default: + alSetError(AL_INVALID_ENUM); + break; + } + } else alSetError(AL_INVALID_ENUM); } @@ -461,6 +550,15 @@ ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues) break; } } + else if(ALEffect->type == AL_EFFECT_ECHO) + { + switch(param) + { + default: + alSetError(AL_INVALID_ENUM); + break; + } + } else alSetError(AL_INVALID_ENUM); } @@ -538,6 +636,35 @@ ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue) break; } } + else if(ALEffect->type == AL_EFFECT_ECHO) + { + switch(param) + { + case AL_ECHO_DELAY: + *pflValue = ALEffect->Echo.Delay; + break; + + case AL_ECHO_LRDELAY: + *pflValue = ALEffect->Echo.LRDelay; + break; + + case AL_ECHO_DAMPING: + *pflValue = ALEffect->Echo.Damping; + break; + + case AL_ECHO_FEEDBACK: + *pflValue = ALEffect->Echo.Feedback; + break; + + case AL_ECHO_SPREAD: + *pflValue = ALEffect->Echo.Spread; + break; + + default: + alSetError(AL_INVALID_ENUM); + break; + } + } else alSetError(AL_INVALID_ENUM); } @@ -582,6 +709,23 @@ ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues break; } } + else if(ALEffect->type == AL_EFFECT_ECHO) + { + switch(param) + { + case AL_ECHO_DELAY: + case AL_ECHO_LRDELAY: + case AL_ECHO_DAMPING: + case AL_ECHO_FEEDBACK: + case AL_ECHO_SPREAD: + alGetEffectf(effect, param, pflValues); + break; + + default: + alSetError(AL_INVALID_ENUM); + break; + } + } else alSetError(AL_INVALID_ENUM); } @@ -632,5 +776,12 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Reverb.RoomRolloffFactor = 0.0f; effect->Reverb.DecayHFLimit = AL_TRUE; break; + case AL_EFFECT_ECHO: + effect->Echo.Delay = AL_ECHO_DEFAULT_DELAY; + effect->Echo.LRDelay = AL_ECHO_DEFAULT_LRDELAY; + effect->Echo.Damping = AL_ECHO_DEFAULT_DAMPING; + effect->Echo.Feedback = AL_ECHO_DEFAULT_FEEDBACK; + effect->Echo.Spread = AL_ECHO_DEFAULT_SPREAD; + break; } } |