diff options
Diffstat (limited to 'alc/effects/null.cpp')
-rw-r--r-- | alc/effects/null.cpp | 117 |
1 files changed, 18 insertions, 99 deletions
diff --git a/alc/effects/null.cpp b/alc/effects/null.cpp index e0497296..1f9ae67b 100644 --- a/alc/effects/null.cpp +++ b/alc/effects/null.cpp @@ -1,15 +1,17 @@ #include "config.h" -#include "AL/al.h" -#include "AL/alc.h" +#include <stddef.h> -#include "al/auxeffectslot.h" -#include "alcmain.h" -#include "alcontext.h" #include "almalloc.h" #include "alspan.h" -#include "effects/base.h" +#include "base.h" +#include "core/bufferline.h" +#include "intrusive_ptr.h" + +struct ContextBase; +struct DeviceBase; +struct EffectSlot; namespace { @@ -18,9 +20,11 @@ struct NullState final : public EffectState { NullState(); ~NullState() override; - ALboolean deviceUpdate(const ALCdevice *device) override; - void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; - void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) override; + void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override; + void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props, + const EffectTarget target) override; + void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, + const al::span<FloatBufferLine> samplesOut) override; DEF_NEWDEL(NullState) }; @@ -40,15 +44,14 @@ NullState::~NullState() = default; * format) have been changed. Will always be followed by a call to the update * method, if successful. */ -ALboolean NullState::deviceUpdate(const ALCdevice* /*device*/) +void NullState::deviceUpdate(const DeviceBase* /*device*/, const BufferStorage* /*buffer*/) { - return AL_TRUE; } /* This updates the effect state with new properties. This is called any time * the effect is (re)loaded into a slot. */ -void NullState::update(const ALCcontext* /*context*/, const ALeffectslot* /*slot*/, +void NullState::update(const ContextBase* /*context*/, const EffectSlot* /*slot*/, const EffectProps* /*props*/, const EffectTarget /*target*/) { } @@ -64,97 +67,13 @@ void NullState::process(const size_t/*samplesToDo*/, } -void NullEffect_setParami(EffectProps* /*props*/, ALCcontext *context, ALenum param, ALint /*val*/) -{ - switch(param) - { - default: - context->setError(AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x", param); - } -} -void NullEffect_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) -{ - switch(param) - { - default: - NullEffect_setParami(props, context, param, vals[0]); - } -} -void NullEffect_setParamf(EffectProps* /*props*/, ALCcontext *context, ALenum param, ALfloat /*val*/) -{ - switch(param) - { - default: - context->setError(AL_INVALID_ENUM, "Invalid null effect float property 0x%04x", param); - } -} -void NullEffect_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - switch(param) - { - default: - NullEffect_setParamf(props, context, param, vals[0]); - } -} - -void NullEffect_getParami(const EffectProps* /*props*/, ALCcontext *context, ALenum param, ALint* /*val*/) -{ - switch(param) - { - default: - context->setError(AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x", param); - } -} -void NullEffect_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, ALint *vals) -{ - switch(param) - { - default: - NullEffect_getParami(props, context, param, vals); - } -} -void NullEffect_getParamf(const EffectProps* /*props*/, ALCcontext *context, ALenum param, ALfloat* /*val*/) -{ - switch(param) - { - default: - context->setError(AL_INVALID_ENUM, "Invalid null effect float property 0x%04x", param); - } -} -void NullEffect_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) -{ - switch(param) - { - default: - NullEffect_getParamf(props, context, param, vals); - } -} - -DEFINE_ALEFFECT_VTABLE(NullEffect); - - struct NullStateFactory final : public EffectStateFactory { - EffectState *create() override; - EffectProps getDefaultProps() const noexcept override; - const EffectVtable *getEffectVtable() const noexcept override; + al::intrusive_ptr<EffectState> create() override; }; /* Creates EffectState objects of the appropriate type. */ -EffectState *NullStateFactory::create() -{ return new NullState{}; } - -/* Returns an ALeffectProps initialized with this effect type's default - * property values. - */ -EffectProps NullStateFactory::getDefaultProps() const noexcept -{ - EffectProps props{}; - return props; -} - -/* Returns a pointer to this effect type's global set/get vtable. */ -const EffectVtable *NullStateFactory::getEffectVtable() const noexcept -{ return &NullEffect_vtable; } +al::intrusive_ptr<EffectState> NullStateFactory::create() +{ return al::intrusive_ptr<EffectState>{new NullState{}}; } } // namespace |