AudioFormat

Represents audio format configuration for spatial audio processing.

This class encapsulates the complete specification for audio data format, including:

  • Data type of audio samples (e.g., 16-bit integer, 32-bit float).

  • Sampling rate (default: 48000 Hz).

  • Channel data layout (interleaved/non-interleaved).

  • Byte ordering (little-endian/big-endian).

Typical usage scenarios:

  1. Audio capture configuration:

    val format = AudioFormat( channelDataType =
AudioFormat.AudioChannelDataType.INT16, sampleRate = 44100 )
  1. Format validation and comparison:

    if (inputFormat == expectedFormat) { // Handle compatible format }

Constructors

Link copied to clipboard
constructor(channelDataType: AudioFormat.AudioChannelDataType = AudioChannelDataType.INT16, sampleRate: Int = 48000, interleaved: Boolean = true, littleEndian: Boolean = true)

Constructs audio format with detailed parameters.

Types

Link copied to clipboard

The AudioChannelDataType audio type, which can be either signed 8-bit, signed 16-bit, signed 24-bit, signed 32-bit, or 32-bit floating point.

Properties

Link copied to clipboard

The audio channel data type, which can be either signed 8-bit, signed 16-bit, signed 24-bit, signed 32-bit, or 32-bit floating point.

Link copied to clipboard
var interleaved: Boolean

Whether the channel data is interleaved, default is true.

Link copied to clipboard
var littleEndian: Boolean

Whether the channel data is little endian, default is true.

Link copied to clipboard
var sampleRate: Int

The sample rate of the channel data, default is 48000.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun getFrameSize(channelCnt: Int): Int

Get the size of a frame in bytes.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String