54 AudioBuffer(uint32_t channel_id, uint32_t num_samples = 512);
73 virtual void setup(uint32_t channel, uint32_t num_samples);
83 virtual void resize(uint32_t num_samples);
92 virtual void clear()
override;
111 inline virtual std::vector<double>&
get_data() {
return m_data; }
120 inline virtual const std::vector<double>&
get_data()
const {
return m_data; }
129 virtual void process_default()
override;
158 virtual void set_num_samples(uint32_t num_samples);
168 virtual void set_default_processor(std::shared_ptr<BufferProcessor> processor)
override;
177 inline virtual std::shared_ptr<BufferProcessor>
get_default_processor()
const override {
return m_default_processor; }
187 inline virtual std::shared_ptr<BufferProcessingChain>
get_processing_chain()
override {
return m_processing_chain; }
198 virtual void set_processing_chain(std::shared_ptr<BufferProcessingChain> chain,
bool force =
false)
override;
209 inline virtual double&
get_sample(uint32_t index) {
return get_data()[index]; }
233 inline virtual bool needs_removal()
const override {
return m_should_remove; }
288 bool expected =
false;
289 return m_is_processing.compare_exchange_strong(expected,
true,
290 std::memory_order_acquire, std::memory_order_relaxed);
304 m_is_processing.store(
false, std::memory_order_release);
319 return m_is_processing.load(std::memory_order_acquire);
335 virtual std::shared_ptr<AudioBuffer> clone_to(uint32_t channel);
337 std::shared_ptr<Buffer> clone_to(uint8_t dest_desc)
override;
349 virtual bool read_once(std::shared_ptr<AudioBuffer> buffer,
bool force =
false);
456 bool m_internal_usage {};
virtual ~AudioBuffer() override=default
Virtual destructor for proper resource management.
virtual void mark_for_processing(bool has_data) override
Marks the audio buffer for processing in the current cycle.
void set_channel_id(uint32_t id)
Sets the audio channel identifier for this buffer.
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.
virtual uint32_t get_channel_id() const
Gets the audio channel identifier for this buffer.
virtual std::shared_ptr< BufferProcessor > create_default_processor()
Creates a default audio transformation processor for this buffer type.
void force_internal_usage(bool internal) override
Marks the buffer as internal-only, preventing root aggregation.
virtual bool needs_removal() const override
Checks if the buffer should be removed from the processing chain This is relevant when using SignalSo...
uint32_t m_channel_id
Audio channel identifier for this buffer.
virtual bool has_data_for_cycle() const override
Checks if the audio buffer has data for the current processing cycle.
std::atomic< bool > m_is_processing
bool is_processing() const override
Checks if the buffer is currently being processed.
uint32_t m_num_samples
Capacity of the buffer in audio samples.
virtual double & get_sample(uint32_t index)
Gets a reference to a specific audio sample in the buffer.
virtual std::vector< double > & get_data()
Gets mutable access to the buffer's underlying audio data.
virtual uint32_t get_num_samples() const
Gets the current capacity of the audio buffer.
virtual void mark_for_removal() override
Marks the audio buffer for removal from processing chains.
std::shared_ptr< BufferProcessingChain > m_processing_chain
Audio transformation processing chain for this buffer.
virtual bool needs_default_processing() override
Checks if the audio buffer should undergo default processing.
void release_processing() override
Releases processing rights for the buffer.
bool try_acquire_processing() override
Attempts to acquire processing rights for the buffer.
std::shared_ptr< BufferProcessor > m_default_processor
Default audio transformation processor for this buffer.
virtual std::shared_ptr< BufferProcessor > get_default_processor() const override
Gets the current default audio transformation processor.
virtual void enforce_default_processing(bool should_process) override
Controls whether the audio buffer should use default processing.
std::vector< double > m_data
Vector storing the actual double-precision audio sample data.
virtual std::shared_ptr< BufferProcessingChain > get_processing_chain() override
Gets the audio transformation chain attached to this buffer.
bool is_internal_only() const override
Checks if the buffer is marked as internal-only.
virtual const std::vector< double > & get_data() const
Gets read-only access to the buffer's underlying audio data.
bool m_process_default
Whether the audio buffer should be processed using its default processor.
Concrete audio implementation of the Buffer interface for double-precision audio data.
Backend-agnostic interface for sequential data storage and transformation.