|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
Unconditionally writes externally-supplied data into an AudioBuffer each cycle. More...
#include <AudioWriteProcessor.hpp>
Inheritance diagram for MayaFlux::Buffers::AudioWriteProcessor:
Collaboration diagram for MayaFlux::Buffers::AudioWriteProcessor:Public Member Functions | |
| AudioWriteProcessor ()=default | |
| void | clear () |
| Clear any pending snapshot. | |
| bool | has_pending () const noexcept |
| Returns true if a snapshot has been set and not yet consumed. | |
| bool | is_compatible_with (const std::shared_ptr< Buffer > &buffer) const override |
| Checks if this processor can handle the specified buffer type. | |
| void | on_attach (const std::shared_ptr< Buffer > &buffer) override |
| Called when this processor is attached to a buffer. | |
| void | processing_function (const std::shared_ptr< Buffer > &buffer) override |
| The core processing function that must be implemented by derived classes. | |
| void | set_data (const Kakshya::DataVariant &variant) |
| Supply data from any DataVariant — converted to double via EigenAccess. | |
| void | set_data (std::span< const double > data) |
| Supply data as a raw double span — copied directly. | |
| void | set_data (std::span< const float > data) |
| Supply data as a raw float span — upconverted to double. | |
| void | set_data (std::vector< double > data) |
| Supply the next frame of double-precision samples. | |
| ~AudioWriteProcessor () override=default | |
Public Member Functions inherited from MayaFlux::Buffers::BufferProcessor | |
| virtual ProcessingToken | get_processing_token () const |
| Gets the current processing token for this buffer. | |
| virtual void | on_detach (const std::shared_ptr< Buffer > &) |
| Called when this processor is detached from a buffer. | |
| void | process (const std::shared_ptr< Buffer > &buffer) |
| Applies a computational transformation to the data in the provided buffer. | |
| virtual void | set_processing_token (ProcessingToken token) |
| Gets the preferred processing backend for this processor. | |
| virtual | ~BufferProcessor ()=default |
| Virtual destructor for proper cleanup of derived classes. | |
Private Member Functions | |
| void | commit_pending () |
| void | write_to_buffer (AudioBuffer &buf) const |
Private Attributes | |
| std::vector< double > | m_active |
| std::atomic_flag | m_dirty |
| std::vector< double > | m_pending |
Additional Inherited Members | |
Protected Attributes inherited from MayaFlux::Buffers::BufferProcessor | |
| ProcessingToken | m_processing_token { ProcessingToken::AUDIO_BACKEND } |
Unconditionally writes externally-supplied data into an AudioBuffer each cycle.
Holds a snapshot of double-precision samples. On every processing cycle the snapshot is copied into the attached buffer verbatim — no mixing, no gating, no freshness check. If no snapshot has been set the buffer is zeroed.
Timing and synchronisation with the supplier are the caller's responsibility. The processor only guarantees that whatever was last set via set_data() will appear in the buffer on the next cycle.
Thread safety: set_data() and processing_function() may run concurrently. A lock-free pending/active double-buffer swap ensures the audio thread never blocks on the supplier thread.
DataVariant overload converts to double via Kakshya::extract_from_variant<double> using a thread-local staging vector, covering all active variant types without allocation on the hot path after the first call.
Definition at line 30 of file AudioWriteProcessor.hpp.