carb::audio::framesToBytes

Defined in carb/audio/AudioUtils.h

constexpr size_t carb::audio::framesToBytes(size_t frames, size_t channels, size_t bps)

converts a frame count to a byte offset.

Parameters
  • frames[in] the frame count to be converted to a byte count.

  • 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

    1. This does not properly handle byte offset calculations for compressed audio formats.

Returns

the calculated byte offset to the start of the requested frame of audio data.