diff options
author | Chris Robinson <[email protected]> | 2020-04-24 07:04:32 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-04-24 07:04:32 -0700 |
commit | be476c793574fcde7bb78df1595257cc52f4c93a (patch) | |
tree | 0bb49372446b21c8f159e73c4ad3223f383cff58 | |
parent | f49238c79278bb019e618b23d9b86d2ba15f82c2 (diff) |
Use global placement new for AsyncEvent
-rw-r--r-- | al/event.cpp | 2 | ||||
-rw-r--r-- | al/event.h | 4 | ||||
-rw-r--r-- | alc/alu.cpp | 6 | ||||
-rw-r--r-- | alc/voice.cpp | 4 |
4 files changed, 10 insertions, 6 deletions
diff --git a/al/event.cpp b/al/event.cpp index 0da48cbf..cd8ea7c2 100644 --- a/al/event.cpp +++ b/al/event.cpp @@ -122,7 +122,7 @@ void StopEventThrd(ALCcontext *ctx) evt_data = ring->getWriteVector().first; } while(evt_data.len == 0); } - new (evt_data.buf) AsyncEvent{EventType_KillThread}; + ::new(evt_data.buf) AsyncEvent{EventType_KillThread}; ring->writeAdvance(1); ctx->mEventSem.post(); @@ -4,6 +4,8 @@ #include "AL/al.h" #include "AL/alc.h" +#include "almalloc.h" + struct EffectState; @@ -46,6 +48,8 @@ struct AsyncEvent { AsyncEvent() noexcept = default; constexpr AsyncEvent(unsigned int type) noexcept : EnumType{type} { } + + DISABLE_ALLOC() }; diff --git a/alc/alu.cpp b/alc/alu.cpp index caed9e30..3e4bb0f0 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -480,7 +480,7 @@ bool CalcEffectSlotParams(ALeffectslot *slot, ALeffectslot **sorted_slots, ALCco auto evt_vec = ring->getWriteVector(); if LIKELY(evt_vec.first.len > 0) { - AsyncEvent *evt{new (evt_vec.first.buf) AsyncEvent{EventType_ReleaseEffectState}}; + AsyncEvent *evt{::new(evt_vec.first.buf) AsyncEvent{EventType_ReleaseEffectState}}; evt->u.mEffectState = oldstate; ring->writeAdvance(1); } @@ -1589,7 +1589,7 @@ void SendSourceStateEvent(ALCcontext *context, ALuint id, ALenum state) auto evt_vec = ring->getWriteVector(); if(evt_vec.first.len < 1) return; - AsyncEvent *evt{new (evt_vec.first.buf) AsyncEvent{EventType_SourceStateChange}}; + AsyncEvent *evt{::new(evt_vec.first.buf) AsyncEvent{EventType_SourceStateChange}}; evt->u.srcstate.id = id; evt->u.srcstate.state = state; @@ -2119,7 +2119,7 @@ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...) auto evt_data = ring->getWriteVector().first; if(evt_data.len > 0) { - ::new (evt_data.buf) AsyncEvent{evt}; + ::new(evt_data.buf) AsyncEvent{evt}; ring->writeAdvance(1); ctx->mEventSem.post(); } diff --git a/alc/voice.cpp b/alc/voice.cpp index 5dce9541..77f176b7 100644 --- a/alc/voice.cpp +++ b/alc/voice.cpp @@ -301,7 +301,7 @@ void SendSourceStoppedEvent(ALCcontext *context, ALuint id) auto evt_vec = ring->getWriteVector(); if(evt_vec.first.len < 1) return; - AsyncEvent *evt{new (evt_vec.first.buf) AsyncEvent{EventType_SourceStateChange}}; + AsyncEvent *evt{::new(evt_vec.first.buf) AsyncEvent{EventType_SourceStateChange}}; evt->u.srcstate.id = id; evt->u.srcstate.state = AL_STOPPED; @@ -906,7 +906,7 @@ void Voice::mix(const State vstate, ALCcontext *Context, const ALuint SamplesToD auto evt_vec = ring->getWriteVector(); if(evt_vec.first.len > 0) { - AsyncEvent *evt{new (evt_vec.first.buf) AsyncEvent{EventType_BufferCompleted}}; + AsyncEvent *evt{::new(evt_vec.first.buf) AsyncEvent{EventType_BufferCompleted}}; evt->u.bufcomp.id = SourceID; evt->u.bufcomp.count = buffers_done; ring->writeAdvance(1); |