MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Core::PipewireStream Class Reference

PipeWire implementation of the audio stream interface. More...

#include <PipewireBackend.hpp>

+ Inheritance diagram for MayaFlux::Core::PipewireStream:
+ Collaboration diagram for MayaFlux::Core::PipewireStream:

Public Member Functions

void close () override
 Terminates the audio stream and releases all resources.
 
bool is_open () const override
 Checks if the stream is initialized and ready for activation.
 
bool is_running () const override
 Checks if the stream is actively processing audio data.
 
void open () override
 Initializes the audio stream and allocates required resources.
 
void pause () override
 Temporarily suspends audio processing without releasing resources.
 
void resume () override
 Resumes audio processing after a pause.
 
void set_process_callback (std::function< int(void *, void *, unsigned int)> cb) override
 Sets the function to process audio data.
 
void start () override
 Activates the audio stream and begins data transfer.
 
void stop () override
 Deactivates the audio stream and halts data transfer.
 
 ~PipewireStream () override
 
- Public Member Functions inherited from MayaFlux::Core::AudioStream
virtual ~AudioStream ()=default
 Virtual destructor for proper cleanup of derived classes.
 

Private Attributes

std::atomic< bool > m_is_open { false }
 
std::atomic< bool > m_is_paused { false }
 
std::atomic< bool > m_is_running { false }
 
std::function< int(void *, void *, unsigned int)> m_process_callback
 
GlobalStreamInfom_stream_info
 
void * m_user_data
 

Detailed Description

PipeWire implementation of the audio stream interface.

Wraps a pw_stream follower node. The stream proposes SPA_AUDIO_FORMAT_F64 interleaved during format negotiation, matching the engine's internal double representation and eliminating format conversion in the hot path.

On param_changed the negotiated frame count is stored and used to validate the buffer size contract. If PipeWire adjusts the quantum away from the requested value, a warning is logged and m_stream_info.buffer_size is updated to match, consistent with the RtAudio backend's existing behaviour.

The pw_thread_loop drives the PipeWire event loop on a dedicated thread. The process callback runs on that thread at SCHED_FIFO priority when rlimits are configured by the package installer. No locking occurs on the audio path; the process callback only reads atomic state and invokes the registered std::function.

Definition at line 120 of file PipewireBackend.hpp.


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