aboutsummaryrefslogtreecommitdiffstats
path: root/alc/effects
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-08-24 19:10:16 -0700
committerChris Robinson <[email protected]>2020-08-24 19:13:46 -0700
commit9e5a388dfe2dbd5250f80675426c95a9bdade39c (patch)
tree87f73a32036dff620eb571b76e5faf52f428431e /alc/effects
parent9d61484e4bc0b2691b714d758391b3c3ecfd7890 (diff)
Add a method for effects to create persistent buffer data
Diffstat (limited to 'alc/effects')
-rw-r--r--alc/effects/base.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/alc/effects/base.h b/alc/effects/base.h
index 8ed3c6f8..f4ca6df2 100644
--- a/alc/effects/base.h
+++ b/alc/effects/base.h
@@ -8,6 +8,7 @@
#include "almalloc.h"
#include "alspan.h"
#include "atomic.h"
+#include "buffer_formats.h"
#include "intrusive_ptr.h"
struct ALeffectslot;
@@ -154,6 +155,10 @@ const EffectVtable T##_vtable = { \
}
+struct EffectBufferBase : public al::intrusive_ref<EffectBufferBase> {
+ virtual ~EffectBufferBase() = default;
+};
+
struct EffectTarget {
MixParams *Main;
RealMixParams *RealOut;
@@ -166,6 +171,14 @@ struct EffectState : public al::intrusive_ref<EffectState> {
virtual ~EffectState() = default;
virtual void deviceUpdate(const ALCdevice *device) = 0;
+ /* Implementations are currently required to copy the buffer data if they
+ * wish to hold on to it, as there's no guarantee the buffer won't be
+ * detached and deleted or altered during a mix.
+ */
+ virtual EffectBufferBase *createBuffer(const ALCdevice */*device*/,
+ const al::byte */*samplesData*/, ALuint /*sampleRate*/, FmtType /*sampleType*/,
+ FmtChannels /*channelType*/, ALuint /*numSamples*/)
+ { return nullptr; }
virtual void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) = 0;
virtual void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) = 0;
};