MayaFlux 0.3.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 253 of file Chronie.cpp.

254{
255 uint32_t sample_rate = 48000;
256 uint32_t block_size = 512;
257
258 if (get_context().is_running()) {
259 sample_rate = get_context().get_stream_info().sample_rate;
260 block_size = get_context().get_stream_info().buffer_size;
261 }
262
263 return Vruta::seconds_to_blocks(seconds, sample_rate, block_size);
264}
GlobalStreamInfo & get_stream_info()
Gets the current stream configuration.
Definition Engine.hpp:212
Core::Engine & get_context()
Gets the default engine instance.
Definition Core.cpp:58
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: