carb::audio::microsecondsToFrames

Defined in carb/audio/AudioUtils.h

constexpr size_t carb::audio::microsecondsToFrames(size_t timeInMicroseconds, size_t frameRate)

converts a time in microseconds to a frame count.

Parameters
  • timeInMicroseconds[in] the time in microseconds 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 microseconds at the requested frame rate. Note that if the time isn’t exactly divisible by the frame rate, a partial frame may be truncated.