55 AudioBuffer(uint32_t channel_id, uint32_t num_samples = 512);
74 virtual void setup(uint32_t channel, uint32_t num_samples);
94 virtual void resize(uint32_t num_samples);
103 virtual void clear()
override;
122 inline virtual std::vector<double>&
get_data() {
return m_data; }
131 inline virtual const std::vector<double>&
get_data()
const {
return m_data; }
140 virtual void process_default()
override;
169 virtual void set_num_samples(uint32_t num_samples);
179 virtual void set_default_processor(
const std::shared_ptr<BufferProcessor>& processor)
override;
188 inline virtual std::shared_ptr<BufferProcessor>
get_default_processor()
const override {
return m_default_processor; }
198 inline virtual std::shared_ptr<BufferProcessingChain>
get_processing_chain()
override {
return m_processing_chain; }
209 virtual void set_processing_chain(
const std::shared_ptr<BufferProcessingChain>& chain,
bool force =
false)
override;
220 inline virtual double&
get_sample(uint32_t index) {
return get_data()[index]; }
244 inline virtual bool needs_removal()
const override {
return m_should_remove; }
299 bool expected =
false;
300 return m_is_processing.compare_exchange_strong(expected,
true,
301 std::memory_order_acquire, std::memory_order_relaxed);
315 m_is_processing.store(
false, std::memory_order_release);
330 return m_is_processing.load(std::memory_order_acquire);
346 virtual std::shared_ptr<AudioBuffer> clone_to(uint32_t channel);
348 std::shared_ptr<Buffer> clone_to(uint8_t dest_desc)
override;
360 virtual bool read_once(
const std::shared_ptr<AudioBuffer>& buffer,
bool force =
false);
467 bool m_internal_usage {};
static MayaFlux::Nodes::ProcessingToken token
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.
virtual void setup_processors(ProcessingToken token)
Sets up audio processors for the specified processing token.
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.
ProcessingToken
Bitfield enum defining processing characteristics and backend requirements for buffer operations.