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

◆ activate_buffer()

void MayaFlux::Kriya::TemporalActivation::activate_buffer ( const std::shared_ptr< Buffers::Buffer > &  buffer,
double  duration_seconds,
Buffers::ProcessingToken  token = Buffers::ProcessingToken::AUDIO_BACKEND,
uint32_t  channel = 0 
)

Activates a buffer for a specified duration.

Parameters
bufferThe buffer to activate
tokenThe processing token associated with the buffer
duration_secondsThe duration to keep the buffer active (in seconds)
channelOptional output channel to connect the buffer to (default is 0) This method activates the specified buffer by connecting it to the output channel, and starts a timer for the specified duration. When the timer expires, the buffer is automatically disconnected from the output channel, effectively deactivating it.

If another node, network, or buffer is already active, it will be cancelled before activating the new one.

Definition at line 129 of file Timers.cpp.

133{
134 cancel();
135
136 m_current_buffer = buffer;
137 m_buffer_token = token;
138 m_channels = { channel };
140
141 m_buffer_manager.add_buffer(buffer, token, channel);
142
143 m_timer.schedule(duration_seconds, [this]() {
145 });
146}
void add_buffer(const std::shared_ptr< Buffer > &buffer, ProcessingToken token, uint32_t channel=0)
Adds a buffer to a token and channel.
Buffers::ProcessingToken m_buffer_token
The processing token associated with the currently active buffer.
Definition Timers.hpp:406
std::vector< uint32_t > m_channels
The output channels the current node is connected to.
Definition Timers.hpp:415
void cleanup_current_operation()
Cleans up the current operation, disconnecting the entity and resetting state.
Definition Timers.cpp:148
std::shared_ptr< Buffers::Buffer > m_current_buffer
The currently active buffer being played.
Definition Timers.hpp:388
void cancel()
Cancels any currently active node.
Definition Timers.cpp:193
Buffers::BufferManager & m_buffer_manager
Reference to the buffer manager that manages processing buffers.
Definition Timers.hpp:353
Timer m_timer
The timer used to schedule processing duration.
Definition Timers.hpp:361
void schedule(double delay_seconds, std::function< void()> callback)
Schedules a callback to execute after a delay.
Definition Timers.cpp:18

References MayaFlux::Buffers::BufferManager::add_buffer(), BUFFER, cancel(), cleanup_current_operation(), m_active_type, m_buffer_manager, m_buffer_token, m_channels, m_current_buffer, m_timer, and MayaFlux::Kriya::Timer::schedule().

+ Here is the call graph for this function: