diff options
author | Chris Robinson <[email protected]> | 2019-01-11 22:09:57 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-01-11 22:09:57 -0800 |
commit | ab1667146627e93688cfeb4cf877764f220c0c3e (patch) | |
tree | 3b784ceb2a281a2012eeaf88a47fbf5c78ca2d2e /Alc/converter.h | |
parent | f8c2e54b47476dd245bb87e09bd1c5b5ddd2cd9f (diff) |
Use a flexible array for HrtfHandle and SampleConverter
Diffstat (limited to 'Alc/converter.h')
-rw-r--r-- | Alc/converter.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Alc/converter.h b/Alc/converter.h index bfd0dd1a..04d94833 100644 --- a/Alc/converter.h +++ b/Alc/converter.h @@ -10,7 +10,6 @@ struct SampleConverter { DevFmtType mSrcType{}; DevFmtType mDstType{}; - ALsizei mNumChannels{}; ALsizei mSrcTypeSize{}; ALsizei mDstTypeSize{}; @@ -24,13 +23,24 @@ struct SampleConverter { alignas(16) ALfloat mSrcSamples[BUFFERSIZE]{}; alignas(16) ALfloat mDstSamples[BUFFERSIZE]{}; - struct { + struct ChanSamples { alignas(16) ALfloat PrevSamples[MAX_RESAMPLE_PADDING*2]; - } mChan[]; + }; + al::FlexArray<ChanSamples> mChan; + + SampleConverter(size_t numchans) : mChan{numchans} { } + SampleConverter(const SampleConverter&) = delete; + SampleConverter& operator=(const SampleConverter&) = delete; ALsizei convert(const ALvoid **src, ALsizei *srcframes, ALvoid *dst, ALsizei dstframes); ALsizei availableOut(ALsizei srcframes) const; + static constexpr size_t Sizeof(size_t length) noexcept + { + return maxz(sizeof(SampleConverter), + al::FlexArray<ChanSamples>::Sizeof(length, offsetof(SampleConverter, mChan))); + } + DEF_PLACE_NEWDEL() }; using SampleConverterPtr = std::unique_ptr<SampleConverter>; |