AudioCapabilities


@UnstableApi
class AudioCapabilities


Represents the set of audio formats that a device is capable of playing.

Summary

Constants

const AudioCapabilities!

The minimum audio capabilities supported by all devices.

Public constructors

AudioCapabilities(supportedEncodings: IntArray?, maxChannelCount: Int)

This function is deprecated.

Use getCapabilities instead.

Public functions

Boolean
equals(other: Any?)
java-static AudioCapabilities!

This function is deprecated.

Use getCapabilities instead.

java-static AudioCapabilities!
getCapabilities(
    context: Context!,
    audioAttributes: AudioAttributes!,
    routedDevice: AudioDeviceInfo?
)

Returns the current audio capabilities.

Pair<Int!, Int!>?

This function is deprecated.

Use getEncodingAndChannelConfigForPassthrough instead.

Pair<Int!, Int!>?
getEncodingAndChannelConfigForPassthrough(
    format: Format!,
    audioAttributes: AudioAttributes!
)

Returns the encoding and channel config to use when configuring an AudioTrack in passthrough mode for the specified Format and AudioAttributes.

Int
Boolean

This function is deprecated.

Use isPassthroughPlaybackSupported instead.

Boolean
isPassthroughPlaybackSupported(
    format: Format!,
    audioAttributes: AudioAttributes!
)

Returns whether the device can do passthrough playback for format.

Boolean

Returns whether this device supports playback of the specified audio encoding.

String!

Public properties

Int

Constants

DEFAULT_AUDIO_CAPABILITIES

const val DEFAULT_AUDIO_CAPABILITIESAudioCapabilities!

The minimum audio capabilities supported by all devices.

Public constructors

AudioCapabilities

AudioCapabilities(supportedEncodings: IntArray?, maxChannelCount: Int)

Public functions

equals

fun equals(other: Any?): Boolean

getCapabilities

java-static fun getCapabilities(context: Context!): AudioCapabilities!

getCapabilities

java-static fun getCapabilities(
    context: Context!,
    audioAttributes: AudioAttributes!,
    routedDevice: AudioDeviceInfo?
): AudioCapabilities!

Returns the current audio capabilities.

Parameters
context: Context!

A context for obtaining the current audio capabilities.

audioAttributes: AudioAttributes!

The AudioAttributes to obtain capabilities for.

routedDevice: AudioDeviceInfo?

The AudioDeviceInfo audio will be routed to if known, or null to assume the default route.

Returns
AudioCapabilities!

The current audio capabilities for the device.

getEncodingAndChannelConfigForPassthrough

fun getEncodingAndChannelConfigForPassthrough(format: Format!): Pair<Int!, Int!>?

getEncodingAndChannelConfigForPassthrough

fun getEncodingAndChannelConfigForPassthrough(
    format: Format!,
    audioAttributes: AudioAttributes!
): Pair<Int!, Int!>?

Returns the encoding and channel config to use when configuring an AudioTrack in passthrough mode for the specified Format and AudioAttributes. Returns null if passthrough of the format is unsupported.

Parameters
format: Format!

The Format.

audioAttributes: AudioAttributes!

The AudioAttributes.

Returns
Pair<Int!, Int!>?

The encoding and channel config to use, or null if passthrough of the format is unsupported.

hashCode

fun hashCode(): Int

isPassthroughPlaybackSupported

fun isPassthroughPlaybackSupported(format: Format!): Boolean

isPassthroughPlaybackSupported

fun isPassthroughPlaybackSupported(
    format: Format!,
    audioAttributes: AudioAttributes!
): Boolean

Returns whether the device can do passthrough playback for format.

supportsEncoding

fun supportsEncoding(@C.Encoding encoding: Int): Boolean

Returns whether this device supports playback of the specified audio encoding.

Parameters
@C.Encoding encoding: Int

One of C.Encoding's ENCODING_* constants.

Returns
Boolean

Whether this device supports playback the specified audio encoding.

toString

fun toString(): String!

Public properties

maxChannelCount

val maxChannelCountInt