diff options
-rw-r--r-- | Alc/effects/autowah.cpp | 23 | ||||
-rw-r--r-- | Alc/effects/base.h | 18 | ||||
-rw-r--r-- | Alc/effects/chorus.cpp | 56 | ||||
-rw-r--r-- | Alc/effects/compressor.cpp | 34 | ||||
-rw-r--r-- | Alc/effects/dedicated.cpp | 22 | ||||
-rw-r--r-- | Alc/effects/distortion.cpp | 22 | ||||
-rw-r--r-- | Alc/effects/echo.cpp | 22 | ||||
-rw-r--r-- | Alc/effects/equalizer.cpp | 22 | ||||
-rw-r--r-- | Alc/effects/fshifter.cpp | 28 | ||||
-rw-r--r-- | Alc/effects/modulator.cpp | 30 | ||||
-rw-r--r-- | Alc/effects/null.cpp | 45 | ||||
-rw-r--r-- | Alc/effects/pshifter.cpp | 22 | ||||
-rw-r--r-- | Alc/effects/reverb.cpp | 58 | ||||
-rw-r--r-- | OpenAL32/Include/alEffect.h | 8 | ||||
-rw-r--r-- | OpenAL32/alEffect.cpp | 27 |
15 files changed, 211 insertions, 226 deletions
diff --git a/Alc/effects/autowah.cpp b/Alc/effects/autowah.cpp index a87df97c..81c0c75c 100644 --- a/Alc/effects/autowah.cpp +++ b/Alc/effects/autowah.cpp @@ -200,9 +200,8 @@ void ALautowahState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sampl } -void ALautowah_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +void ALautowah_setParamf(ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_AUTOWAH_ATTACK_TIME: @@ -233,18 +232,16 @@ void ALautowah_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, AL alSetError(context, AL_INVALID_ENUM, "Invalid autowah float property 0x%04x", param); } } -void ALautowah_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ ALautowah_setParamf(effect, context, param, vals[0]); } +void ALautowah_setParamfv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +{ ALautowah_setParamf(props, context, param, vals[0]); } -void ALautowah_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +void ALautowah_setParami(ALeffectProps*, ALCcontext *context, ALenum param, ALint) { alSetError(context, AL_INVALID_ENUM, "Invalid autowah integer property 0x%04x", param); } -void ALautowah_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +void ALautowah_setParamiv(ALeffectProps*, ALCcontext *context, ALenum param, const ALint*) { alSetError(context, AL_INVALID_ENUM, "Invalid autowah integer vector property 0x%04x", param); } -void ALautowah_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +void ALautowah_getParamf(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) { - - const ALeffectProps *props = &effect->Props; switch(param) { case AL_AUTOWAH_ATTACK_TIME: @@ -268,12 +265,12 @@ void ALautowah_getParamf(const ALeffect *effect, ALCcontext *context, ALenum par } } -void ALautowah_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ ALautowah_getParamf(effect, context, param, vals); } +void ALautowah_getParamfv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +{ ALautowah_getParamf(props, context, param, vals); } -void ALautowah_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +void ALautowah_getParami(const ALeffectProps*, ALCcontext *context, ALenum param, ALint*) { alSetError(context, AL_INVALID_ENUM, "Invalid autowah integer property 0x%04x", param); } -void ALautowah_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +void ALautowah_getParamiv(const ALeffectProps*, ALCcontext *context, ALenum param, ALint*) { alSetError(context, AL_INVALID_ENUM, "Invalid autowah integer vector property 0x%04x", param); } DEFINE_ALEFFECT_VTABLE(ALautowah); diff --git a/Alc/effects/base.h b/Alc/effects/base.h index 54d0c408..82b9026a 100644 --- a/Alc/effects/base.h +++ b/Alc/effects/base.h @@ -12,15 +12,15 @@ union ALeffectProps; struct EffectVtable { - void (*const setParami)(ALeffect *effect, ALCcontext *context, ALenum param, ALint val); - void (*const setParamiv)(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals); - void (*const setParamf)(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val); - void (*const setParamfv)(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals); - - void (*const getParami)(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val); - void (*const getParamiv)(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals); - void (*const getParamf)(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val); - void (*const getParamfv)(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals); + void (*const setParami)(ALeffectProps *props, ALCcontext *context, ALenum param, ALint val); + void (*const setParamiv)(ALeffectProps *props, ALCcontext *context, ALenum param, const ALint *vals); + void (*const setParamf)(ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat val); + void (*const setParamfv)(ALeffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals); + + void (*const getParami)(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *val); + void (*const getParamiv)(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *vals); + void (*const getParamf)(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *val); + void (*const getParamfv)(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals); }; #define DEFINE_ALEFFECT_VTABLE(T) \ diff --git a/Alc/effects/chorus.cpp b/Alc/effects/chorus.cpp index cf54cf1a..495a4574 100644 --- a/Alc/effects/chorus.cpp +++ b/Alc/effects/chorus.cpp @@ -256,9 +256,8 @@ void ChorusState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesI } -void Chorus_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +void Chorus_setParami(ALeffectProps *props, ALCcontext *context, ALenum param, ALint val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_CHORUS_WAVEFORM: @@ -277,11 +276,10 @@ void Chorus_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint alSetError(context, AL_INVALID_ENUM, "Invalid chorus integer property 0x%04x", param); } } -void Chorus_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ Chorus_setParami(effect, context, param, vals[0]); } -void Chorus_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +void Chorus_setParamiv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +{ Chorus_setParami(props, context, param, vals[0]); } +void Chorus_setParamf(ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_CHORUS_RATE: @@ -312,12 +310,11 @@ void Chorus_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALflo alSetError(context, AL_INVALID_ENUM, "Invalid chorus float property 0x%04x", param); } } -void Chorus_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ Chorus_setParamf(effect, context, param, vals[0]); } +void Chorus_setParamfv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +{ Chorus_setParamf(props, context, param, vals[0]); } -void Chorus_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +void Chorus_getParami(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_CHORUS_WAVEFORM: @@ -332,11 +329,10 @@ void Chorus_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, alSetError(context, AL_INVALID_ENUM, "Invalid chorus integer property 0x%04x", param); } } -void Chorus_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ Chorus_getParami(effect, context, param, vals); } -void Chorus_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +void Chorus_getParamiv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +{ Chorus_getParami(props, context, param, vals); } +void Chorus_getParamf(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_CHORUS_RATE: @@ -359,8 +355,8 @@ void Chorus_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, alSetError(context, AL_INVALID_ENUM, "Invalid chorus float property 0x%04x", param); } } -void Chorus_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ Chorus_getParamf(effect, context, param, vals); } +void Chorus_getParamfv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +{ Chorus_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Chorus); @@ -384,9 +380,8 @@ ALeffectProps ChorusStateFactory::getDefaultProps() const noexcept } -void Flanger_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +void Flanger_setParami(ALeffectProps *props, ALCcontext *context, ALenum param, ALint val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_FLANGER_WAVEFORM: @@ -405,11 +400,10 @@ void Flanger_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALin alSetError(context, AL_INVALID_ENUM, "Invalid flanger integer property 0x%04x", param); } } -void Flanger_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ Flanger_setParami(effect, context, param, vals[0]); } -void Flanger_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +void Flanger_setParamiv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +{ Flanger_setParami(props, context, param, vals[0]); } +void Flanger_setParamf(ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_FLANGER_RATE: @@ -440,12 +434,11 @@ void Flanger_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfl alSetError(context, AL_INVALID_ENUM, "Invalid flanger float property 0x%04x", param); } } -void Flanger_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ Flanger_setParamf(effect, context, param, vals[0]); } +void Flanger_setParamfv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +{ Flanger_setParamf(props, context, param, vals[0]); } -void Flanger_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +void Flanger_getParami(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_FLANGER_WAVEFORM: @@ -460,11 +453,10 @@ void Flanger_getParami(const ALeffect *effect, ALCcontext *context, ALenum param alSetError(context, AL_INVALID_ENUM, "Invalid flanger integer property 0x%04x", param); } } -void Flanger_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ Flanger_getParami(effect, context, param, vals); } -void Flanger_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +void Flanger_getParamiv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +{ Flanger_getParami(props, context, param, vals); } +void Flanger_getParamf(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_FLANGER_RATE: @@ -487,8 +479,8 @@ void Flanger_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param alSetError(context, AL_INVALID_ENUM, "Invalid flanger float property 0x%04x", param); } } -void Flanger_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ Flanger_getParamf(effect, context, param, vals); } +void Flanger_getParamfv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +{ Flanger_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Flanger); diff --git a/Alc/effects/compressor.cpp b/Alc/effects/compressor.cpp index 684ed35d..9e2ea376 100644 --- a/Alc/effects/compressor.cpp +++ b/Alc/effects/compressor.cpp @@ -39,7 +39,7 @@ namespace { #define RELEASE_TIME 0.2f /* 200ms to drop from max to min */ -struct ALcompressorState final : public EffectState { +struct CompressorState final : public EffectState { /* Effect gains for each channel */ ALfloat mGain[MAX_AMBI_CHANNELS][MAX_OUTPUT_CHANNELS]{}; @@ -54,10 +54,10 @@ struct ALcompressorState final : public EffectState { void update(const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props, const EffectTarget target) override; void process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) override; - DEF_NEWDEL(ALcompressorState) + DEF_NEWDEL(CompressorState) }; -ALboolean ALcompressorState::deviceUpdate(const ALCdevice *device) +ALboolean CompressorState::deviceUpdate(const ALCdevice *device) { /* Number of samples to do a full attack and release (non-integer sample * counts are okay). @@ -74,7 +74,7 @@ ALboolean ALcompressorState::deviceUpdate(const ALCdevice *device) return AL_TRUE; } -void ALcompressorState::update(const ALCcontext* UNUSED(context), const ALeffectslot *slot, const ALeffectProps *props, const EffectTarget target) +void CompressorState::update(const ALCcontext* UNUSED(context), const ALeffectslot *slot, const ALeffectProps *props, const EffectTarget target) { mEnabled = props->Compressor.OnOff; @@ -87,7 +87,7 @@ void ALcompressorState::update(const ALCcontext* UNUSED(context), const ALeffect } } -void ALcompressorState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) +void CompressorState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) { ALsizei i, j, k; ALsizei base; @@ -159,9 +159,8 @@ void ALcompressorState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sa } -void Compressor_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +void Compressor_setParami(ALeffectProps *props, ALCcontext *context, ALenum param, ALint val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_COMPRESSOR_ONOFF: @@ -175,16 +174,15 @@ void Compressor_setParami(ALeffect *effect, ALCcontext *context, ALenum param, A param); } } -void Compressor_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ Compressor_setParami(effect, context, param, vals[0]); } -void Compressor_setParamf(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat UNUSED(val)) +void Compressor_setParamiv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +{ Compressor_setParami(props, context, param, vals[0]); } +void Compressor_setParamf(ALeffectProps*, ALCcontext *context, ALenum param, ALfloat) { alSetError(context, AL_INVALID_ENUM, "Invalid compressor float property 0x%04x", param); } -void Compressor_setParamfv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALfloat *UNUSED(vals)) +void Compressor_setParamfv(ALeffectProps*, ALCcontext *context, ALenum param, const ALfloat*) { alSetError(context, AL_INVALID_ENUM, "Invalid compressor float-vector property 0x%04x", param); } -void Compressor_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +void Compressor_getParami(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_COMPRESSOR_ONOFF: @@ -196,18 +194,18 @@ void Compressor_getParami(const ALeffect *effect, ALCcontext *context, ALenum pa param); } } -void Compressor_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ Compressor_getParami(effect, context, param, vals); } -void Compressor_getParamf(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat *UNUSED(val)) +void Compressor_getParamiv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +{ Compressor_getParami(props, context, param, vals); } +void Compressor_getParamf(const ALeffectProps*, ALCcontext *context, ALenum param, ALfloat*) { alSetError(context, AL_INVALID_ENUM, "Invalid compressor float property 0x%04x", param); } -void Compressor_getParamfv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat *UNUSED(vals)) +void Compressor_getParamfv(const ALeffectProps*, ALCcontext *context, ALenum param, ALfloat*) { alSetError(context, AL_INVALID_ENUM, "Invalid compressor float-vector property 0x%04x", param); } DEFINE_ALEFFECT_VTABLE(Compressor); struct CompressorStateFactory final : public EffectStateFactory { - EffectState *create() override { return new ALcompressorState{}; } + EffectState *create() override { return new CompressorState{}; } ALeffectProps getDefaultProps() const noexcept override; const EffectVtable *getEffectVtable() const noexcept override { return &Compressor_vtable; } }; diff --git a/Alc/effects/dedicated.cpp b/Alc/effects/dedicated.cpp index 7fc46b12..7d274ecc 100644 --- a/Alc/effects/dedicated.cpp +++ b/Alc/effects/dedicated.cpp @@ -97,13 +97,12 @@ void DedicatedState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sampl } -void Dedicated_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +void Dedicated_setParami(ALeffectProps*, ALCcontext *context, ALenum param, ALint) { alSetError(context, AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param); } -void Dedicated_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +void Dedicated_setParamiv(ALeffectProps*, ALCcontext *context, ALenum param, const ALint*) { alSetError(context, AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x", param); } -void Dedicated_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +void Dedicated_setParamf(ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_DEDICATED_GAIN: @@ -116,16 +115,15 @@ void Dedicated_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, AL alSetError(context, AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param); } } -void Dedicated_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ Dedicated_setParamf(effect, context, param, vals[0]); } +void Dedicated_setParamfv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +{ Dedicated_setParamf(props, context, param, vals[0]); } -void Dedicated_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +void Dedicated_getParami(const ALeffectProps*, ALCcontext *context, ALenum param, ALint*) { alSetError(context, AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param); } -void Dedicated_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +void Dedicated_getParamiv(const ALeffectProps*, ALCcontext *context, ALenum param, ALint*) { alSetError(context, AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x", param); } -void Dedicated_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +void Dedicated_getParamf(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_DEDICATED_GAIN: @@ -136,8 +134,8 @@ void Dedicated_getParamf(const ALeffect *effect, ALCcontext *context, ALenum par alSetError(context, AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param); } } -void Dedicated_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ Dedicated_getParamf(effect, context, param, vals); } +void Dedicated_getParamfv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +{ Dedicated_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Dedicated); diff --git a/Alc/effects/distortion.cpp b/Alc/effects/distortion.cpp index 5c0d5cec..1bc3b626 100644 --- a/Alc/effects/distortion.cpp +++ b/Alc/effects/distortion.cpp @@ -164,13 +164,12 @@ void DistortionState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samp } -void Distortion_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +void Distortion_setParami(ALeffectProps*, ALCcontext *context, ALenum param, ALint) { alSetError(context, AL_INVALID_ENUM, "Invalid distortion integer property 0x%04x", param); } -void Distortion_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +void Distortion_setParamiv(ALeffectProps*, ALCcontext *context, ALenum param, const ALint*) { alSetError(context, AL_INVALID_ENUM, "Invalid distortion integer-vector property 0x%04x", param); } -void Distortion_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +void Distortion_setParamf(ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_DISTORTION_EDGE: @@ -208,16 +207,15 @@ void Distortion_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, A param); } } -void Distortion_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ Distortion_setParamf(effect, context, param, vals[0]); } +void Distortion_setParamfv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +{ Distortion_setParamf(props, context, param, vals[0]); } -void Distortion_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +void Distortion_getParami(const ALeffectProps*, ALCcontext *context, ALenum param, ALint*) { alSetError(context, AL_INVALID_ENUM, "Invalid distortion integer property 0x%04x", param); } -void Distortion_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +void Distortion_getParamiv(const ALeffectProps*, ALCcontext *context, ALenum param, ALint*) { alSetError(context, AL_INVALID_ENUM, "Invalid distortion integer-vector property 0x%04x", param); } -void Distortion_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +void Distortion_getParamf(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_DISTORTION_EDGE: @@ -245,8 +243,8 @@ void Distortion_getParamf(const ALeffect *effect, ALCcontext *context, ALenum pa param); } } -void Distortion_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ Distortion_getParamf(effect, context, param, vals); } +void Distortion_getParamfv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +{ Distortion_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Distortion); diff --git a/Alc/effects/echo.cpp b/Alc/effects/echo.cpp index 5b03b607..08c0ac39 100644 --- a/Alc/effects/echo.cpp +++ b/Alc/effects/echo.cpp @@ -175,13 +175,12 @@ void EchoState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn) } -void Echo_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +void Echo_setParami(ALeffectProps*, ALCcontext *context, ALenum param, ALint) { alSetError(context, AL_INVALID_ENUM, "Invalid echo integer property 0x%04x", param); } -void Echo_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +void Echo_setParamiv(ALeffectProps*, ALCcontext *context, ALenum param, const ALint*) { alSetError(context, AL_INVALID_ENUM, "Invalid echo integer-vector property 0x%04x", param); } -void Echo_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +void Echo_setParamf(ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_ECHO_DELAY: @@ -218,16 +217,15 @@ void Echo_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat alSetError(context, AL_INVALID_ENUM, "Invalid echo float property 0x%04x", param); } } -void Echo_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ Echo_setParamf(effect, context, param, vals[0]); } +void Echo_setParamfv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +{ Echo_setParamf(props, context, param, vals[0]); } -void Echo_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +void Echo_getParami(const ALeffectProps*, ALCcontext *context, ALenum param, ALint*) { alSetError(context, AL_INVALID_ENUM, "Invalid echo integer property 0x%04x", param); } -void Echo_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +void Echo_getParamiv(const ALeffectProps*, ALCcontext *context, ALenum param, ALint*) { alSetError(context, AL_INVALID_ENUM, "Invalid echo integer-vector property 0x%04x", param); } -void Echo_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +void Echo_getParamf(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_ECHO_DELAY: @@ -254,8 +252,8 @@ void Echo_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, A alSetError(context, AL_INVALID_ENUM, "Invalid echo float property 0x%04x", param); } } -void Echo_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ Echo_getParamf(effect, context, param, vals); } +void Echo_getParamfv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +{ Echo_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Echo); diff --git a/Alc/effects/equalizer.cpp b/Alc/effects/equalizer.cpp index cecdf311..e9c75d53 100644 --- a/Alc/effects/equalizer.cpp +++ b/Alc/effects/equalizer.cpp @@ -174,13 +174,12 @@ void EqualizerState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sampl } -void Equalizer_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +void Equalizer_setParami(ALeffectProps*, ALCcontext *context, ALenum param, ALint) { alSetError(context, AL_INVALID_ENUM, "Invalid equalizer integer property 0x%04x", param); } -void Equalizer_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +void Equalizer_setParamiv(ALeffectProps*, ALCcontext *context, ALenum param, const ALint*) { alSetError(context, AL_INVALID_ENUM, "Invalid equalizer integer-vector property 0x%04x", param); } -void Equalizer_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +void Equalizer_setParamf(ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_EQUALIZER_LOW_GAIN: @@ -247,16 +246,15 @@ void Equalizer_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, AL alSetError(context, AL_INVALID_ENUM, "Invalid equalizer float property 0x%04x", param); } } -void Equalizer_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ Equalizer_setParamf(effect, context, param, vals[0]); } +void Equalizer_setParamfv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +{ Equalizer_setParamf(props, context, param, vals[0]); } -void Equalizer_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +void Equalizer_getParami(const ALeffectProps*, ALCcontext *context, ALenum param, ALint*) { alSetError(context, AL_INVALID_ENUM, "Invalid equalizer integer property 0x%04x", param); } -void Equalizer_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +void Equalizer_getParamiv(const ALeffectProps*, ALCcontext *context, ALenum param, ALint*) { alSetError(context, AL_INVALID_ENUM, "Invalid equalizer integer-vector property 0x%04x", param); } -void Equalizer_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +void Equalizer_getParamf(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_EQUALIZER_LOW_GAIN: @@ -303,8 +301,8 @@ void Equalizer_getParamf(const ALeffect *effect, ALCcontext *context, ALenum par alSetError(context, AL_INVALID_ENUM, "Invalid equalizer float property 0x%04x", param); } } -void Equalizer_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ Equalizer_getParamf(effect, context, param, vals); } +void Equalizer_getParamfv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +{ Equalizer_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Equalizer); diff --git a/Alc/effects/fshifter.cpp b/Alc/effects/fshifter.cpp index 17d9890e..727901b9 100644 --- a/Alc/effects/fshifter.cpp +++ b/Alc/effects/fshifter.cpp @@ -203,9 +203,8 @@ void FshifterState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sample } -void Fshifter_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +void Fshifter_setParamf(ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_FREQUENCY_SHIFTER_FREQUENCY: @@ -218,12 +217,11 @@ void Fshifter_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALf alSetError(context, AL_INVALID_ENUM, "Invalid frequency shifter float property 0x%04x", param); } } -void Fshifter_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ Fshifter_setParamf(effect, context, param, vals[0]); } +void Fshifter_setParamfv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +{ Fshifter_setParamf(props, context, param, vals[0]); } -void Fshifter_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +void Fshifter_setParami(ALeffectProps *props, ALCcontext *context, ALenum param, ALint val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_FREQUENCY_SHIFTER_LEFT_DIRECTION: @@ -242,12 +240,11 @@ void Fshifter_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALi alSetError(context, AL_INVALID_ENUM, "Invalid frequency shifter integer property 0x%04x", param); } } -void Fshifter_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ Fshifter_setParami(effect, context, param, vals[0]); } +void Fshifter_setParamiv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +{ Fshifter_setParami(props, context, param, vals[0]); } -void Fshifter_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +void Fshifter_getParami(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_FREQUENCY_SHIFTER_LEFT_DIRECTION: @@ -260,12 +257,11 @@ void Fshifter_getParami(const ALeffect *effect, ALCcontext *context, ALenum para alSetError(context, AL_INVALID_ENUM, "Invalid frequency shifter integer property 0x%04x", param); } } -void Fshifter_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ Fshifter_getParami(effect, context, param, vals); } +void Fshifter_getParamiv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +{ Fshifter_getParami(props, context, param, vals); } -void Fshifter_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +void Fshifter_getParamf(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_FREQUENCY_SHIFTER_FREQUENCY: @@ -276,8 +272,8 @@ void Fshifter_getParamf(const ALeffect *effect, ALCcontext *context, ALenum para alSetError(context, AL_INVALID_ENUM, "Invalid frequency shifter float property 0x%04x", param); } } -void Fshifter_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ Fshifter_getParamf(effect, context, param, vals); } +void Fshifter_getParamfv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +{ Fshifter_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Fshifter); diff --git a/Alc/effects/modulator.cpp b/Alc/effects/modulator.cpp index 6c837e29..7e452792 100644 --- a/Alc/effects/modulator.cpp +++ b/Alc/effects/modulator.cpp @@ -173,9 +173,8 @@ void ModulatorState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sampl } -void Modulator_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +void Modulator_setParamf(ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_RING_MODULATOR_FREQUENCY: @@ -194,16 +193,15 @@ void Modulator_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, AL alSetError(context, AL_INVALID_ENUM, "Invalid modulator float property 0x%04x", param); } } -void Modulator_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ Modulator_setParamf(effect, context, param, vals[0]); } -void Modulator_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +void Modulator_setParamfv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +{ Modulator_setParamf(props, context, param, vals[0]); } +void Modulator_setParami(ALeffectProps *props, ALCcontext *context, ALenum param, ALint val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_RING_MODULATOR_FREQUENCY: case AL_RING_MODULATOR_HIGHPASS_CUTOFF: - Modulator_setParamf(effect, context, param, static_cast<ALfloat>(val)); + Modulator_setParamf(props, context, param, static_cast<ALfloat>(val)); break; case AL_RING_MODULATOR_WAVEFORM: @@ -216,12 +214,11 @@ void Modulator_setParami(ALeffect *effect, ALCcontext *context, ALenum param, AL alSetError(context, AL_INVALID_ENUM, "Invalid modulator integer property 0x%04x", param); } } -void Modulator_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ Modulator_setParami(effect, context, param, vals[0]); } +void Modulator_setParamiv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +{ Modulator_setParami(props, context, param, vals[0]); } -void Modulator_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +void Modulator_getParami(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_RING_MODULATOR_FREQUENCY: @@ -238,11 +235,10 @@ void Modulator_getParami(const ALeffect *effect, ALCcontext *context, ALenum par alSetError(context, AL_INVALID_ENUM, "Invalid modulator integer property 0x%04x", param); } } -void Modulator_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ Modulator_getParami(effect, context, param, vals); } -void Modulator_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +void Modulator_getParamiv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +{ Modulator_getParami(props, context, param, vals); } +void Modulator_getParamf(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_RING_MODULATOR_FREQUENCY: @@ -256,8 +252,8 @@ void Modulator_getParamf(const ALeffect *effect, ALCcontext *context, ALenum par alSetError(context, AL_INVALID_ENUM, "Invalid modulator float property 0x%04x", param); } } -void Modulator_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ Modulator_getParamf(effect, context, param, vals); } +void Modulator_getParamfv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +{ Modulator_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Modulator); diff --git a/Alc/effects/null.cpp b/Alc/effects/null.cpp index 5f7d3a36..eff9f930 100644 --- a/Alc/effects/null.cpp +++ b/Alc/effects/null.cpp @@ -29,14 +29,15 @@ struct NullState final : public EffectState { */ NullState::NullState() = default; -/* This destructs the effect state. It's called only when the effect slot is no - * longer used prior to being freed. +/* This destructs the effect state. It's called only when the effect instance + * is no longer used. */ NullState::~NullState() = default; /* This updates the device-dependant effect state. This is called on - * initialization and any time the device parameters (eg. playback frequency, - * format) have been changed. + * initialization and any time the device parameters (e.g. playback frequency, + * format) have been changed. Will always be followed by a call to the update + * method, if successful. */ ALboolean NullState::deviceUpdate(const ALCdevice* UNUSED(device)) { @@ -59,7 +60,7 @@ void NullState::process(ALsizei /*samplesToDo*/, const ALfloat (*RESTRICT /*samp } -void Null_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +void NullEffect_setParami(ALeffectProps *UNUSED(props), ALCcontext *context, ALenum param, ALint UNUSED(val)) { switch(param) { @@ -67,15 +68,15 @@ void Null_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x", param); } } -void Null_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint* UNUSED(vals)) +void NullEffect_setParamiv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) { switch(param) { default: - alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer-vector property 0x%04x", param); + NullEffect_setParami(props, context, param, vals[0]); } } -void Null_setParamf(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat UNUSED(val)) +void NullEffect_setParamf(ALeffectProps *UNUSED(props), ALCcontext *context, ALenum param, ALfloat UNUSED(val)) { switch(param) { @@ -83,16 +84,16 @@ void Null_setParamf(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, alSetError(context, AL_INVALID_ENUM, "Invalid null effect float property 0x%04x", param); } } -void Null_setParamfv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALfloat* UNUSED(vals)) +void NullEffect_setParamfv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) { switch(param) { default: - alSetError(context, AL_INVALID_ENUM, "Invalid null effect float-vector property 0x%04x", param); + NullEffect_setParamf(props, context, param, vals[0]); } } -void Null_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(val)) +void NullEffect_getParami(const ALeffectProps *UNUSED(props), ALCcontext *context, ALenum param, ALint* UNUSED(val)) { switch(param) { @@ -100,15 +101,15 @@ void Null_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x", param); } } -void Null_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(vals)) +void NullEffect_getParamiv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *vals) { switch(param) { default: - alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer-vector property 0x%04x", param); + NullEffect_getParami(props, context, param, vals); } } -void Null_getParamf(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(val)) +void NullEffect_getParamf(const ALeffectProps *UNUSED(props), ALCcontext *context, ALenum param, ALfloat* UNUSED(val)) { switch(param) { @@ -116,35 +117,41 @@ void Null_getParamf(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum alSetError(context, AL_INVALID_ENUM, "Invalid null effect float property 0x%04x", param); } } -void Null_getParamfv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(vals)) +void NullEffect_getParamfv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) { switch(param) { default: - alSetError(context, AL_INVALID_ENUM, "Invalid null effect float-vector property 0x%04x", param); + NullEffect_getParamf(props, context, param, vals); } } -DEFINE_ALEFFECT_VTABLE(Null); +DEFINE_ALEFFECT_VTABLE(NullEffect); struct NullStateFactory final : public EffectStateFactory { EffectState *create() override; ALeffectProps getDefaultProps() const noexcept override; - const EffectVtable *getEffectVtable() const noexcept override { return &Null_vtable; } + const EffectVtable *getEffectVtable() const noexcept override; }; /* Creates EffectState objects of the appropriate type. */ EffectState *NullStateFactory::create() { return new NullState{}; } -/* Returns an ALeffectProps initialized with this effect's default properties. */ +/* Returns an ALeffectProps initialized with this effect type's default + * property values. + */ ALeffectProps NullStateFactory::getDefaultProps() const noexcept { ALeffectProps props{}; return props; } +/* Returns a pointer to this effect type's global set/get vtable. */ +const EffectVtable *NullStateFactory::getEffectVtable() const noexcept +{ return &NullEffect_vtable; } + } // namespace EffectStateFactory *NullStateFactory_getFactory() diff --git a/Alc/effects/pshifter.cpp b/Alc/effects/pshifter.cpp index b5b39003..d1d31a66 100644 --- a/Alc/effects/pshifter.cpp +++ b/Alc/effects/pshifter.cpp @@ -326,14 +326,13 @@ void PshifterState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sample } -void Pshifter_setParamf(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat UNUSED(val)) +void Pshifter_setParamf(ALeffectProps*, ALCcontext *context, ALenum param, ALfloat) { alSetError(context, AL_INVALID_ENUM, "Invalid pitch shifter float property 0x%04x", param); } -void Pshifter_setParamfv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALfloat *UNUSED(vals)) +void Pshifter_setParamfv(ALeffectProps*, ALCcontext *context, ALenum param, const ALfloat*) { alSetError(context, AL_INVALID_ENUM, "Invalid pitch shifter float-vector property 0x%04x", param); } -void Pshifter_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +void Pshifter_setParami(ALeffectProps *props, ALCcontext *context, ALenum param, ALint val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_PITCH_SHIFTER_COARSE_TUNE: @@ -352,12 +351,11 @@ void Pshifter_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALi alSetError(context, AL_INVALID_ENUM, "Invalid pitch shifter integer property 0x%04x", param); } } -void Pshifter_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ Pshifter_setParami(effect, context, param, vals[0]); } +void Pshifter_setParamiv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +{ Pshifter_setParami(props, context, param, vals[0]); } -void Pshifter_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +void Pshifter_getParami(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_PITCH_SHIFTER_COARSE_TUNE: @@ -371,12 +369,12 @@ void Pshifter_getParami(const ALeffect *effect, ALCcontext *context, ALenum para alSetError(context, AL_INVALID_ENUM, "Invalid pitch shifter integer property 0x%04x", param); } } -void Pshifter_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ Pshifter_getParami(effect, context, param, vals); } +void Pshifter_getParamiv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +{ Pshifter_getParami(props, context, param, vals); } -void Pshifter_getParamf(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat *UNUSED(val)) +void Pshifter_getParamf(const ALeffectProps*, ALCcontext *context, ALenum param, ALfloat*) { alSetError(context, AL_INVALID_ENUM, "Invalid pitch shifter float property 0x%04x", param); } -void Pshifter_getParamfv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat *UNUSED(vals)) +void Pshifter_getParamfv(const ALeffectProps*, ALCcontext *context, ALenum param, ALfloat*) { alSetError(context, AL_INVALID_ENUM, "Invalid pitch shifter float vector-property 0x%04x", param); } DEFINE_ALEFFECT_VTABLE(Pshifter); diff --git a/Alc/effects/reverb.cpp b/Alc/effects/reverb.cpp index 66c6fe44..a32447b2 100644 --- a/Alc/effects/reverb.cpp +++ b/Alc/effects/reverb.cpp @@ -1462,9 +1462,8 @@ void ReverbState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesI } -void EAXReverb_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +void EAXReverb_setParami(ALeffectProps *props, ALCcontext *context, ALenum param, ALint val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_EAXREVERB_DECAY_HFLIMIT: @@ -1478,11 +1477,10 @@ void EAXReverb_setParami(ALeffect *effect, ALCcontext *context, ALenum param, AL param); } } -void EAXReverb_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ EAXReverb_setParami(effect, context, param, vals[0]); } -void EAXReverb_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +void EAXReverb_setParamiv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +{ EAXReverb_setParami(props, context, param, vals[0]); } +void EAXReverb_setParamf(ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_EAXREVERB_DENSITY: @@ -1610,9 +1608,8 @@ void EAXReverb_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, AL param); } } -void EAXReverb_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) +void EAXReverb_setParamfv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_EAXREVERB_REFLECTIONS_PAN: @@ -1631,14 +1628,13 @@ void EAXReverb_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, c break; default: - EAXReverb_setParamf(effect, context, param, vals[0]); + EAXReverb_setParamf(props, context, param, vals[0]); break; } } -void EAXReverb_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +void EAXReverb_getParami(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_EAXREVERB_DECAY_HFLIMIT: @@ -1650,11 +1646,10 @@ void EAXReverb_getParami(const ALeffect *effect, ALCcontext *context, ALenum par param); } } -void EAXReverb_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ EAXReverb_getParami(effect, context, param, vals); } -void EAXReverb_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +void EAXReverb_getParamiv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +{ EAXReverb_getParami(props, context, param, vals); } +void EAXReverb_getParamf(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_EAXREVERB_DENSITY: @@ -1742,9 +1737,8 @@ void EAXReverb_getParamf(const ALeffect *effect, ALCcontext *context, ALenum par param); } } -void EAXReverb_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) +void EAXReverb_getParamfv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_EAXREVERB_REFLECTIONS_PAN: @@ -1759,7 +1753,7 @@ void EAXReverb_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum pa break; default: - EAXReverb_getParamf(effect, context, param, vals); + EAXReverb_getParamf(props, context, param, vals); break; } } @@ -1807,9 +1801,8 @@ ALeffectProps ReverbStateFactory::getDefaultProps() const noexcept } -void StdReverb_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +void StdReverb_setParami(ALeffectProps *props, ALCcontext *context, ALenum param, ALint val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_REVERB_DECAY_HFLIMIT: @@ -1822,11 +1815,10 @@ void StdReverb_setParami(ALeffect *effect, ALCcontext *context, ALenum param, AL alSetError(context, AL_INVALID_ENUM, "Invalid reverb integer property 0x%04x", param); } } -void StdReverb_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ StdReverb_setParami(effect, context, param, vals[0]); } -void StdReverb_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +void StdReverb_setParamiv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +{ StdReverb_setParami(props, context, param, vals[0]); } +void StdReverb_setParamf(ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat val) { - ALeffectProps *props = &effect->Props; switch(param) { case AL_REVERB_DENSITY: @@ -1905,12 +1897,11 @@ void StdReverb_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, AL alSetError(context, AL_INVALID_ENUM, "Invalid reverb float property 0x%04x", param); } } -void StdReverb_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ StdReverb_setParamf(effect, context, param, vals[0]); } +void StdReverb_setParamfv(ALeffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +{ StdReverb_setParamf(props, context, param, vals[0]); } -void StdReverb_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +void StdReverb_getParami(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_REVERB_DECAY_HFLIMIT: @@ -1921,11 +1912,10 @@ void StdReverb_getParami(const ALeffect *effect, ALCcontext *context, ALenum par alSetError(context, AL_INVALID_ENUM, "Invalid reverb integer property 0x%04x", param); } } -void StdReverb_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ StdReverb_getParami(effect, context, param, vals); } -void StdReverb_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +void StdReverb_getParamiv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +{ StdReverb_getParami(props, context, param, vals); } +void StdReverb_getParamf(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) { - const ALeffectProps *props = &effect->Props; switch(param) { case AL_REVERB_DENSITY: @@ -1980,8 +1970,8 @@ void StdReverb_getParamf(const ALeffect *effect, ALCcontext *context, ALenum par alSetError(context, AL_INVALID_ENUM, "Invalid reverb float property 0x%04x", param); } } -void StdReverb_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ StdReverb_getParamf(effect, context, param, vals); } +void StdReverb_getParamfv(const ALeffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +{ StdReverb_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(StdReverb); diff --git a/OpenAL32/Include/alEffect.h b/OpenAL32/Include/alEffect.h index fdd1b017..005478c6 100644 --- a/OpenAL32/Include/alEffect.h +++ b/OpenAL32/Include/alEffect.h @@ -151,14 +151,6 @@ struct ALeffect { /* Self ID */ ALuint id{0u}; }; -#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/alEffect.cpp b/OpenAL32/alEffect.cpp index 275ac34c..8b89fd45 100644 --- a/OpenAL32/alEffect.cpp +++ b/OpenAL32/alEffect.cpp @@ -79,6 +79,33 @@ constexpr struct FactoryItem { }; +template<typename... T> +void ALeffect_setParami(ALeffect *effect, T&& ...args) +{ effect->vtab->setParami(&effect->Props, std::forward<T>(args)...); } +template<typename... T> +void ALeffect_setParamiv(ALeffect *effect, T&& ...args) +{ effect->vtab->setParamiv(&effect->Props, std::forward<T>(args)...); } +template<typename... T> +void ALeffect_setParamf(ALeffect *effect, T&& ...args) +{ effect->vtab->setParamf(&effect->Props, std::forward<T>(args)...); } +template<typename... T> +void ALeffect_setParamfv(ALeffect *effect, T&& ...args) +{ effect->vtab->setParamfv(&effect->Props, std::forward<T>(args)...); } + +template<typename... T> +void ALeffect_getParami(const ALeffect *effect, T&& ...args) +{ effect->vtab->getParami(&effect->Props, std::forward<T>(args)...); } +template<typename... T> +void ALeffect_getParamiv(const ALeffect *effect, T&& ...args) +{ effect->vtab->getParamiv(&effect->Props, std::forward<T>(args)...); } +template<typename... T> +void ALeffect_getParamf(const ALeffect *effect, T&& ...args) +{ effect->vtab->getParamf(&effect->Props, std::forward<T>(args)...); } +template<typename... T> +void ALeffect_getParamfv(const ALeffect *effect, T&& ...args) +{ effect->vtab->getParamfv(&effect->Props, std::forward<T>(args)...); } + + void InitEffectParams(ALeffect *effect, ALenum type) { EffectStateFactory *factory = getFactoryByType(type); |