carb::audio::microsecondsToBytes
Defined in carb/audio/AudioUtils.h
-
constexpr size_t carb::audio::microsecondsToBytes(size_t timeInMicroseconds, size_t frameRate, size_t channels, size_t bps)
converts a time in microseconds to a byte 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.
channels – [in] the number of channels in the audio data format.
bps – [in] the number of bits per sample of audio data. This must be 8, 16, 24, or 32. This does not properly handle byte offset calculations for compressed audio formats.
- Returns
the approximate number of bytes of audio data required to fill the requested number of microseconds. Note that this will not be an exact value because the data format may not divide evenly into the requested number of microseconds.