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

◆ seconds_to_samples()

MAYAFLUX_API uint64_t MayaFlux::seconds_to_samples ( double  seconds)

Converts a time duration in seconds to the equivalent number of audio samples.

Parameters
secondsTime duration in seconds
Returns
Equivalent number of audio samples based on the current sample rate

This function uses the sample rate from the default engine to calculate how many audio samples correspond to the given time duration in seconds. It's useful for scheduling tasks or processing buffers based on time intervals.

Definition at line 244 of file Chronie.cpp.

245{
246 uint64_t sample_rate = 48000;
247 if (get_context().is_running()) {
248 sample_rate = get_context().get_stream_info().sample_rate;
249 }
250 return static_cast<uint64_t>(seconds * sample_rate);
251}
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 sample_rate
Number of samples processed per second (Hz)

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

Referenced by route_network(), and route_node().

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