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

◆ seconds_to_blocks()

MAYAFLUX_API uint64_t MayaFlux::seconds_to_blocks ( double  seconds)

Converts a time duration in seconds to the equivalent number of processing blocks.

Parameters
secondsTime duration in seconds
Returns
Equivalent number of blocks based on current sample rate and block size

Uses the sample rate and block size from the default engine. Falls back to 48kHz/512 samples if engine is not running.

Definition at line 294 of file Chronie.cpp.

295{
296 uint32_t sample_rate = 48000;
297 uint32_t block_size = 512;
298
299 if (get_context().is_running()) {
300 sample_rate = get_context().get_stream_info().sample_rate;
301 block_size = get_context().get_stream_info().buffer_size;
302 }
303
304 return Vruta::seconds_to_blocks(seconds, sample_rate, block_size);
305}
GlobalStreamInfo & get_stream_info()
Gets the current stream configuration.
Definition Engine.hpp:224
Core::Engine & get_context()
Gets the default engine instance.
Definition Core.cpp:101
uint32_t buffer_size
Number of samples per processing block.
uint32_t sample_rate
Number of samples processed per second (Hz)

References MayaFlux::Core::GlobalStreamInfo::buffer_size, get_context(), MayaFlux::Core::Engine::get_stream_info(), MayaFlux::Core::GlobalStreamInfo::sample_rate, and MayaFlux::Vruta::seconds_to_blocks().

Referenced by route_buffer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: