diff options
author | Chris Robinson <[email protected]> | 2013-10-03 03:32:54 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-10-03 03:37:03 -0700 |
commit | 99fa5911bc9f427c96fe800f94d31e4942805fd2 (patch) | |
tree | 85a3c6f1ef2e13e8260f1f5b3c5be4edf902cb74 /OpenAL32 | |
parent | 2f676832bcd4aa9a51a602eb254e60eb831581dc (diff) |
Implement the Autowah effect.
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alAuxEffectSlot.h | 1 | ||||
-rw-r--r-- | OpenAL32/Include/alEffect.h | 17 | ||||
-rw-r--r-- | OpenAL32/Include/alFilter.h | 1 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 1 | ||||
-rw-r--r-- | OpenAL32/alEffect.c | 7 | ||||
-rw-r--r-- | OpenAL32/alExtension.c | 9 | ||||
-rw-r--r-- | OpenAL32/alFilter.c | 9 |
7 files changed, 37 insertions, 8 deletions
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index 463a6770..00de7a3b 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -96,6 +96,7 @@ ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context); ALeffectStateFactory *ALnullStateFactory_getFactory(void); ALeffectStateFactory *ALreverbStateFactory_getFactory(void); +ALeffectStateFactory *ALautowahStateFactory_getFactory(void); ALeffectStateFactory *ALchorusStateFactory_getFactory(void); ALeffectStateFactory *ALdistortionStateFactory_getFactory(void); ALeffectStateFactory *ALechoStateFactory_getFactory(void); diff --git a/OpenAL32/Include/alEffect.h b/OpenAL32/Include/alEffect.h index 8b7b612f..7269c13e 100644 --- a/OpenAL32/Include/alEffect.h +++ b/OpenAL32/Include/alEffect.h @@ -12,13 +12,14 @@ struct ALeffect; enum { EAXREVERB = 0, REVERB, + AUTOWAH, + CHORUS, + DISTORTION, ECHO, + EQUALIZER, + FLANGER, MODULATOR, DEDICATED, - CHORUS, - FLANGER, - EQUALIZER, - DISTORTION, MAX_EFFECTS }; @@ -49,6 +50,7 @@ const struct ALeffectVtable T##_vtable = { \ extern const struct ALeffectVtable ALeaxreverb_vtable; extern const struct ALeffectVtable ALreverb_vtable; +extern const struct ALeffectVtable ALautowah_vtable; extern const struct ALeffectVtable ALchorus_vtable; extern const struct ALeffectVtable ALdistortion_vtable; extern const struct ALeffectVtable ALecho_vtable; @@ -90,6 +92,13 @@ typedef union ALeffectProps { } Reverb; struct { + ALfloat AttackTime; + ALfloat ReleaseTime; + ALfloat PeakGain; + ALfloat Resonance; + } Autowah; + + struct { ALfloat Delay; ALfloat LRDelay; diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h index 690a496b..c8bdf906 100644 --- a/OpenAL32/Include/alFilter.h +++ b/OpenAL32/Include/alFilter.h @@ -20,6 +20,7 @@ typedef enum ALfilterType { ALfilterType_Peaking, ALfilterType_LowPass, + ALfilterType_HighPass, ALfilterType_BandPass, } ALfilterType; diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index eec41081..827820eb 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -457,6 +457,7 @@ void InitEffectFactoryMap(void) InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_NULL, ALnullStateFactory_getFactory); InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_EAXREVERB, ALreverbStateFactory_getFactory); InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_REVERB, ALreverbStateFactory_getFactory); + InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_AUTOWAH, ALautowahStateFactory_getFactory); InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_CHORUS, ALchorusStateFactory_getFactory); InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_DISTORTION, ALdistortionStateFactory_getFactory); InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_ECHO, ALechoStateFactory_getFactory); diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index b67e34ae..ed6a1d5a 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -413,6 +413,13 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Reverb.DecayHFLimit = AL_REVERB_DEFAULT_DECAY_HFLIMIT; effect->vtbl = &ALreverb_vtable; break; + case AL_EFFECT_AUTOWAH: + effect->Props.Autowah.AttackTime = AL_AUTOWAH_DEFAULT_ATTACK_TIME; + effect->Props.Autowah.PeakGain = AL_AUTOWAH_DEFAULT_PEAK_GAIN; + effect->Props.Autowah.ReleaseTime = AL_AUTOWAH_DEFAULT_RELEASE_TIME; + effect->Props.Autowah.Resonance = AL_AUTOWAH_DEFAULT_RESONANCE; + effect->vtbl = &ALautowah_vtable; + break; case AL_EFFECT_CHORUS: effect->Props.Chorus.Waveform = AL_CHORUS_DEFAULT_WAVEFORM; effect->Props.Chorus.Phase = AL_CHORUS_DEFAULT_PHASE; diff --git a/OpenAL32/alExtension.c b/OpenAL32/alExtension.c index 0261ba7a..236e56d0 100644 --- a/OpenAL32/alExtension.c +++ b/OpenAL32/alExtension.c @@ -38,14 +38,15 @@ const struct EffectList EffectList[] = { { "eaxreverb", EAXREVERB, "AL_EFFECT_EAXREVERB", AL_EFFECT_EAXREVERB }, { "reverb", REVERB, "AL_EFFECT_REVERB", AL_EFFECT_REVERB }, + { "autowah", AUTOWAH, "AL_EFFECT_AUTOWAH", AL_EFFECT_AUTOWAH }, + { "chorus", CHORUS, "AL_EFFECT_CHORUS", AL_EFFECT_CHORUS }, + { "distortion", DISTORTION, "AL_EFFECT_DISTORTION", AL_EFFECT_DISTORTION }, { "echo", ECHO, "AL_EFFECT_ECHO", AL_EFFECT_ECHO }, + { "equalizer", EQUALIZER, "AL_EFFECT_EQUALIZER", AL_EFFECT_EQUALIZER }, + { "flanger", FLANGER, "AL_EFFECT_FLANGER", AL_EFFECT_FLANGER }, { "modulator", MODULATOR, "AL_EFFECT_RING_MODULATOR", AL_EFFECT_RING_MODULATOR }, { "dedicated", DEDICATED, "AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT", AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT }, { "dedicated", DEDICATED, "AL_EFFECT_DEDICATED_DIALOGUE", AL_EFFECT_DEDICATED_DIALOGUE }, - { "chorus", CHORUS, "AL_EFFECT_CHORUS", AL_EFFECT_CHORUS }, - { "flanger", FLANGER, "AL_EFFECT_FLANGER", AL_EFFECT_FLANGER }, - { "equalizer", EQUALIZER, "AL_EFFECT_EQUALIZER", AL_EFFECT_EQUALIZER }, - { "distortion", DISTORTION, "AL_EFFECT_DISTORTION", AL_EFFECT_DISTORTION }, { NULL, 0, NULL, (ALenum)0 } }; diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c index 7fb6a5e9..fd10addc 100644 --- a/OpenAL32/alFilter.c +++ b/OpenAL32/alFilter.c @@ -405,6 +405,15 @@ void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat g filter->a[1] = -2.0f * cosf(w0); filter->a[2] = 1.0f - alpha; break; + case ALfilterType_HighPass: + alpha = sinf(w0) * sinhf(logf(2.0f) / 2.0f * bandwidth * w0 / sinf(w0)); + filter->b[0] = (1.0f + cosf(w0)) / 2.0f; + filter->b[1] = 1.0f + cosf(w0); + filter->b[2] = (1.0f + cosf(w0)) / 2.0f; + filter->a[0] = 1.0f + alpha; + filter->a[1] = -2.0f * cosf(w0); + filter->a[2] = 1.0f - alpha; + break; case ALfilterType_BandPass: alpha = sinf(w0) * sinhf(logf(2.0f) / 2.0f * bandwidth * w0 / sinf(w0)); filter->b[0] = alpha; |