aboutsummaryrefslogtreecommitdiffstats
path: root/al
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 /al
parent9d61484e4bc0b2691b714d758391b3c3ecfd7890 (diff)
Add a method for effects to create persistent buffer data
Diffstat (limited to 'al')
-rw-r--r--al/auxeffectslot.cpp13
-rw-r--r--al/auxeffectslot.h1
2 files changed, 13 insertions, 1 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp
index bfacb290..88512bef 100644
--- a/al/auxeffectslot.cpp
+++ b/al/auxeffectslot.cpp
@@ -460,7 +460,14 @@ START_API_FUNC
DecrementRef(oldbuffer->ref);
slot->Buffer = buffer;
- /* TODO: Create a shared effectstate representation of the buffer. */
+ slot->Effect.Buffer = nullptr;
+ if(buffer)
+ {
+ FPUCtl mixer_mode{};
+ auto *state = slot->Effect.State.get();
+ slot->Effect.Buffer.reset(state->createBuffer(device, buffer->mData.data(),
+ buffer->Frequency, buffer->mFmtType, buffer->mFmtChannels, buffer->SampleLen));
+ }
}
break;
@@ -730,6 +737,10 @@ ALenum ALeffectslot::initEffect(ALeffect *effect, ALCcontext *context)
{
FPUCtl mixer_mode{};
State->deviceUpdate(Device);
+ Effect.Buffer = nullptr;
+ if(Buffer)
+ Effect.Buffer.reset(State->createBuffer(Device, Buffer->mData.data(),
+ Buffer->Frequency, Buffer->mFmtType, Buffer->mFmtChannels, Buffer->SampleLen));
}
if(!effect)
diff --git a/al/auxeffectslot.h b/al/auxeffectslot.h
index 71f99a11..de640b58 100644
--- a/al/auxeffectslot.h
+++ b/al/auxeffectslot.h
@@ -50,6 +50,7 @@ struct ALeffectslot {
EffectProps Props{};
al::intrusive_ptr<EffectState> State;
+ al::intrusive_ptr<EffectBufferBase> Buffer;
} Effect;
std::atomic_flag PropsClean;