carb::audio::bytesToMicroseconds

Defined in carb/audio/AudioUtils.h

constexpr size_t carb::audio::bytesToMicroseconds(size_t bytes, size_t frameRate, size_t channels, SampleFormat format)

converts a byte count to an approximate time in microseconds.

Parameters
  • bytes[in] the number of bytes to be converted to a time in microseconds. Note that this byte count is expected to be frame aligned.

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

  • channels[in] the number of channels in the audio data format.

  • format[in] the sample format of the data. This must be a PCM sample format.

Returns

the approximate number of microseconds of audio data that the requested byte count represents for the given format.