From ea76e003e7f2063687ed662282d388078ecf385b Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 30 Jul 2019 09:05:54 -0700 Subject: Properly prefix ALCcontext members --- al/event.cpp | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'al/event.cpp') diff --git a/al/event.cpp b/al/event.cpp index b103d0da..b2710561 100644 --- a/al/event.cpp +++ b/al/event.cpp @@ -31,18 +31,18 @@ static int EventThread(ALCcontext *context) { - RingBuffer *ring{context->AsyncEvents.get()}; + RingBuffer *ring{context->mAsyncEvents.get()}; bool quitnow{false}; while(LIKELY(!quitnow)) { auto evt_data = ring->getReadVector().first; if(evt_data.len == 0) { - context->EventSem.wait(); + context->mEventSem.wait(); continue; } - std::lock_guard _{context->EventCbLock}; + std::lock_guard _{context->mEventCbLock}; do { auto &evt = *reinterpret_cast(evt_data.buf); evt_data.buf += sizeof(AsyncEvent); @@ -69,8 +69,8 @@ static int EventThread(ALCcontext *context) continue; } - ALbitfieldSOFT enabledevts{context->EnabledEvts.load(std::memory_order_acquire)}; - if(!context->EventCb) continue; + ALbitfieldSOFT enabledevts{context->mEnabledEvts.load(std::memory_order_acquire)}; + if(!context->mEventCb) continue; if(evt.EnumType == EventType_SourceStateChange) { @@ -82,9 +82,9 @@ static int EventThread(ALCcontext *context) (evt.u.srcstate.state==AL_PLAYING) ? "AL_PLAYING" : (evt.u.srcstate.state==AL_PAUSED) ? "AL_PAUSED" : (evt.u.srcstate.state==AL_STOPPED) ? "AL_STOPPED" : ""; - context->EventCb(AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT, evt.u.srcstate.id, + context->mEventCb(AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT, evt.u.srcstate.id, evt.u.srcstate.state, static_cast(msg.length()), msg.c_str(), - context->EventParam); + context->mEventParam); } else if(evt.EnumType == EventType_BufferCompleted) { @@ -93,14 +93,14 @@ static int EventThread(ALCcontext *context) std::string msg{std::to_string(evt.u.bufcomp.count)}; if(evt.u.bufcomp.count == 1) msg += " buffer completed"; else msg += " buffers completed"; - context->EventCb(AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT, evt.u.bufcomp.id, + context->mEventCb(AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT, evt.u.bufcomp.id, evt.u.bufcomp.count, static_cast(msg.length()), msg.c_str(), - context->EventParam); + context->mEventParam); } else if((enabledevts&evt.EnumType) == evt.EnumType) - context->EventCb(evt.u.user.type, evt.u.user.id, evt.u.user.param, + context->mEventCb(evt.u.user.type, evt.u.user.id, evt.u.user.param, static_cast(strlen(evt.u.user.msg)), evt.u.user.msg, - context->EventParam); + context->mEventParam); } while(evt_data.len != 0); } return 0; @@ -109,7 +109,7 @@ static int EventThread(ALCcontext *context) void StartEventThrd(ALCcontext *ctx) { try { - ctx->EventThread = std::thread{EventThread, ctx}; + ctx->mEventThread = std::thread{EventThread, ctx}; } catch(std::exception& e) { ERR("Failed to start event thread: %s\n", e.what()); @@ -122,7 +122,7 @@ void StartEventThrd(ALCcontext *ctx) void StopEventThrd(ALCcontext *ctx) { static constexpr AsyncEvent kill_evt{EventType_KillThread}; - RingBuffer *ring{ctx->AsyncEvents.get()}; + RingBuffer *ring{ctx->mAsyncEvents.get()}; auto evt_data = ring->getWriteVector().first; if(evt_data.len == 0) { @@ -134,9 +134,9 @@ void StopEventThrd(ALCcontext *ctx) new (evt_data.buf) AsyncEvent{kill_evt}; ring->writeAdvance(1); - ctx->EventSem.post(); - if(ctx->EventThread.joinable()) - ctx->EventThread.join(); + ctx->mEventSem.post(); + if(ctx->mEventThread.joinable()) + ctx->mEventThread.join(); } AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, ALboolean enable) @@ -176,8 +176,8 @@ START_API_FUNC if(enable) { - ALbitfieldSOFT enabledevts{context->EnabledEvts.load(std::memory_order_relaxed)}; - while(context->EnabledEvts.compare_exchange_weak(enabledevts, enabledevts|flags, + ALbitfieldSOFT enabledevts{context->mEnabledEvts.load(std::memory_order_relaxed)}; + while(context->mEnabledEvts.compare_exchange_weak(enabledevts, enabledevts|flags, std::memory_order_acq_rel, std::memory_order_acquire) == 0) { /* enabledevts is (re-)filled with the current value on failure, so @@ -187,15 +187,15 @@ START_API_FUNC } else { - ALbitfieldSOFT enabledevts{context->EnabledEvts.load(std::memory_order_relaxed)}; - while(context->EnabledEvts.compare_exchange_weak(enabledevts, enabledevts&~flags, + ALbitfieldSOFT enabledevts{context->mEnabledEvts.load(std::memory_order_relaxed)}; + while(context->mEnabledEvts.compare_exchange_weak(enabledevts, enabledevts&~flags, std::memory_order_acq_rel, std::memory_order_acquire) == 0) { } /* Wait to ensure the event handler sees the changed flags before * returning. */ - std::lock_guard{context->EventCbLock}; + std::lock_guard{context->mEventCbLock}; } } END_API_FUNC @@ -206,9 +206,9 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard _{context->PropLock}; - std::lock_guard __{context->EventCbLock}; - context->EventCb = callback; - context->EventParam = userParam; + std::lock_guard _{context->mPropLock}; + std::lock_guard __{context->mEventCbLock}; + context->mEventCb = callback; + context->mEventParam = userParam; } END_API_FUNC -- cgit v1.2.3