Don't rely on terminate in a catch block giving a useful message
[openal-soft.git] / alc / effects / null.cpp
blob217181a8e710551988e18e9b9684ec2773319adb
2 #include "config.h"
4 #include <cstddef>
6 #include "alspan.h"
7 #include "base.h"
8 #include "core/bufferline.h"
9 #include "core/effects/base.h"
10 #include "intrusive_ptr.h"
12 struct BufferStorage;
13 struct ContextBase;
14 struct DeviceBase;
15 struct EffectSlot;
18 namespace {
20 struct NullState final : public EffectState {
21 NullState();
22 ~NullState() override;
24 void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override;
25 void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props,
26 const EffectTarget target) override;
27 void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn,
28 const al::span<FloatBufferLine> samplesOut) override;
31 /* This constructs the effect state. It's called when the object is first
32 * created.
34 NullState::NullState() = default;
36 /* This destructs the effect state. It's called only when the effect instance
37 * is no longer used.
39 NullState::~NullState() = default;
41 /* This updates the device-dependant effect state. This is called on state
42 * initialization and any time the device parameters (e.g. playback frequency,
43 * format) have been changed. Will always be followed by a call to the update
44 * method, if successful.
46 void NullState::deviceUpdate(const DeviceBase* /*device*/, const BufferStorage* /*buffer*/)
50 /* This updates the effect state with new properties. This is called any time
51 * the effect is (re)loaded into a slot.
53 void NullState::update(const ContextBase* /*context*/, const EffectSlot* /*slot*/,
54 const EffectProps* /*props*/, const EffectTarget /*target*/)
58 /* This processes the effect state, for the given number of samples from the
59 * input to the output buffer. The result should be added to the output buffer,
60 * not replace it.
62 void NullState::process(const size_t/*samplesToDo*/,
63 const al::span<const FloatBufferLine> /*samplesIn*/,
64 const al::span<FloatBufferLine> /*samplesOut*/)
69 struct NullStateFactory final : public EffectStateFactory {
70 al::intrusive_ptr<EffectState> create() override;
73 /* Creates EffectState objects of the appropriate type. */
74 al::intrusive_ptr<EffectState> NullStateFactory::create()
75 { return al::intrusive_ptr<EffectState>{new NullState{}}; }
77 } // namespace
79 EffectStateFactory *NullStateFactory_getFactory()
81 static NullStateFactory NullFactory{};
82 return &NullFactory;