carb::audio::millisecondsToFrames

Defined in carb/audio/AudioUtils.h

constexpr size_t carb::audio::millisecondsToFrames(size_t timeInMilliseconds, size_t frameRate)

converts a time in milliseconds to a frame count.

Parameters
  • timeInMilliseconds[in] the time in milliseconds to be converted to a frame count.

  • frameRate[in] the frame rate of the audio that needs a frame count calculated.

Returns

the minimum number of frames required to cover the requested number of milliseconds at the requested frame rate. Note that if the time isn’t exactly divisible by the frame rate, a partial frame may be truncated.