MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ AudioBuffer() [2/2]

MayaFlux::Buffers::AudioBuffer::AudioBuffer ( uint32_t  channel_id,
uint32_t  num_samples = 512 
)

Creates a new audio buffer with specified channel and capacity.

Parameters
channel_idAudio channel identifier for this buffer
num_samplesBuffer capacity in audio samples (default: 512)

Initializes an audio buffer with the specified channel ID and allocates memory for the specified number of double-precision audio samples. The default capacity of 512 samples is optimized for typical audio processing block sizes.

Definition at line 15 of file AudioBuffer.cpp.

16 : m_channel_id(channel_id)
17 , m_num_samples(num_samples)
18 , m_default_processor(nullptr)
19 , m_has_data(true)
20 , m_should_remove(false)
21 , m_process_default(true)
22 , m_processing_chain(std::make_shared<BufferProcessingChain>())
23 , m_is_processing(false)
24{
25 if (num_samples != MayaFlux::Config::get_buffer_size()) {
26 std::cerr << "Warning: AudioBuffer initialized with a non-default number of samples ("
27 << num_samples << "). This may lead to unexpected behavior." << std::endl;
28 }
29 m_data.resize(num_samples);
30}
bool m_has_data
Whether the audio buffer has data to process this cycle.
bool m_should_remove
Whether the audio buffer should be removed from processing chains.
uint32_t m_channel_id
Audio channel identifier for this buffer.
std::atomic< bool > m_is_processing
uint32_t m_num_samples
Capacity of the buffer in audio samples.
std::shared_ptr< BufferProcessingChain > m_processing_chain
Audio transformation processing chain for this buffer.
std::shared_ptr< BufferProcessor > m_default_processor
Default audio transformation processor for this buffer.
std::vector< double > m_data
Vector storing the actual double-precision audio sample data.
bool m_process_default
Whether the audio buffer should be processed using its default processor.
uint32_t get_buffer_size()
Gets the buffer size from the default engine.
Definition Config.cpp:51

References MayaFlux::Config::get_buffer_size(), and m_data.

+ Here is the call graph for this function: