aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/alu.cpp6
-rw-r--r--Alc/mixvoice.cpp2
-rw-r--r--OpenAL32/Include/alMain.h8
-rw-r--r--OpenAL32/alSource.cpp2
-rw-r--r--OpenAL32/event.cpp4
5 files changed, 12 insertions, 10 deletions
diff --git a/Alc/alu.cpp b/Alc/alu.cpp
index 4a8b6687..f2068ead 100644
--- a/Alc/alu.cpp
+++ b/Alc/alu.cpp
@@ -288,7 +288,7 @@ void SendSourceStoppedEvent(ALCcontext *context, ALuint id)
ALbitfieldSOFT enabledevt{context->EnabledEvts.load(std::memory_order_acquire)};
if(!(enabledevt&EventType_SourceStateChange)) return;
- AsyncEvent evt{ASYNC_EVENT(EventType_SourceStateChange)};
+ AsyncEvent evt{EventType_SourceStateChange};
evt.u.srcstate.id = id;
evt.u.srcstate.state = AL_STOPPED;
@@ -414,7 +414,7 @@ bool CalcEffectSlotParams(ALeffectslot *slot, ALCcontext *context, bool force)
/* Otherwise, replace it and send off the old one with a release
* event.
*/
- AsyncEvent evt = ASYNC_EVENT(EventType_ReleaseEffectState);
+ AsyncEvent evt{EventType_ReleaseEffectState};
evt.u.mEffectState = slot->Params.mEffectState;
slot->Params.mEffectState = state;
@@ -1811,7 +1811,7 @@ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...)
if(!device->Connected.exchange(AL_FALSE, std::memory_order_acq_rel))
return;
- AsyncEvent evt = ASYNC_EVENT(EventType_Disconnected);
+ AsyncEvent evt{EventType_Disconnected};
evt.u.user.type = AL_EVENT_TYPE_DISCONNECTED_SOFT;
evt.u.user.id = 0;
evt.u.user.param = 0;
diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp
index f60043d7..cd5d2504 100644
--- a/Alc/mixvoice.cpp
+++ b/Alc/mixvoice.cpp
@@ -722,7 +722,7 @@ ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsize
ALbitfieldSOFT enabledevt{Context->EnabledEvts.load(std::memory_order_acquire)};
if(buffers_done > 0 && (enabledevt&EventType_BufferCompleted))
{
- AsyncEvent evt{ASYNC_EVENT(EventType_BufferCompleted)};
+ AsyncEvent evt{EventType_BufferCompleted};
evt.u.bufcomp.id = SourceID;
evt.u.bufcomp.count = buffers_done;
if(ll_ringbuffer_write(Context->AsyncEvents, &evt, 1) == 1)
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 75dc6c74..cbf00c50 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -842,7 +842,7 @@ enum {
};
struct AsyncEvent {
- unsigned int EnumType;
+ unsigned int EnumType{0u};
union {
char dummy;
struct {
@@ -860,9 +860,11 @@ struct AsyncEvent {
ALchar msg[1008];
} user;
EffectState *mEffectState;
- } u;
+ } u{};
+
+ AsyncEvent() noexcept = default;
+ constexpr AsyncEvent(unsigned int type) noexcept : EnumType{type} { }
};
-#define ASYNC_EVENT(t) AsyncEvent{ t, { 0 } }
void AllocateVoices(ALCcontext *context, ALsizei num_voices, ALsizei old_sends);
diff --git a/OpenAL32/alSource.cpp b/OpenAL32/alSource.cpp
index 872bc9ee..f257da83 100644
--- a/OpenAL32/alSource.cpp
+++ b/OpenAL32/alSource.cpp
@@ -687,7 +687,7 @@ void SendStateChangeEvent(ALCcontext *context, ALuint id, ALenum state)
ALbitfieldSOFT enabledevt{context->EnabledEvts.load(std::memory_order_acquire)};
if(!(enabledevt&EventType_SourceStateChange)) return;
- AsyncEvent evt{ASYNC_EVENT(EventType_SourceStateChange)};
+ AsyncEvent evt{EventType_SourceStateChange};
evt.u.srcstate.id = id;
evt.u.srcstate.state = state;
diff --git a/OpenAL32/event.cpp b/OpenAL32/event.cpp
index 1a4e1df0..ad3fd4ab 100644
--- a/OpenAL32/event.cpp
+++ b/OpenAL32/event.cpp
@@ -18,9 +18,9 @@
static int EventThread(ALCcontext *context)
{
bool quitnow{false};
+ AsyncEvent evt{};
while(LIKELY(!quitnow))
{
- AsyncEvent evt;
if(ll_ringbuffer_read(context->AsyncEvents, &evt, 1) == 0)
{
context->EventSem.wait();
@@ -90,7 +90,7 @@ void StartEventThrd(ALCcontext *ctx)
void StopEventThrd(ALCcontext *ctx)
{
- static constexpr AsyncEvent kill_evt = ASYNC_EVENT(EventType_KillThread);
+ static constexpr AsyncEvent kill_evt{EventType_KillThread};
while(ll_ringbuffer_write(ctx->AsyncEvents, &kill_evt, 1) == 0)
std::this_thread::yield();
ctx->EventSem.post();