diff options
author | Chris Robinson <[email protected]> | 2018-11-18 05:40:00 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-18 05:40:00 -0800 |
commit | ad82a70a655f3b1172a2b1c49b3eea2feb699c16 (patch) | |
tree | 75181389e46034e23c0a0298018e6e037c9fe632 /Alc/alcontext.h | |
parent | de13f30e286358d8e4f41e457421e4ec9776e3f5 (diff) |
Use cleaner constructor/destructor calls for ALCcontext
Note that the actual type name is ALCcontext_struct, because of how it's
defined in AL/alc.h (ALCcontext is just an alias to struct ALCcontext_struct).
Diffstat (limited to 'Alc/alcontext.h')
-rw-r--r-- | Alc/alcontext.h | 70 |
1 files changed, 38 insertions, 32 deletions
diff --git a/Alc/alcontext.h b/Alc/alcontext.h index 2cdb0cf7..6a7ac376 100644 --- a/Alc/alcontext.h +++ b/Alc/alcontext.h @@ -47,71 +47,77 @@ struct SourceSubList { using ALeffectslotPtr = struct ALeffectslot*; struct ALCcontext_struct { - RefCount ref; + RefCount ref{1u}; al::vector<SourceSubList> SourceList; - ALuint NumSources; + ALuint NumSources{0}; almtx_t SourceLock; al::vector<ALeffectslotPtr> EffectSlotList; almtx_t EffectSlotLock; - ATOMIC(ALenum) LastError; + ATOMIC(ALenum) LastError{AL_NO_ERROR}; - DistanceModel mDistanceModel; - ALboolean SourceDistanceModel; + DistanceModel mDistanceModel{DistanceModel::Default}; + ALboolean SourceDistanceModel{AL_FALSE}; - ALfloat DopplerFactor; - ALfloat DopplerVelocity; - ALfloat SpeedOfSound; - ALfloat MetersPerUnit; + ALfloat DopplerFactor{1.0f}; + ALfloat DopplerVelocity{1.0f}; + ALfloat SpeedOfSound{}; + ALfloat MetersPerUnit{1.0f}; - ATOMIC(ALenum) PropsClean; - ATOMIC(ALenum) DeferUpdates; + ATOMIC(ALenum) PropsClean{AL_TRUE}; + ATOMIC(ALenum) DeferUpdates{AL_FALSE}; almtx_t PropLock; /* Counter for the pre-mixing updates, in 31.1 fixed point (lowest bit * indicates if updates are currently happening). */ - RefCount UpdateCount; - ATOMIC(ALenum) HoldUpdates; + RefCount UpdateCount{0u}; + ATOMIC(ALenum) HoldUpdates{AL_FALSE}; - ALfloat GainBoost; + ALfloat GainBoost{1.0f}; - ATOMIC(ALcontextProps*) Update; + ATOMIC(ALcontextProps*) Update{nullptr}; /* Linked lists of unused property containers, free to use for future * updates. */ - ATOMIC(ALcontextProps*) FreeContextProps; - ATOMIC(ALlistenerProps*) FreeListenerProps; - ATOMIC(ALvoiceProps*) FreeVoiceProps; - ATOMIC(ALeffectslotProps*) FreeEffectslotProps; + ATOMIC(ALcontextProps*) FreeContextProps{nullptr}; + ATOMIC(ALlistenerProps*) FreeListenerProps{nullptr}; + ATOMIC(ALvoiceProps*) FreeVoiceProps{nullptr}; + ATOMIC(ALeffectslotProps*) FreeEffectslotProps{nullptr}; - ALvoice **Voices; - ALsizei VoiceCount; - ALsizei MaxVoices; + ALvoice **Voices{nullptr}; + ALsizei VoiceCount{0}; + ALsizei MaxVoices{0}; - ATOMIC(ALeffectslotArray*) ActiveAuxSlots; + ATOMIC(ALeffectslotArray*) ActiveAuxSlots{nullptr}; althrd_t EventThread; alsem_t EventSem; - ll_ringbuffer *AsyncEvents; - ATOMIC(ALbitfieldSOFT) EnabledEvts; + ll_ringbuffer *AsyncEvents{nullptr}; + ATOMIC(ALbitfieldSOFT) EnabledEvts{0u}; almtx_t EventCbLock; - ALEVENTPROCSOFT EventCb; - void *EventParam; + ALEVENTPROCSOFT EventCb{}; + void *EventParam{nullptr}; /* Default effect slot */ - ALeffectslot *DefaultSlot; + ALeffectslot *DefaultSlot{nullptr}; + + ALCdevice *const Device; + const ALCchar *ExtensionList{nullptr}; + + ATOMIC(ALCcontext*) next{nullptr}; - ALCdevice *Device; - const ALCchar *ExtensionList; + ALlistener Listener{}; - ATOMIC(ALCcontext*) next; - ALlistener Listener; + ALCcontext_struct(ALCdevice *device) : Device{device} { } + ALCcontext_struct(const ALCcontext_struct&) = delete; + ALCcontext_struct& operator=(const ALCcontext_struct&) = delete; + ~ALCcontext_struct(); DEF_NEWDEL(ALCcontext) }; |