class AudioUtility

Provides various utility functionality relating to audio.

Public

Methods

staticConvertToMono

static void ConvertToMono(const u8 *input, u8 *outMono, u32 bitDepth, u32 sampleCount, u32 channelCount)

Converts a set of audio samples using multiple channels into a set of mono samples.

input
A set of input samples. Per-channels samples should be interleaved. Size of each sample is determined by . Total size of the buffer should be * * / 8.
outMono
Pre-allocated buffer to store the mono samples. Should be of * / 8 size.
bitDepth
Size of a single sample in bits.
sampleCount
Number of samples per a single channel.
channelCount
Number of channels in the input data.

staticConvertBitDepth

static void ConvertBitDepth(const u8 *input, u32 inputBitDepth, u8 *outConverted, u32 outputBitDepth, u32 sampleCount)

Converts a set of audio samples of a certain bit depth to a new bit depth.

input
A set of input samples. Total size of the buffer should be * / 8.
inputBitDepth
Size of a single sample in the array, in bits.
outConverted
Pre-allocated buffer to store the output samples in. Total size of the buffer should be * / 8.
outputBitDepth
Size of a single sample in the array, in bits.
sampleCount
Total number of samples to process.

staticConvertToFloat

static void ConvertToFloat(const u8 *input, u32 inputBitDepth, float *outFloat, u32 sampleCount)

Converts a set of audio samples of a certain bit depth to a set of floating point samples in range [-1, 1].

input
A set of input samples. Total size of the buffer should be * / 8. All input samples should be signed integers.
inputBitDepth
Size of a single sample in the array, in bits.
outFloat
Pre-allocated buffer to store the output samples in. Total size of the buffer should be * sizeof(float).
sampleCount
Total number of samples to process.

staticConvert24To32Bits

static i32 Convert24To32Bits(const u8 *input)

Converts a 24-bit signed integer into a 32-bit signed integer.

input
24-bit signed integer as an array of 3 bytes.

Returns: 32-bit signed integer.