carb::audio::microsecondsToBytes
Defined in carb/audio/AudioUtils.h
-
constexpr size_t carb::audio::microsecondsToBytes(size_t timeInMicroseconds, size_t frameRate, size_t channels, SampleFormat format)
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.
format – [in] the sample format for the data. This must be a PCM sample format.
- 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.