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

◆ clone_to() [1/3]

std::shared_ptr< AudioBuffer > MayaFlux::Buffers::AudioBuffer::clone_to ( uint32_t  channel)
virtual

Creates a clone of this audio buffer for a specific channel.

Parameters
channelChannel identifier for the cloned buffer
Returns
Shared pointer to the cloned audio buffer

This method creates a new instance of the audio buffer with the same data and properties, but assigned to a different audio channel. The cloned buffer can be used independently in audio processing chains.

NOTE: The moment of cloning is the divergence point between the original and the cloned. While they both will follow the same processing chain or have the same default procesor, any changes made to one buffer after cloning will not affect the other.

Reimplemented from MayaFlux::Buffers::AudioBuffer.

Definition at line 368 of file AudioBuffer.cpp.

88{
89 auto buffer = std::make_shared<AudioBuffer>(channel, m_num_samples);
90 buffer->get_data() = m_data;
91 buffer->set_default_processor(m_default_processor);
92 buffer->set_processing_chain(get_processing_chain(), true);
93
94 return buffer;
95}
std::shared_ptr< NetworkGeometryBuffer > buffer
uint32_t m_num_samples
Capacity of the buffer in audio samples.
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.
std::shared_ptr< BufferProcessingChain > get_processing_chain() override
Gets the audio transformation chain attached to this buffer.