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

◆ build_for()

void MayaFlux::Kriya::SamplingPipeline::build_for ( uint64_t  milliseconds)

Finalize configuration and start processing for a bounded duration.

Converts milliseconds to pipeline cycles via sample rate and buffer size, then starts execution for exactly that many cycles. When the cycle count exhausts, the pipeline stops unconditionally regardless of voice state. Any active voice is cut immediately with no fade or drain.

Must not be called if build() has already been called.

Parameters
millisecondsDuration in milliseconds.

Definition at line 73 of file SamplingPipeline.cpp.

74{
75 if (m_built)
76 return;
77
80
81 m_pipeline >> static_cast<BufferOperation>(m_capture);
82
83 const double seconds = static_cast<double>(milliseconds) / 1000.0;
84 const uint64_t cycles = Vruta::seconds_to_blocks(
86
87 m_pipeline->on_complete([this] {
88 std::ranges::fill(m_buffer->get_data(), 0.0);
89 });
90
91 m_pipeline->execute_buffer_rate(cycles);
92
93 m_built = true;
94}
uint32_t get_buffer_size(ProcessingToken token) const
Gets the buffer size for a token.
uint64_t get_sample_rate() const
Gets the sample rate for a token (audio-specific)
bool supply_buffer_to(const std::shared_ptr< AudioBuffer > &buffer, ProcessingToken token, uint32_t channel, double mix=1.0, bool force=false)
std::shared_ptr< Buffers::AudioBuffer > m_buffer
std::shared_ptr< BufferPipeline > m_pipeline
@ AUDIO_BACKEND
Standard audio processing backend configuration.
uint64_t seconds_to_blocks(double seconds, uint32_t sample_rate, uint32_t block_size)
Convert seconds to number of processing blocks.

References MayaFlux::Buffers::AUDIO_BACKEND, MayaFlux::Buffers::BufferManager::get_buffer_size(), MayaFlux::Buffers::BufferManager::get_sample_rate(), m_buffer, m_built, m_capture, m_channel, m_mgr, m_pipeline, MayaFlux::Vruta::seconds_to_blocks(), and MayaFlux::Buffers::BufferManager::supply_buffer_to().

+ Here is the call graph for this function: