diff options
Diffstat (limited to 'Alc/effects/null.cpp')
-rw-r--r-- | Alc/effects/null.cpp | 87 |
1 files changed, 44 insertions, 43 deletions
diff --git a/Alc/effects/null.cpp b/Alc/effects/null.cpp index 0e9c982d..5f7d3a36 100644 --- a/Alc/effects/null.cpp +++ b/Alc/effects/null.cpp @@ -13,32 +13,32 @@ namespace { -struct ALnullState final : public EffectState { - ALnullState(); - ~ALnullState() override; +struct NullState final : public EffectState { + NullState(); + ~NullState() override; ALboolean deviceUpdate(const ALCdevice *device) override; 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(ALnullState) + DEF_NEWDEL(NullState) }; /* This constructs the effect state. It's called when the object is first * created. */ -ALnullState::ALnullState() = default; +NullState::NullState() = default; /* This destructs the effect state. It's called only when the effect slot is no * longer used prior to being freed. */ -ALnullState::~ALnullState() = default; +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. */ -ALboolean ALnullState::deviceUpdate(const ALCdevice* UNUSED(device)) +ALboolean NullState::deviceUpdate(const ALCdevice* UNUSED(device)) { return AL_TRUE; } @@ -46,7 +46,7 @@ ALboolean ALnullState::deviceUpdate(const ALCdevice* UNUSED(device)) /* This updates the effect state. This is called any time the effect is * (re)loaded into a slot. */ -void ALnullState::update(const ALCcontext* UNUSED(context), const ALeffectslot* UNUSED(slot), const ALeffectProps* UNUSED(props), const EffectTarget UNUSED(target)) +void NullState::update(const ALCcontext* UNUSED(context), const ALeffectslot* UNUSED(slot), const ALeffectProps* UNUSED(props), const EffectTarget UNUSED(target)) { } @@ -54,37 +54,12 @@ void ALnullState::update(const ALCcontext* UNUSED(context), const ALeffectslot* * input to the output buffer. The result should be added to the output buffer, * not replace it. */ -void ALnullState::process(ALsizei /*samplesToDo*/, const ALfloat (*RESTRICT /*samplesIn*/)[BUFFERSIZE], const ALsizei /*numInput*/, ALfloat (*RESTRICT /*samplesOut*/)[BUFFERSIZE], const ALsizei /*numOutput*/) +void NullState::process(ALsizei /*samplesToDo*/, const ALfloat (*RESTRICT /*samplesIn*/)[BUFFERSIZE], const ALsizei /*numInput*/, ALfloat (*RESTRICT /*samplesOut*/)[BUFFERSIZE], const ALsizei /*numOutput*/) { } -struct NullStateFactory final : public EffectStateFactory { - EffectState *create() override; - ALeffectProps getDefaultProps() const noexcept override; -}; - -/* Creates EffectState objects of the appropriate type. */ -EffectState *NullStateFactory::create() -{ return new ALnullState{}; } - -/* Returns an ALeffectProps initialized with this effect's default properties. */ -ALeffectProps NullStateFactory::getDefaultProps() const noexcept -{ - ALeffectProps props{}; - return props; -} - -} // namespace - -EffectStateFactory *NullStateFactory_getFactory() -{ - static NullStateFactory NullFactory{}; - return &NullFactory; -} - - -void ALnull_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +void Null_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) { switch(param) { @@ -92,7 +67,7 @@ void ALnull_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum para alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x", param); } } -void ALnull_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint* UNUSED(vals)) +void Null_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint* UNUSED(vals)) { switch(param) { @@ -100,7 +75,7 @@ void ALnull_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum par alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer-vector property 0x%04x", param); } } -void ALnull_setParamf(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat UNUSED(val)) +void Null_setParamf(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat UNUSED(val)) { switch(param) { @@ -108,7 +83,7 @@ void ALnull_setParamf(ALeffect *UNUSED(effect), ALCcontext *context, ALenum para alSetError(context, AL_INVALID_ENUM, "Invalid null effect float property 0x%04x", param); } } -void ALnull_setParamfv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALfloat* UNUSED(vals)) +void Null_setParamfv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALfloat* UNUSED(vals)) { switch(param) { @@ -117,7 +92,7 @@ void ALnull_setParamfv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum par } } -void ALnull_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(val)) +void Null_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(val)) { switch(param) { @@ -125,7 +100,7 @@ void ALnull_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenu alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x", param); } } -void ALnull_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(vals)) +void Null_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(vals)) { switch(param) { @@ -133,7 +108,7 @@ void ALnull_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALen alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer-vector property 0x%04x", param); } } -void ALnull_getParamf(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(val)) +void Null_getParamf(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(val)) { switch(param) { @@ -141,7 +116,7 @@ void ALnull_getParamf(const ALeffect *UNUSED(effect), ALCcontext *context, ALenu alSetError(context, AL_INVALID_ENUM, "Invalid null effect float property 0x%04x", param); } } -void ALnull_getParamfv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(vals)) +void Null_getParamfv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(vals)) { switch(param) { @@ -150,4 +125,30 @@ void ALnull_getParamfv(const ALeffect *UNUSED(effect), ALCcontext *context, ALen } } -DEFINE_ALEFFECT_VTABLE(ALnull); +DEFINE_ALEFFECT_VTABLE(Null); + + +struct NullStateFactory final : public EffectStateFactory { + EffectState *create() override; + ALeffectProps getDefaultProps() const noexcept override; + const EffectVtable *getEffectVtable() const noexcept override { return &Null_vtable; } +}; + +/* Creates EffectState objects of the appropriate type. */ +EffectState *NullStateFactory::create() +{ return new NullState{}; } + +/* Returns an ALeffectProps initialized with this effect's default properties. */ +ALeffectProps NullStateFactory::getDefaultProps() const noexcept +{ + ALeffectProps props{}; + return props; +} + +} // namespace + +EffectStateFactory *NullStateFactory_getFactory() +{ + static NullStateFactory NullFactory{}; + return &NullFactory; +} |