MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
AudioOutputContainer.hpp
Go to the documentation of this file.
1#pragma once
2
5
6namespace MayaFlux::Kakshya {
7
8class AudioOutputAccessProcessor;
9
10/**
11 * @class AudioOutputContainer
12 * @brief DynamicSoundStream subclass wrapping the live engine audio output.
13 *
14 * Exposes each completed output cycle as addressable N-dimensional data,
15 * symmetric with WindowContainer's treatment of window surfaces.
16 *
17 * Data model:
18 * m_processed_data — current cycle snapshot, written by AudioOutputAccessProcessor
19 * each process() call. Hot consumable for real-time nodes,
20 * visualizers, and metering.
21 * m_data — unbounded accumulating history of all output frames written
22 * so far, growing via write_frames() each cycle. The write
23 * head is always get_num_frames(). Readers attach independent
24 * CursorAccessProcessor instances against this container and
25 * chase the write head at their own rate.
26 *
27 * Multi-reader model:
28 * Inherited from DynamicSoundStream. Each consumer (SoundFileWriter, network
29 * broadcast, metering) calls allocate_dynamic_slot() and attaches a
30 * CursorAccessProcessor with set_loop_region(reader_pos, get_num_frames()).
31 * The container never pushes to readers; readers pull on their own schedule.
32 *
33 * Processing model:
34 * The default processor (AudioOutputAccessProcessor) pulls the engine snapshot
35 * once per process() call, writes the deinterleaved result into m_processed_data,
36 * then appends the same data to m_data via write_frames(). The container never
37 * calls process() itself; callers drive it via process_default() hooked into
38 * an AudioBackendService observer or BroadcastSource.
39 *
40 * Position semantics:
41 * m_read_position is unused as a navigation cursor here. The write head
42 * (get_num_frames()) is the only meaningful position. StreamContainer
43 * position purv virtuals are inherited from SoundStreamContainer and operate
44 * correctly against m_data for any reader that chooses to use them.
45 */
46class MAYAFLUX_API AudioOutputContainer : public DynamicSoundStream {
47public:
48 /**
49 * @brief Construct from stream configuration.
50 * @param stream_info Provides channel count, buffer size, and sample rate.
51 */
52 explicit AudioOutputContainer(Core::GlobalStreamInfo stream_info);
53
54 ~AudioOutputContainer() override = default;
55
60
61 [[nodiscard]] uint32_t get_buffer_size() const { return m_buffer_size; }
62
63 /**
64 * @brief Instantiate and attach an AudioOutputAccessProcessor as the default processor.
65 *
66 * Overrides DynamicSoundStream::create_default_processor which would
67 * attach a ContiguousAccessProcessor unsuitable for a live output source.
68 */
69 void create_default_processor() override;
70
71 /**
72 * @brief Drive one cycle: pull snapshot, update m_processed_data, append to m_data.
73 *
74 * Overrides SoundStreamContainer::process_default to skip the
75 * is_ready_for_processing guard — the container is always ready once
76 * the backend has produced at least one cycle.
77 */
78 void process_default() override;
79
80private:
82 uint32_t m_buffer_size;
83
85};
86
87} // namespace MayaFlux::Kakshya
Default DataProcessor for AudioOutputContainer.
AudioOutputContainer & operator=(AudioOutputContainer &&)=delete
AudioOutputContainer(const AudioOutputContainer &)=delete
AudioOutputContainer(AudioOutputContainer &&)=delete
AudioOutputContainer & operator=(const AudioOutputContainer &)=delete
DynamicSoundStream subclass wrapping the live engine audio output.
Dynamic capacity streaming audio container with automatic resizing and circular buffering.
Comprehensive configuration for digital audio stream processing.