diff options
author | Chris Robinson <[email protected]> | 2019-06-09 18:13:54 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-06-09 18:13:54 -0700 |
commit | bc8f206ee1361ec4b6e740a458bb7985bb7d1429 (patch) | |
tree | 5705d45dbedf6af324b3430654decf8388d0bd21 /OpenAL32/Include | |
parent | 90d25e5187ca50a6e978603fabb6395035ad0db5 (diff) |
Use a FlexArray for the context's voices
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r-- | OpenAL32/Include/alMain.h | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 42 |
2 files changed, 41 insertions, 3 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 9a5b3814..80167417 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -532,7 +532,7 @@ struct AsyncEvent { }; -void AllocateVoices(ALCcontext *context, ALsizei num_voices, ALsizei old_sends); +void AllocateVoices(ALCcontext *context, size_t num_voices); extern ALint RTPrioLevel; diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 3e18f857..3135f8fd 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -278,10 +278,48 @@ struct ALvoice { ALvoice() = default; ALvoice(const ALvoice&) = delete; + ~ALvoice() { delete mUpdate.exchange(nullptr, std::memory_order_acq_rel); } ALvoice& operator=(const ALvoice&) = delete; -}; + ALvoice& operator=(ALvoice&& rhs) noexcept + { + ALvoiceProps *old_update{mUpdate.load(std::memory_order_relaxed)}; + mUpdate.store(rhs.mUpdate.exchange(old_update, std::memory_order_relaxed), + std::memory_order_relaxed); + + mSourceID.store(rhs.mSourceID.load(std::memory_order_relaxed), std::memory_order_relaxed); + mPlayState.store(rhs.mPlayState.load(std::memory_order_relaxed), + std::memory_order_relaxed); + + mProps = rhs.mProps; + + mPosition.store(rhs.mPosition.load(std::memory_order_relaxed), std::memory_order_relaxed); + mPositionFrac.store(rhs.mPositionFrac.load(std::memory_order_relaxed), + std::memory_order_relaxed); + + mCurrentBuffer.store(rhs.mCurrentBuffer.load(std::memory_order_relaxed), + std::memory_order_relaxed); + mLoopBuffer.store(rhs.mLoopBuffer.load(std::memory_order_relaxed), + std::memory_order_relaxed); + + mFmtChannels = rhs.mFmtChannels; + mFrequency = rhs.mFrequency; + mNumChannels = rhs.mNumChannels; + mSampleSize = rhs.mSampleSize; -void DeinitVoice(ALvoice *voice) noexcept; + mStep = rhs.mStep; + mResampler = rhs.mResampler; + + mResampleState = rhs.mResampleState; + + mFlags = rhs.mFlags; + + mDirect = rhs.mDirect; + mSend = rhs.mSend; + mChans = rhs.mChans; + + return *this; + } +}; using MixerFunc = void(*)(const ALfloat *data, const al::span<FloatBufferLine> OutBuffer, |