diff options
author | Chris Robinson <[email protected]> | 2018-03-05 11:29:03 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-03-08 17:48:22 -0800 |
commit | 2187316bce826de1eaa6438f688d4713032be3da (patch) | |
tree | 44667a0e8d3f21065cb8e8b7c46ab130d274a419 | |
parent | 52dee312702a80974b9a3d8a838faafe65f3e36b (diff) |
Use function-like macros to call filter and effect vtable methods
-rw-r--r-- | OpenAL32/Include/alEffect.h | 10 | ||||
-rw-r--r-- | OpenAL32/Include/alFilter.h | 10 | ||||
-rw-r--r-- | OpenAL32/alEffect.c | 38 | ||||
-rw-r--r-- | OpenAL32/alFilter.c | 24 |
4 files changed, 49 insertions, 33 deletions
diff --git a/OpenAL32/Include/alEffect.h b/OpenAL32/Include/alEffect.h index 4469349c..95fa035e 100644 --- a/OpenAL32/Include/alEffect.h +++ b/OpenAL32/Include/alEffect.h @@ -160,11 +160,19 @@ typedef struct ALeffect { ALeffectProps Props; - const struct ALeffectVtable *vtbl; + const struct ALeffectVtable *vtab; /* Self ID */ ALuint id; } ALeffect; +#define ALeffect_setParami(o, c, p, v) ((o)->vtab->setParami(o, c, p, v)) +#define ALeffect_setParamf(o, c, p, v) ((o)->vtab->setParamf(o, c, p, v)) +#define ALeffect_setParamiv(o, c, p, v) ((o)->vtab->setParamiv(o, c, p, v)) +#define ALeffect_setParamfv(o, c, p, v) ((o)->vtab->setParamfv(o, c, p, v)) +#define ALeffect_getParami(o, c, p, v) ((o)->vtab->getParami(o, c, p, v)) +#define ALeffect_getParamf(o, c, p, v) ((o)->vtab->getParamf(o, c, p, v)) +#define ALeffect_getParamiv(o, c, p, v) ((o)->vtab->getParamiv(o, c, p, v)) +#define ALeffect_getParamfv(o, c, p, v) ((o)->vtab->getParamfv(o, c, p, v)) inline ALboolean IsReverbEffect(ALenum type) { return type == AL_EFFECT_REVERB || type == AL_EFFECT_EAXREVERB; } diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h index e28b7b2b..4e506722 100644 --- a/OpenAL32/Include/alFilter.h +++ b/OpenAL32/Include/alFilter.h @@ -157,11 +157,19 @@ typedef struct ALfilter { ALfloat GainLF; ALfloat LFReference; - const struct ALfilterVtable *vtbl; + const struct ALfilterVtable *vtab; /* Self ID */ ALuint id; } ALfilter; +#define ALfilter_setParami(o, c, p, v) ((o)->vtab->setParami(o, c, p, v)) +#define ALfilter_setParamf(o, c, p, v) ((o)->vtab->setParamf(o, c, p, v)) +#define ALfilter_setParamiv(o, c, p, v) ((o)->vtab->setParamiv(o, c, p, v)) +#define ALfilter_setParamfv(o, c, p, v) ((o)->vtab->setParamfv(o, c, p, v)) +#define ALfilter_getParami(o, c, p, v) ((o)->vtab->getParami(o, c, p, v)) +#define ALfilter_getParamf(o, c, p, v) ((o)->vtab->getParamf(o, c, p, v)) +#define ALfilter_getParamiv(o, c, p, v) ((o)->vtab->getParamiv(o, c, p, v)) +#define ALfilter_getParamfv(o, c, p, v) ((o)->vtab->getParamfv(o, c, p, v)) void ReleaseALFilters(ALCdevice *device); diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index f4258e60..6b16fc56 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -176,7 +176,7 @@ AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint value) else { /* Call the appropriate handler */ - V(ALEffect,setParami)(Context, param, value); + ALeffect_setParami(ALEffect, Context, param, value); } } UnlockEffectList(Device); @@ -207,7 +207,7 @@ AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *v else { /* Call the appropriate handler */ - V(ALEffect,setParamiv)(Context, param, values); + ALeffect_setParamiv(ALEffect, Context, param, values); } UnlockEffectList(Device); @@ -230,7 +230,7 @@ AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat value) else { /* Call the appropriate handler */ - V(ALEffect,setParamf)(Context, param, value); + ALeffect_setParamf(ALEffect, Context, param, value); } UnlockEffectList(Device); @@ -253,7 +253,7 @@ AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat else { /* Call the appropriate handler */ - V(ALEffect,setParamfv)(Context, param, values); + ALeffect_setParamfv(ALEffect, Context, param, values); } UnlockEffectList(Device); @@ -280,7 +280,7 @@ AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *value else { /* Call the appropriate handler */ - V(ALEffect,getParami)(Context, param, value); + ALeffect_getParami(ALEffect, Context, param, value); } } UnlockEffectList(Device); @@ -311,7 +311,7 @@ AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *valu else { /* Call the appropriate handler */ - V(ALEffect,getParamiv)(Context, param, values); + ALeffect_getParamiv(ALEffect, Context, param, values); } UnlockEffectList(Device); @@ -334,7 +334,7 @@ AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *val else { /* Call the appropriate handler */ - V(ALEffect,getParamf)(Context, param, value); + ALeffect_getParamf(ALEffect, Context, param, value); } UnlockEffectList(Device); @@ -357,7 +357,7 @@ AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *va else { /* Call the appropriate handler */ - V(ALEffect,getParamfv)(Context, param, values); + ALeffect_getParamfv(ALEffect, Context, param, values); } UnlockEffectList(Device); @@ -500,7 +500,7 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Reverb.LFReference = AL_EAXREVERB_DEFAULT_LFREFERENCE; effect->Props.Reverb.RoomRolloffFactor = AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR; effect->Props.Reverb.DecayHFLimit = AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT; - effect->vtbl = &ALeaxreverb_vtable; + effect->vtab = &ALeaxreverb_vtable; break; case AL_EFFECT_REVERB: effect->Props.Reverb.Density = AL_REVERB_DEFAULT_DENSITY; @@ -530,7 +530,7 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Reverb.LFReference = 250.0f; effect->Props.Reverb.RoomRolloffFactor = AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR; effect->Props.Reverb.DecayHFLimit = AL_REVERB_DEFAULT_DECAY_HFLIMIT; - effect->vtbl = &ALreverb_vtable; + effect->vtab = &ALreverb_vtable; break; case AL_EFFECT_CHORUS: effect->Props.Chorus.Waveform = AL_CHORUS_DEFAULT_WAVEFORM; @@ -539,11 +539,11 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Chorus.Depth = AL_CHORUS_DEFAULT_DEPTH; effect->Props.Chorus.Feedback = AL_CHORUS_DEFAULT_FEEDBACK; effect->Props.Chorus.Delay = AL_CHORUS_DEFAULT_DELAY; - effect->vtbl = &ALchorus_vtable; + effect->vtab = &ALchorus_vtable; break; case AL_EFFECT_COMPRESSOR: effect->Props.Compressor.OnOff = AL_COMPRESSOR_DEFAULT_ONOFF; - effect->vtbl = &ALcompressor_vtable; + effect->vtab = &ALcompressor_vtable; break; case AL_EFFECT_DISTORTION: effect->Props.Distortion.Edge = AL_DISTORTION_DEFAULT_EDGE; @@ -551,7 +551,7 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Distortion.LowpassCutoff = AL_DISTORTION_DEFAULT_LOWPASS_CUTOFF; effect->Props.Distortion.EQCenter = AL_DISTORTION_DEFAULT_EQCENTER; effect->Props.Distortion.EQBandwidth = AL_DISTORTION_DEFAULT_EQBANDWIDTH; - effect->vtbl = &ALdistortion_vtable; + effect->vtab = &ALdistortion_vtable; break; case AL_EFFECT_ECHO: effect->Props.Echo.Delay = AL_ECHO_DEFAULT_DELAY; @@ -559,7 +559,7 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Echo.Damping = AL_ECHO_DEFAULT_DAMPING; effect->Props.Echo.Feedback = AL_ECHO_DEFAULT_FEEDBACK; effect->Props.Echo.Spread = AL_ECHO_DEFAULT_SPREAD; - effect->vtbl = &ALecho_vtable; + effect->vtab = &ALecho_vtable; break; case AL_EFFECT_EQUALIZER: effect->Props.Equalizer.LowCutoff = AL_EQUALIZER_DEFAULT_LOW_CUTOFF; @@ -572,7 +572,7 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Equalizer.Mid2Width = AL_EQUALIZER_DEFAULT_MID2_WIDTH; effect->Props.Equalizer.HighCutoff = AL_EQUALIZER_DEFAULT_HIGH_CUTOFF; effect->Props.Equalizer.HighGain = AL_EQUALIZER_DEFAULT_HIGH_GAIN; - effect->vtbl = &ALequalizer_vtable; + effect->vtab = &ALequalizer_vtable; break; case AL_EFFECT_FLANGER: effect->Props.Chorus.Waveform = AL_FLANGER_DEFAULT_WAVEFORM; @@ -581,21 +581,21 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Chorus.Depth = AL_FLANGER_DEFAULT_DEPTH; effect->Props.Chorus.Feedback = AL_FLANGER_DEFAULT_FEEDBACK; effect->Props.Chorus.Delay = AL_FLANGER_DEFAULT_DELAY; - effect->vtbl = &ALflanger_vtable; + effect->vtab = &ALflanger_vtable; break; case AL_EFFECT_RING_MODULATOR: effect->Props.Modulator.Frequency = AL_RING_MODULATOR_DEFAULT_FREQUENCY; effect->Props.Modulator.HighPassCutoff = AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF; effect->Props.Modulator.Waveform = AL_RING_MODULATOR_DEFAULT_WAVEFORM; - effect->vtbl = &ALmodulator_vtable; + effect->vtab = &ALmodulator_vtable; break; case AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT: case AL_EFFECT_DEDICATED_DIALOGUE: effect->Props.Dedicated.Gain = 1.0f; - effect->vtbl = &ALdedicated_vtable; + effect->vtab = &ALdedicated_vtable; break; default: - effect->vtbl = &ALnull_vtable; + effect->vtab = &ALnull_vtable; break; } effect->type = type; diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c index 70ae901c..08f66d26 100644 --- a/OpenAL32/alFilter.c +++ b/OpenAL32/alFilter.c @@ -154,7 +154,7 @@ AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint value) else { /* Call the appropriate handler */ - V(ALFilter,setParami)(Context, param, value); + ALfilter_setParami(ALFilter, Context, param, value); } } UnlockFilterList(Device); @@ -185,7 +185,7 @@ AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, const ALint *v else { /* Call the appropriate handler */ - V(ALFilter,setParamiv)(Context, param, values); + ALfilter_setParamiv(ALFilter, Context, param, values); } UnlockFilterList(Device); @@ -208,7 +208,7 @@ AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat value) else { /* Call the appropriate handler */ - V(ALFilter,setParamf)(Context, param, value); + ALfilter_setParamf(ALFilter, Context, param, value); } UnlockFilterList(Device); @@ -231,7 +231,7 @@ AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, const ALfloat else { /* Call the appropriate handler */ - V(ALFilter,setParamfv)(Context, param, values); + ALfilter_setParamfv(ALFilter, Context, param, values); } UnlockFilterList(Device); @@ -258,7 +258,7 @@ AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *value else { /* Call the appropriate handler */ - V(ALFilter,getParami)(Context, param, value); + ALfilter_getParami(ALFilter, Context, param, value); } } UnlockFilterList(Device); @@ -289,7 +289,7 @@ AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *valu else { /* Call the appropriate handler */ - V(ALFilter,getParamiv)(Context, param, values); + ALfilter_getParamiv(ALFilter, Context, param, values); } UnlockFilterList(Device); @@ -312,7 +312,7 @@ AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *val else { /* Call the appropriate handler */ - V(ALFilter,getParamf)(Context, param, value); + ALfilter_getParamf(ALFilter, Context, param, value); } UnlockFilterList(Device); @@ -335,7 +335,7 @@ AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *va else { /* Call the appropriate handler */ - V(ALFilter,getParamfv)(Context, param, values); + ALfilter_getParamfv(ALFilter, Context, param, values); } UnlockFilterList(Device); @@ -720,7 +720,7 @@ static void InitFilterParams(ALfilter *filter, ALenum type) filter->HFReference = LOWPASSFREQREF; filter->GainLF = 1.0f; filter->LFReference = HIGHPASSFREQREF; - filter->vtbl = &ALlowpass_vtable; + filter->vtab = &ALlowpass_vtable; } else if(type == AL_FILTER_HIGHPASS) { @@ -729,7 +729,7 @@ static void InitFilterParams(ALfilter *filter, ALenum type) filter->HFReference = LOWPASSFREQREF; filter->GainLF = AL_HIGHPASS_DEFAULT_GAINLF; filter->LFReference = HIGHPASSFREQREF; - filter->vtbl = &ALhighpass_vtable; + filter->vtab = &ALhighpass_vtable; } else if(type == AL_FILTER_BANDPASS) { @@ -738,7 +738,7 @@ static void InitFilterParams(ALfilter *filter, ALenum type) filter->HFReference = LOWPASSFREQREF; filter->GainLF = AL_BANDPASS_DEFAULT_GAINLF; filter->LFReference = HIGHPASSFREQREF; - filter->vtbl = &ALbandpass_vtable; + filter->vtab = &ALbandpass_vtable; } else { @@ -747,7 +747,7 @@ static void InitFilterParams(ALfilter *filter, ALenum type) filter->HFReference = LOWPASSFREQREF; filter->GainLF = 1.0f; filter->LFReference = HIGHPASSFREQREF; - filter->vtbl = &ALnullfilter_vtable; + filter->vtab = &ALnullfilter_vtable; } filter->type = type; } |