MCPcopy Create free account
hub / github.com/crownengine/crown / SendStateChangeEvent

Function SendStateChangeEvent

3rdparty/openal/al/source.cpp:699–717  ·  view source on GitHub ↗

Can only be called while the mixer is locked! */

Source from the content-addressed store, hash-verified

697
698/** Can only be called while the mixer is locked! */
699void SendStateChangeEvent(ALCcontext *context, ALuint id, ALenum state)
700{
701 ALbitfieldSOFT enabledevt{context->mEnabledEvts.load(std::memory_order_acquire)};
702 if(!(enabledevt&EventType_SourceStateChange)) return;
703
704 /* The mixer may have queued a state change that's not yet been processed,
705 * and we don't want state change messages to occur out of order, so send
706 * it through the async queue to ensure proper ordering.
707 */
708 RingBuffer *ring{context->mAsyncEvents.get()};
709 auto evt_vec = ring->getWriteVector();
710 if(evt_vec.first.len < 1) return;
711
712 AsyncEvent *evt{::new (evt_vec.first.buf) AsyncEvent{EventType_SourceStateChange}};
713 evt->u.srcstate.id = id;
714 evt->u.srcstate.state = state;
715 ring->writeAdvance(1);
716 context->mEventSem.post();
717}
718
719
720constexpr size_t MaxValues{6u};

Callers 1

source.cppFile · 0.85

Calls 5

getWriteVectorMethod · 0.80
writeAdvanceMethod · 0.80
loadMethod · 0.45
getMethod · 0.45
postMethod · 0.45

Tested by

no test coverage detected