From c76fb714ccd44584f18c1be7c8366c462c493831 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 3 Jun 2019 22:24:26 -0700 Subject: Restructure voice data members This should improve access patters by packing each buffer channel's data together, which is more inline with its use. --- OpenAL32/Include/alu.h | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) (limited to 'OpenAL32/Include/alu.h') diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index cb0b675c..25a1d422 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -253,39 +253,33 @@ struct ALvoice { ALuint mFlags; - struct ResampleData { - alignas(16) std::array mPrevSamples; - - ALfloat mAmbiScale; - BandSplitter mAmbiSplitter; - }; - std::array mResampleData; - - struct { + struct DirectData { int FilterType; - DirectParams Params[MAX_INPUT_CHANNELS]; - al::span Buffer; ALsizei ChannelsPerOrder[MAX_AMBI_ORDER+1]; - } mDirect; + }; + DirectData mDirect; struct SendData { int FilterType; - SendParams Params[MAX_INPUT_CHANNELS]; - al::span Buffer; }; - al::FlexArray mSend; + std::array mSend; + + struct ChannelData { + alignas(16) std::array mPrevSamples; - ALvoice(size_t numsends) : mSend{numsends} { } + ALfloat mAmbiScale; + BandSplitter mAmbiSplitter; + + DirectParams mDryParams; + std::array mWetParams; + }; + std::array mChans; + + ALvoice() = default; ALvoice(const ALvoice&) = delete; ALvoice& operator=(const ALvoice&) = delete; - - static constexpr size_t Sizeof(size_t numsends) noexcept - { - return maxz(sizeof(ALvoice), - al::FlexArray::Sizeof(numsends, offsetof(ALvoice, mSend))); - } }; void DeinitVoice(ALvoice *voice) noexcept; -- cgit v1.2.3