MayaFlux 0.4.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 255 of file Chronie.cpp.

256{
257 uint32_t sample_rate = 48000;
258 uint32_t block_size = 512;
259
260 if (get_context().is_running()) {
261 sample_rate = get_context().get_stream_info().sample_rate;
262 block_size = get_context().get_stream_info().buffer_size;
263 }
264
265 return Vruta::seconds_to_blocks(seconds, sample_rate, block_size);
266}
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:68
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: