diff options
author | Chris Robinson <[email protected]> | 2018-11-30 19:04:38 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-30 19:04:38 -0800 |
commit | c7569c31ad4b731f1b6c86cbc1833f8b0af4bf82 (patch) | |
tree | 587b9dfd1a0b805f4e8db7a69fabf345be7c7720 /OpenAL32/Include | |
parent | 4b7ac4a6ed290182de945274afd90fc4cece0283 (diff) |
Improve construction and destruction of ALvoices
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r-- | OpenAL32/Include/alu.h | 20 |
1 files changed, 11 insertions, 9 deletions
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<ALvoiceProps*> next; +struct ALvoiceProps : public ALvoicePropsBase { + std::atomic<ALvoiceProps*> 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<ALvoiceProps*> Update; +struct ALvoice { + std::atomic<ALvoiceProps*> Update{nullptr}; - std::atomic<ALuint> SourceID; - std::atomic<bool> Playing; + std::atomic<ALuint> SourceID{0u}; + std::atomic<bool> 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; |