MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Registry::Service::AudioBackendService Struct Reference

Backend audio subsystem service interface. More...

#include <AudioBackendService.hpp>

+ Collaboration diagram for MayaFlux::Registry::Service::AudioBackendService:

Public Attributes

std::function< std::span< const double >()> get_output_snapshot
 Returns a span over the last committed interleaved output buffer.
 
std::function< uint32_t(std::function< void(const double *, uint32_t)>)> register_output_observer
 Register a per-cycle output observer.
 
std::function< void(uint32_t)> unregister_output_observer
 Unregister a previously registered observer.
 

Detailed Description

Backend audio subsystem service interface.

Registered into BackendRegistry by AudioSubsystem during initialize(). Follows the same pattern as NetworkService, BufferService, DisplayService, and InputService: plain struct of std::function members, natural C++ types only, no engine-internal pointers.

Two consumption models:

Polling: call get_output_snapshot() from any non-RT thread to read the last committed interleaved output buffer.

Per-cycle notification: call register_output_observer() with a callback. The callback fires on a dedicated notification thread (not the RT audio thread) once per output cycle. Any number of observers may be registered at any time. Each receives a unique id for later unregistration. The callback must not block; post to a lock-free queue if further work is needed.

if (!svc) return;
// Polling:
auto snap = svc->get_output_snapshot();
// Per-cycle observer:
auto id = svc->register_output_observer([](const double* data, uint32_t total_samples) {
// runs on notification thread, not RT thread
});
// Later:
svc->unregister_output_observer(id);
Interface * get_service()
Query for a backend service.
static BackendRegistry & instance()
Get the global registry instance.
Backend audio subsystem service interface.

Definition at line 41 of file AudioBackendService.hpp.


The documentation for this struct was generated from the following file: