carb::audio::millisecondsToBytes
Defined in carb/audio/AudioUtils.h
-
constexpr size_t carb::audio::millisecondsToBytes(size_t timeInMilliseconds, size_t frameRate, size_t channels, SampleFormat format)
converts a time in milliseconds to a byte 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.
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 milliseconds. Note that this will not be an exact value because the data format may not divide evenly into the requested number of milliseconds.