MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Buffers::StreamWriteProcessor Class Reference

Channel-aware processor that writes AudioBuffer data to DynamicSoundStream containers. More...

#include <StreamWriteProcessor.hpp>

+ Inheritance diagram for MayaFlux::Buffers::StreamWriteProcessor:
+ Collaboration diagram for MayaFlux::Buffers::StreamWriteProcessor:

Public Member Functions

 StreamWriteProcessor (std::shared_ptr< Kakshya::DynamicSoundStream > container, uint64_t start_position=0)
 Construct processor with target DynamicSoundStream container.
 
void processing_function (std::shared_ptr< Buffer > buffer) override
 Write buffer audio data to the appropriate container channel.
 
std::shared_ptr< Kakshya::DynamicSoundStreamget_container () const
 Get the target DynamicSoundStream container.
 
void set_write_position (uint64_t position)
 Set the current write position in the container.
 
uint64_t get_write_position () const
 Get the current write position in the container.
 
void reset_position ()
 Reset write position to the beginning.
 
void set_write_position_time (double time_seconds)
 Set write position to a specific time offset.
 
double get_write_position_time () const
 Get current write position as time offset.
 
- Public Member Functions inherited from MayaFlux::Buffers::BufferProcessor
virtual ~BufferProcessor ()=default
 Virtual destructor for proper cleanup of derived classes.
 
void process (std::shared_ptr< Buffer > buffer)
 Applies a computational transformation to the data in the provided buffer.
 
virtual void on_attach (std::shared_ptr< Buffer >)
 Called when this processor is attached to a buffer.
 
virtual void on_detach (std::shared_ptr< Buffer >)
 Called when this processor is detached from a buffer.
 
virtual void set_processing_token (ProcessingToken token)
 Gets the preferred processing backend for this processor.
 
virtual ProcessingToken get_processing_token () const
 Gets the current processing token for this buffer.
 
virtual bool is_compatible_with (std::shared_ptr< Buffer >) const
 Checks if this processor can handle the specified buffer type.
 

Private Attributes

std::shared_ptr< Kakshya::DynamicSoundStreamm_container
 
uint64_t m_write_position { 0 }
 Current write position in frames.
 

Additional Inherited Members

- Protected Attributes inherited from MayaFlux::Buffers::BufferProcessor
ProcessingToken m_processing_token { ProcessingToken::AUDIO_BACKEND }
 

Detailed Description

Channel-aware processor that writes AudioBuffer data to DynamicSoundStream containers.

StreamWriteProcessor provides a bridge between the AudioBuffer processing system and DynamicSoundStream containers for real-time recording and data capture scenarios. It extracts audio data from buffers and streams it directly to the appropriate channel in the container with automatic capacity management and channel mapping.

Key Features:

  • Channel-Aware Writing: Maps AudioBuffer channel ID to container channel
  • Position Management: Tracks write position per processor instance
  • Automatic Capacity: Leverages container's dynamic resizing for unlimited recording
  • Circular Buffer Support: Handles position wrapping for circular containers
  • Real-time Safe: Optimized for low-latency audio processing chains
  • Thread-Safe: Ensures safe concurrent access to container data

Use Cases:

  • Multi-channel real-time audio recording
  • Capturing processed audio from node networks
  • Creating channel-specific delay lines and feedback systems
  • Building multi-track looping and overdub functionality
  • Streaming multi-channel audio to storage or network destinations

Channel Mapping: Each AudioBuffer's channel_id corresponds directly to a channel in the target DynamicSoundStream. Buffers with channel IDs exceeding the container's channel count will be skipped with a warning.

Note
For real-time use cases, consider pre-allocating container capacity or enabling circular mode to avoid dynamic allocations during processing.

Definition at line 43 of file StreamWriteProcessor.hpp.


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