carb::audio::alignBytesToFrameFloor

Defined in carb/audio/AudioUtils.h

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

aligns a byte count to a frame boundary for an audio data format.

Parameters
  • bytes[in] the byte count to align to a frame boundary. This will be aligned to the previous frame boundary if it is not already aligned.

  • 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 requested byte count aligned to the previous frame boundary if it is not already aligned.

Returns

the requested byte count unmodified if it is already aligned to a frame boundary.