7 #include "al/auxeffectslot.h"
12 #include "effects/base.h"
17 struct NullState final
: public EffectState
{
19 ~NullState() override
;
21 void 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 void NullState::deviceUpdate(const ALCdevice
* /*device*/)
47 /* This updates the effect state with new properties. This is called any time
48 * the effect is (re)loaded into a slot.
50 void NullState::update(const ALCcontext
* /*context*/, const ALeffectslot
* /*slot*/,
51 const EffectProps
* /*props*/, const EffectTarget
/*target*/)
55 /* This processes the effect state, for the given number of samples from the
56 * input to the output buffer. The result should be added to the output buffer,
59 void NullState::process(const size_t/*samplesToDo*/,
60 const al::span
<const FloatBufferLine
> /*samplesIn*/,
61 const al::span
<FloatBufferLine
> /*samplesOut*/)
66 void NullEffect_setParami(EffectProps
* /*props*/, ALenum param
, int /*val*/)
71 throw effect_exception
{AL_INVALID_ENUM
, "Invalid null effect integer property 0x%04x",
75 void NullEffect_setParamiv(EffectProps
*props
, ALenum param
, const int *vals
)
80 NullEffect_setParami(props
, param
, vals
[0]);
83 void NullEffect_setParamf(EffectProps
* /*props*/, ALenum param
, float /*val*/)
88 throw effect_exception
{AL_INVALID_ENUM
, "Invalid null effect float property 0x%04x",
92 void NullEffect_setParamfv(EffectProps
*props
, ALenum param
, const float *vals
)
97 NullEffect_setParamf(props
, param
, vals
[0]);
101 void NullEffect_getParami(const EffectProps
* /*props*/, ALenum param
, int* /*val*/)
106 throw effect_exception
{AL_INVALID_ENUM
, "Invalid null effect integer property 0x%04x",
110 void NullEffect_getParamiv(const EffectProps
*props
, ALenum param
, int *vals
)
115 NullEffect_getParami(props
, param
, vals
);
118 void NullEffect_getParamf(const EffectProps
* /*props*/, ALenum param
, float* /*val*/)
123 throw effect_exception
{AL_INVALID_ENUM
, "Invalid null effect float property 0x%04x",
127 void NullEffect_getParamfv(const EffectProps
*props
, ALenum param
, float *vals
)
132 NullEffect_getParamf(props
, param
, vals
);
136 DEFINE_ALEFFECT_VTABLE(NullEffect
);
139 struct NullStateFactory final
: public EffectStateFactory
{
140 EffectState
*create() override
;
141 EffectProps
getDefaultProps() const noexcept override
;
142 const EffectVtable
*getEffectVtable() const noexcept override
;
145 /* Creates EffectState objects of the appropriate type. */
146 EffectState
*NullStateFactory::create()
147 { return new NullState
{}; }
149 /* Returns an ALeffectProps initialized with this effect type's default
152 EffectProps
NullStateFactory::getDefaultProps() const noexcept
158 /* Returns a pointer to this effect type's global set/get vtable. */
159 const EffectVtable
*NullStateFactory::getEffectVtable() const noexcept
160 { return &NullEffect_vtable
; }
164 EffectStateFactory
*NullStateFactory_getFactory()
166 static NullStateFactory NullFactory
{};