diff options
author | Chris Robinson <[email protected]> | 2021-01-25 09:08:49 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2021-01-25 09:08:49 -0800 |
commit | 71e6bcbd62ab8685f3da660b0bb391e8285bcbce (patch) | |
tree | ff05d8a43f25c3e46717a71bdd9d090842269f5c /alc/voice.h | |
parent | 6151d112538242ff41f5882a728a294ba478c3ab (diff) |
Use an AL-specific buffer queue item struct for sources
Diffstat (limited to 'alc/voice.h')
-rw-r--r-- | alc/voice.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/alc/voice.h b/alc/voice.h index 84d19ed0..4785fb6e 100644 --- a/alc/voice.h +++ b/alc/voice.h @@ -74,6 +74,20 @@ struct SendParams { }; +struct VoiceBufferItem { + std::atomic<VoiceBufferItem*> mNext{nullptr}; + + CallbackType mCallback{nullptr}; + void *mUserData{nullptr}; + + uint mSampleLen{0u}; + uint mLoopStart{0u}; + uint mLoopEnd{0u}; + + al::byte *mSamples{nullptr}; +}; + + struct VoiceProps { float Pitch; float Gain; @@ -166,12 +180,12 @@ struct Voice { std::atomic<uint> mPositionFrac; /* Current buffer queue item being played. */ - std::atomic<BufferlistItem*> mCurrentBuffer; + std::atomic<VoiceBufferItem*> mCurrentBuffer; /* Buffer queue item to loop to at end of queue (will be NULL for non- * looping voices). */ - std::atomic<BufferlistItem*> mLoopBuffer; + std::atomic<VoiceBufferItem*> mLoopBuffer; /* Properties for the attached buffer(s). */ FmtChannels mFmtChannels; @@ -211,8 +225,9 @@ struct Voice { al::vector<ChannelData> mChans{2}; Voice() = default; - Voice(const Voice&) = delete; ~Voice() { delete mUpdate.exchange(nullptr, std::memory_order_acq_rel); } + + Voice(const Voice&) = delete; Voice& operator=(const Voice&) = delete; void mix(const State vstate, ALCcontext *Context, const uint SamplesToDo); |