aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/hrtf.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-01-12 01:25:33 -0800
committerChris Robinson <[email protected]>2019-01-12 01:25:33 -0800
commitd64eaba3229f48a519586c0436235e3c2809329b (patch)
treed578ef76627df78c0ec7b1ef2bca1fd1e8af0db1 /Alc/hrtf.h
parentab1667146627e93688cfeb4cf877764f220c0c3e (diff)
Use a flexible array for DirectHrtfState and ALvoice
Diffstat (limited to 'Alc/hrtf.h')
-rw-r--r--Alc/hrtf.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/Alc/hrtf.h b/Alc/hrtf.h
index 58c35466..b59cd4ea 100644
--- a/Alc/hrtf.h
+++ b/Alc/hrtf.h
@@ -59,13 +59,19 @@ struct DirectHrtfState {
/* HRTF filter state for dry buffer content */
ALsizei Offset{0};
ALsizei IrSize{0};
- struct {
+ struct ChanData {
alignas(16) ALfloat Values[HRIR_LENGTH][2];
alignas(16) ALfloat Coeffs[HRIR_LENGTH][2];
- } Chan[];
+ };
+ al::FlexArray<ChanData> Chan;
- DirectHrtfState() noexcept { }
- static std::unique_ptr<DirectHrtfState> Create(ALsizei num_chans);
+ DirectHrtfState(size_t numchans) : Chan{numchans} { }
+ DirectHrtfState(const DirectHrtfState&) = delete;
+ DirectHrtfState& operator=(const DirectHrtfState&) = delete;
+
+ static std::unique_ptr<DirectHrtfState> Create(size_t num_chans);
+ static constexpr size_t Sizeof(size_t numchans) noexcept
+ { return al::FlexArray<ChanData>::Sizeof(numchans, offsetof(DirectHrtfState, Chan)); }
DEF_PLACE_NEWDEL()
};