diff options
author | Chris Robinson <[email protected]> | 2010-04-08 08:54:28 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-04-08 08:54:28 -0700 |
commit | b273d616ad5a9979cbf0b69318aded6ec821450e (patch) | |
tree | fd19d6b0a40228669960f7cb30b1e46e04bb9f26 /OpenAL32/alEffect.c | |
parent | c16b895460a51d9f89a8f728155e36ab1009c8c5 (diff) |
Implement a skeleton Ring Modulator effect
Diffstat (limited to 'OpenAL32/alEffect.c')
-rw-r--r-- | OpenAL32/alEffect.c | 148 |
1 files changed, 147 insertions, 1 deletions
diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index 07d2b6dc..3dbc8b3d 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -185,7 +185,8 @@ AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue) ALboolean isOk = (iValue == AL_EFFECT_NULL || (iValue == AL_EFFECT_EAXREVERB && !DisabledEffects[EAXREVERB]) || (iValue == AL_EFFECT_REVERB && !DisabledEffects[REVERB]) || - (iValue == AL_EFFECT_ECHO && !DisabledEffects[ECHO])); + (iValue == AL_EFFECT_ECHO && !DisabledEffects[ECHO]) || + (iValue == AL_EFFECT_RING_MODULATOR && !DisabledEffects[MODULATOR])); if(isOk) InitEffectParams(ALEffect, iValue); @@ -235,6 +236,28 @@ AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue) break; } } + else if(ALEffect->type == AL_EFFECT_RING_MODULATOR) + { + switch(param) + { + case AL_RING_MODULATOR_FREQUENCY: + case AL_RING_MODULATOR_HIGHPASS_CUTOFF: + alEffectf(effect, param, (ALfloat)iValue); + break; + + case AL_RING_MODULATOR_WAVEFORM: + if(iValue >= AL_RING_MODULATOR_MIN_WAVEFORM && + iValue <= AL_RING_MODULATOR_MAX_WAVEFORM) + ALEffect->Modulator.Waveform = iValue; + else + alSetError(Context, AL_INVALID_VALUE); + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + break; + } + } else alSetError(Context, AL_INVALID_ENUM); } @@ -295,6 +318,21 @@ AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, ALint *piValue break; } } + else if(ALEffect->type == AL_EFFECT_RING_MODULATOR) + { + switch(param) + { + case AL_RING_MODULATOR_FREQUENCY: + case AL_RING_MODULATOR_HIGHPASS_CUTOFF: + case AL_RING_MODULATOR_WAVEFORM: + alEffecti(effect, param, piValues[0]); + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + break; + } + } else alSetError(Context, AL_INVALID_ENUM); } @@ -633,6 +671,31 @@ AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue break; } } + else if(ALEffect->type == AL_EFFECT_RING_MODULATOR) + { + switch(param) + { + case AL_RING_MODULATOR_FREQUENCY: + if(flValue >= AL_RING_MODULATOR_MIN_FREQUENCY && + flValue <= AL_RING_MODULATOR_MAX_FREQUENCY) + ALEffect->Modulator.Frequency = flValue; + else + alSetError(Context, AL_INVALID_VALUE); + break; + + case AL_RING_MODULATOR_HIGHPASS_CUTOFF: + if(flValue >= AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF && + flValue <= AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF) + ALEffect->Modulator.HighPassCutoff = flValue; + else + alSetError(Context, AL_INVALID_VALUE); + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + break; + } + } else alSetError(Context, AL_INVALID_ENUM); } @@ -748,6 +811,20 @@ AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflVa break; } } + else if(ALEffect->type == AL_EFFECT_RING_MODULATOR) + { + switch(param) + { + case AL_RING_MODULATOR_FREQUENCY: + case AL_RING_MODULATOR_HIGHPASS_CUTOFF: + alEffectf(effect, param, pflValues[0]); + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + break; + } + } else alSetError(Context, AL_INVALID_ENUM); } @@ -808,6 +885,25 @@ AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piVal break; } } + else if(ALEffect->type == AL_EFFECT_RING_MODULATOR) + { + switch(param) + { + case AL_RING_MODULATOR_FREQUENCY: + *piValue = (ALint)ALEffect->Modulator.Frequency; + break; + case AL_RING_MODULATOR_HIGHPASS_CUTOFF: + *piValue = (ALint)ALEffect->Modulator.HighPassCutoff; + break; + case AL_RING_MODULATOR_WAVEFORM: + *piValue = ALEffect->Modulator.Waveform; + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + break; + } + } else alSetError(Context, AL_INVALID_ENUM); } @@ -868,6 +964,21 @@ AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piVa break; } } + else if(ALEffect->type == AL_EFFECT_RING_MODULATOR) + { + switch(param) + { + case AL_RING_MODULATOR_FREQUENCY: + case AL_RING_MODULATOR_HIGHPASS_CUTOFF: + case AL_RING_MODULATOR_WAVEFORM: + alGetEffecti(effect, param, piValues); + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + break; + } + } else alSetError(Context, AL_INVALID_ENUM); } @@ -1064,6 +1175,22 @@ AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pfl break; } } + else if(ALEffect->type == AL_EFFECT_RING_MODULATOR) + { + switch(param) + { + case AL_RING_MODULATOR_FREQUENCY: + *pflValue = ALEffect->Modulator.Frequency; + break; + case AL_RING_MODULATOR_HIGHPASS_CUTOFF: + *pflValue = ALEffect->Modulator.HighPassCutoff; + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + break; + } + } else alSetError(Context, AL_INVALID_ENUM); } @@ -1169,6 +1296,20 @@ AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pf break; } } + else if(ALEffect->type == AL_EFFECT_RING_MODULATOR) + { + switch(param) + { + case AL_RING_MODULATOR_FREQUENCY: + case AL_RING_MODULATOR_HIGHPASS_CUTOFF: + alGetEffectf(effect, param, pflValues); + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + break; + } + } else alSetError(Context, AL_INVALID_ENUM); } @@ -1241,5 +1382,10 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Echo.Feedback = AL_ECHO_DEFAULT_FEEDBACK; effect->Echo.Spread = AL_ECHO_DEFAULT_SPREAD; break; + case AL_EFFECT_RING_MODULATOR: + effect->Modulator.Frequency = AL_RING_MODULATOR_DEFAULT_FREQUENCY; + effect->Modulator.HighPassCutoff = AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF; + effect->Modulator.Waveform = AL_RING_MODULATOR_DEFAULT_WAVEFORM; + break; } } |