7 #include "al/auxeffectslot.h"
12 #include "effects/base.h"
17 struct NullState final
: public EffectState
{
19 ~NullState() override
;
21 ALboolean
deviceUpdate(const ALCdevice
*device
) override
;
22 void update(const ALCcontext
*context
, const ALeffectslot
*slot
, const EffectProps
*props
, const EffectTarget target
) override
;
23 void process(const size_t samplesToDo
, const al::span
<const FloatBufferLine
> samplesIn
, const al::span
<FloatBufferLine
> samplesOut
) override
;
28 /* This constructs the effect state. It's called when the object is first
31 NullState::NullState() = default;
33 /* This destructs the effect state. It's called only when the effect instance
36 NullState::~NullState() = default;
38 /* This updates the device-dependant effect state. This is called on state
39 * initialization and any time the device parameters (e.g. playback frequency,
40 * format) have been changed. Will always be followed by a call to the update
41 * method, if successful.
43 ALboolean
NullState::deviceUpdate(const ALCdevice
* /*device*/)
48 /* This updates the effect state with new properties. This is called any time
49 * the effect is (re)loaded into a slot.
51 void NullState::update(const ALCcontext
* /*context*/, const ALeffectslot
* /*slot*/,
52 const EffectProps
* /*props*/, const EffectTarget
/*target*/)
56 /* This processes the effect state, for the given number of samples from the
57 * input to the output buffer. The result should be added to the output buffer,
60 void NullState::process(const size_t/*samplesToDo*/,
61 const al::span
<const FloatBufferLine
> /*samplesIn*/,
62 const al::span
<FloatBufferLine
> /*samplesOut*/)
67 void NullEffect_setParami(EffectProps
* /*props*/, ALCcontext
*context
, ALenum param
, ALint
/*val*/)
72 context
->setError(AL_INVALID_ENUM
, "Invalid null effect integer property 0x%04x", param
);
75 void NullEffect_setParamiv(EffectProps
*props
, ALCcontext
*context
, ALenum param
, const ALint
*vals
)
80 NullEffect_setParami(props
, context
, param
, vals
[0]);
83 void NullEffect_setParamf(EffectProps
* /*props*/, ALCcontext
*context
, ALenum param
, ALfloat
/*val*/)
88 context
->setError(AL_INVALID_ENUM
, "Invalid null effect float property 0x%04x", param
);
91 void NullEffect_setParamfv(EffectProps
*props
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
96 NullEffect_setParamf(props
, context
, param
, vals
[0]);
100 void NullEffect_getParami(const EffectProps
* /*props*/, ALCcontext
*context
, ALenum param
, ALint
* /*val*/)
105 context
->setError(AL_INVALID_ENUM
, "Invalid null effect integer property 0x%04x", param
);
108 void NullEffect_getParamiv(const EffectProps
*props
, ALCcontext
*context
, ALenum param
, ALint
*vals
)
113 NullEffect_getParami(props
, context
, param
, vals
);
116 void NullEffect_getParamf(const EffectProps
* /*props*/, ALCcontext
*context
, ALenum param
, ALfloat
* /*val*/)
121 context
->setError(AL_INVALID_ENUM
, "Invalid null effect float property 0x%04x", param
);
124 void NullEffect_getParamfv(const EffectProps
*props
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
129 NullEffect_getParamf(props
, context
, param
, vals
);
133 DEFINE_ALEFFECT_VTABLE(NullEffect
);
136 struct NullStateFactory final
: public EffectStateFactory
{
137 EffectState
*create() override
;
138 EffectProps
getDefaultProps() const noexcept override
;
139 const EffectVtable
*getEffectVtable() const noexcept override
;
142 /* Creates EffectState objects of the appropriate type. */
143 EffectState
*NullStateFactory::create()
144 { return new NullState
{}; }
146 /* Returns an ALeffectProps initialized with this effect type's default
149 EffectProps
NullStateFactory::getDefaultProps() const noexcept
155 /* Returns a pointer to this effect type's global set/get vtable. */
156 const EffectVtable
*NullStateFactory::getEffectVtable() const noexcept
157 { return &NullEffect_vtable
; }
161 EffectStateFactory
*NullStateFactory_getFactory()
163 static NullStateFactory NullFactory
{};