Clean up some unnecessary includes
[openal-soft.git] / alc / effects / null.cpp
blobe0497296a274015ba116b5e5f45eb64ecde57558
2 #include "config.h"
4 #include "AL/al.h"
5 #include "AL/alc.h"
7 #include "al/auxeffectslot.h"
8 #include "alcmain.h"
9 #include "alcontext.h"
10 #include "almalloc.h"
11 #include "alspan.h"
12 #include "effects/base.h"
15 namespace {
17 struct NullState final : public EffectState {
18 NullState();
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;
25 DEF_NEWDEL(NullState)
28 /* This constructs the effect state. It's called when the object is first
29 * created.
31 NullState::NullState() = default;
33 /* This destructs the effect state. It's called only when the effect instance
34 * is no longer used.
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*/)
45 return AL_TRUE;
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,
58 * not replace it.
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*/)
69 switch(param)
71 default:
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)
77 switch(param)
79 default:
80 NullEffect_setParami(props, context, param, vals[0]);
83 void NullEffect_setParamf(EffectProps* /*props*/, ALCcontext *context, ALenum param, ALfloat /*val*/)
85 switch(param)
87 default:
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)
93 switch(param)
95 default:
96 NullEffect_setParamf(props, context, param, vals[0]);
100 void NullEffect_getParami(const EffectProps* /*props*/, ALCcontext *context, ALenum param, ALint* /*val*/)
102 switch(param)
104 default:
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)
110 switch(param)
112 default:
113 NullEffect_getParami(props, context, param, vals);
116 void NullEffect_getParamf(const EffectProps* /*props*/, ALCcontext *context, ALenum param, ALfloat* /*val*/)
118 switch(param)
120 default:
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)
126 switch(param)
128 default:
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
147 * property values.
149 EffectProps NullStateFactory::getDefaultProps() const noexcept
151 EffectProps props{};
152 return props;
155 /* Returns a pointer to this effect type's global set/get vtable. */
156 const EffectVtable *NullStateFactory::getEffectVtable() const noexcept
157 { return &NullEffect_vtable; }
159 } // namespace
161 EffectStateFactory *NullStateFactory_getFactory()
163 static NullStateFactory NullFactory{};
164 return &NullFactory;