diff options
author | Chris Robinson <[email protected]> | 2021-01-24 02:07:39 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2021-01-24 02:07:39 -0800 |
commit | 13c1d7efb7141aee93d32a60c0e609e61a64f550 (patch) | |
tree | c788c53507811f8adb8a33ee668c014f66d9b8fa /al | |
parent | 3142fb30eaa451c955a1607b8cffe2069cbd15b2 (diff) |
Store buffer info in the queue entry
Diffstat (limited to 'al')
-rw-r--r-- | al/auxeffectslot.cpp | 11 | ||||
-rw-r--r-- | al/buffer.h | 5 | ||||
-rw-r--r-- | al/source.cpp | 11 |
3 files changed, 22 insertions, 5 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp index 8b31ab80..10f13be7 100644 --- a/al/auxeffectslot.cpp +++ b/al/auxeffectslot.cpp @@ -126,6 +126,13 @@ inline ALbuffer *LookupBuffer(ALCdevice *device, ALuint id) noexcept } +inline auto GetEffectBuffer(ALbuffer *buffer) noexcept -> EffectState::Buffer +{ + if(!buffer) return EffectState::Buffer{}; + return EffectState::Buffer{buffer, buffer->mData}; +} + + void AddActiveEffectSlots(const al::span<ALeffectslot*> auxslots, ALCcontext *context) { if(auxslots.empty()) return; @@ -650,7 +657,7 @@ START_API_FUNC FPUCtl mixer_mode{}; auto *state = slot->Effect.State.get(); - state->deviceUpdate(device, buffer); + state->deviceUpdate(device, GetEffectBuffer(buffer)); } break; @@ -926,7 +933,7 @@ ALenum ALeffectslot::initEffect(ALeffect *effect, ALCcontext *context) state->mOutTarget = device->Dry.Buffer; { FPUCtl mixer_mode{}; - state->deviceUpdate(device, Buffer); + state->deviceUpdate(device, GetEffectBuffer(Buffer)); } Effect.Type = newtype; diff --git a/al/buffer.h b/al/buffer.h index 2b3cd517..9f72fb1b 100644 --- a/al/buffer.h +++ b/al/buffer.h @@ -41,6 +41,8 @@ enum UserFmtChannels : unsigned char { struct ALbuffer : public BufferStorage { ALbitfieldSOFT Access{0u}; + al::vector<al::byte,16> mData; + UserFmtType OriginalType{UserFmtShort}; ALuint OriginalSize{0}; ALuint OriginalAlign{0}; @@ -53,6 +55,9 @@ struct ALbuffer : public BufferStorage { ALsizei MappedOffset{0}; ALsizei MappedSize{0}; + ALuint mLoopStart{0u}; + ALuint mLoopEnd{0u}; + /* Number of times buffer was attached to a source (deletion can only occur when 0) */ RefCount ref{0u}; diff --git a/al/source.cpp b/al/source.cpp index a4e59e59..ecaf4069 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -1398,6 +1398,9 @@ bool SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, const a /* Add the selected buffer to a one-item queue */ auto newlist = new BufferlistItem{}; newlist->mSampleLen = buffer->mSampleLen; + newlist->mLoopStart = buffer->mLoopStart; + newlist->mLoopEnd = buffer->mLoopEnd; + newlist->mSamples = buffer->mData; newlist->mBuffer = buffer; IncrementRef(buffer->ref); @@ -3297,10 +3300,12 @@ START_API_FUNC BufferList->mNext.store(item, std::memory_order_relaxed); BufferList = item; } - BufferList->mNext.store(nullptr, std::memory_order_relaxed); - BufferList->mSampleLen = buffer ? buffer->mSampleLen : 0; - BufferList->mBuffer = buffer; if(!buffer) continue; + BufferList->mSampleLen = buffer->mSampleLen; + BufferList->mLoopStart = 0; + BufferList->mLoopEnd = buffer->mSampleLen; + BufferList->mSamples = buffer->mData; + BufferList->mBuffer = buffer; IncrementRef(buffer->ref); |