carb::audio::bytesToFrames

Defined in carb/audio/AudioUtils.h

inline size_t carb::audio::bytesToFrames(size_t bytes, const SoundFormat *format)

converts a byte count to a frame count.

Parameters
  • bytes[in] the number of bytes to be converted to a frame count. Note that this byte count is expected to be frame aligned. If it is not frame aligned, the return value will be the offset for the frame that includes the requested byte offset.

  • format[in] the format information block for the sound data this time is being converted for. This must be a PCM sample format.

Returns

the calculated frame offset that will contain the requested byte offset.