MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ notify_loop()

void MayaFlux::Core::AudioSubsystem::notify_loop ( )
private

Definition at line 293 of file AudioSubsystem.cpp.

294{
295 uint64_t last_gen = 0;
296
297 while (m_notify_running.load(std::memory_order_acquire)) {
298 m_snapshot_generation.wait(last_gen, std::memory_order_relaxed);
299
300 if (!m_notify_running.load(std::memory_order_acquire))
301 break;
302
303 last_gen = m_snapshot_generation.load(std::memory_order_acquire);
304
305 const double* ptr = m_snapshot_ptr.load(std::memory_order_acquire);
306 uint32_t sz = m_snapshot_size.load(std::memory_order_acquire);
307
308 if (!ptr || sz == 0)
309 continue;
310
311#ifdef MAYAFLUX_PLATFORM_MACOS
312 auto [obs, slot] = acquire_observers();
313 if (obs) {
314 for (auto& [id, cb] : *obs)
315 cb(ptr, sz);
316 }
317 release_observers(slot);
318#else
319 auto obs = m_observers.load(std::memory_order_acquire);
320 for (auto& [id, cb] : *obs)
321 cb(ptr, sz);
322#endif
323 }
324}
const uint8_t * ptr
std::atomic< uint64_t > m_snapshot_generation
std::atomic< std::shared_ptr< ObserverMap > > m_observers
std::atomic< uint32_t > m_snapshot_size
std::atomic< const double * > m_snapshot_ptr
std::atomic< bool > m_notify_running

References m_notify_running, m_observers, m_snapshot_generation, m_snapshot_ptr, m_snapshot_size, and ptr.

Referenced by initialize().

+ Here is the caller graph for this function: