@UnstableApi
class WavUtil


Utilities for handling WAVE files.

Summary

Constants

const Int
DATA_FOURCC = 1684108385

Four character code for "data".

const Int
DS64_FOURCC = 1685272116

Four character code for "ds64".

const Int
FACT_FOURCC = 1717658484

Four character code for "fact".

const Int
FMT_FOURCC = 1718449184

Four character code for "fmt ".

const Int
RF64_FOURCC = 1380333108

Four character code for "RF64".

const Int
RIFF_FOURCC = 1380533830

Four character code for "RIFF".

const Int

WAVE type value for 8-bit ITU-T G.711 A-law audio data.

const Int

WAVE type value for float PCM audio data.

const Int

WAVE type value for IMA ADPCM audio data.

const Int

WAVE type value for 8-bit ITU-T G.711 mu-law audio data.

const Int

WAVE type value for integer PCM audio data.

const Int

WAVE type value for extended WAVE format.

const Int
WAVE_FOURCC = 1463899717

Four character code for "WAVE".

Public functions

java-static Int
@C.PcmEncoding
getPcmEncodingForType(type: Int, bitsPerSample: Int)

Returns the C.PcmEncoding for the given WAVE format type value, or ENCODING_INVALID if the type is not a known PCM type.

java-static Int

Returns the WAVE format type value for the given C.PcmEncoding.

java-static Boolean
isChannelMaskValid(channelMask: Int, channelCount: Int)

Checks whether the given Microsoft WAVE channel mask is valid and matches the channel count.

java-static Int

Maps the given Microsoft WAVE channel mask to the corresponding Android android.media.AudioFormat channel mask.

Constants

DATA_FOURCC

const val DATA_FOURCC = 1684108385: Int

Four character code for "data".

DS64_FOURCC

const val DS64_FOURCC = 1685272116: Int

Four character code for "ds64".

FACT_FOURCC

const val FACT_FOURCC = 1717658484: Int

Four character code for "fact".

FMT_FOURCC

const val FMT_FOURCC = 1718449184: Int

Four character code for "fmt ".

RF64_FOURCC

const val RF64_FOURCC = 1380333108: Int

Four character code for "RF64".

RIFF_FOURCC

const val RIFF_FOURCC = 1380533830: Int

Four character code for "RIFF".

TYPE_ALAW

const val TYPE_ALAW = 6: Int

WAVE type value for 8-bit ITU-T G.711 A-law audio data.

TYPE_FLOAT

const val TYPE_FLOAT = 3: Int

WAVE type value for float PCM audio data.

TYPE_IMA_ADPCM

const val TYPE_IMA_ADPCM = 17: Int

WAVE type value for IMA ADPCM audio data.

TYPE_MLAW

const val TYPE_MLAW = 7: Int

WAVE type value for 8-bit ITU-T G.711 mu-law audio data.

TYPE_PCM

const val TYPE_PCM = 1: Int

WAVE type value for integer PCM audio data.

TYPE_WAVE_FORMAT_EXTENSIBLE

const val TYPE_WAVE_FORMAT_EXTENSIBLE = 65534: Int

WAVE type value for extended WAVE format.

WAVE_FOURCC

const val WAVE_FOURCC = 1463899717: Int

Four character code for "WAVE".

Public functions

getPcmEncodingForType

@C.PcmEncoding
java-static fun getPcmEncodingForType(type: Int, bitsPerSample: Int): Int

Returns the C.PcmEncoding for the given WAVE format type value, or ENCODING_INVALID if the type is not a known PCM type.

getTypeForPcmEncoding

java-static fun getTypeForPcmEncoding(@C.PcmEncoding pcmEncoding: Int): Int

Returns the WAVE format type value for the given C.PcmEncoding.

Parameters
@C.PcmEncoding pcmEncoding: Int

The C.PcmEncoding value.

Returns
Int

The corresponding WAVE format type.

Throws
java.lang.IllegalArgumentException

If pcmEncoding is not a C.PcmEncoding, or if it's ENCODING_INVALID or NO_VALUE.

isChannelMaskValid

java-static fun isChannelMaskValid(channelMask: Int, channelCount: Int): Boolean

Checks whether the given Microsoft WAVE channel mask is valid and matches the channel count.

Parameters
channelMask: Int

The WAVE channel mask.

channelCount: Int

The number of channels.

Returns
Boolean

Whether the channel mask is valid.

mapToAudioFormatChannelMask

java-static fun mapToAudioFormatChannelMask(wavChannelMask: Int): Int

Maps the given Microsoft WAVE channel mask to the corresponding Android android.media.AudioFormat channel mask.

Parameters
wavChannelMask: Int

The WAVE channel mask.

Returns
Int

The mapped android.media.AudioFormat channel mask, or NO_VALUE if the channel mask is unknown or not applicable (such as for Ambisonics).