From c7569c31ad4b731f1b6c86cbc1833f8b0af4bf82 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 30 Nov 2018 19:04:38 -0800 Subject: Improve construction and destruction of ALvoices --- OpenAL32/Include/alu.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'OpenAL32/Include/alu.h') diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 2ff69058..1fd092c3 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -141,7 +141,7 @@ typedef struct SendParams { } SendParams; -struct ALvoiceProps { +struct ALvoicePropsBase { ALfloat Pitch; ALfloat Gain; ALfloat OuterGain; @@ -183,7 +183,7 @@ struct ALvoiceProps { ALfloat GainLF; ALfloat LFReference; } Direct; - struct { + struct SendData { struct ALeffectslot *Slot; ALfloat Gain; ALfloat GainHF; @@ -191,8 +191,10 @@ struct ALvoiceProps { ALfloat GainLF; ALfloat LFReference; } Send[MAX_SENDS]; +}; - std::atomic next; +struct ALvoiceProps : public ALvoicePropsBase { + std::atomic next{nullptr}; DEF_NEWDEL(ALvoiceProps) }; @@ -202,13 +204,13 @@ struct ALvoiceProps { #define VOICE_HAS_HRTF (1<<2) #define VOICE_HAS_NFC (1<<3) -typedef struct ALvoice { - std::atomic Update; +struct ALvoice { + std::atomic Update{nullptr}; - std::atomic SourceID; - std::atomic Playing; + std::atomic SourceID{0u}; + std::atomic Playing{false}; - ALvoiceProps Props; + ALvoicePropsBase Props; /** * Source offset in samples, relative to the currently playing buffer, NOT @@ -262,7 +264,7 @@ typedef struct ALvoice { ALfloat (*Buffer)[BUFFERSIZE]; ALsizei Channels; } Send[]; -} ALvoice; +}; void DeinitVoice(ALvoice *voice) noexcept; -- cgit v1.2.3