AudioCapabilities
@UnstableApi
public final class AudioCapabilities
Represents the set of audio formats that a device is capable of playing.
Summary
Constants |
|
|---|---|
static final AudioCapabilities |
The minimum audio capabilities supported by all devices. |
Public fields |
|
|---|---|
final int |
Public constructors |
|---|
This method is deprecated. Use |
Public methods |
|
|---|---|
boolean |
|
static AudioCapabilities |
This method is deprecated. Use |
static AudioCapabilities |
getCapabilities(Returns the current audio capabilities. |
@Nullable Pair<Integer, Integer> |
This method is deprecated. Use |
@Nullable Pair<Integer, Integer> |
getEncodingAndChannelConfigForPassthrough(Returns the encoding and channel config to use when configuring an |
int |
Returns the maximum number of channels the device can play at the same time. |
int |
hashCode() |
boolean |
This method is deprecated. Use |
boolean |
isPassthroughPlaybackSupported(Returns whether the device can do passthrough playback for |
boolean |
supportsEncoding(@C.Encoding int encoding)Returns whether this device supports playback of the specified audio |
String |
toString() |
Constants
DEFAULT_AUDIO_CAPABILITIES
public static final AudioCapabilities DEFAULT_AUDIO_CAPABILITIES
The minimum audio capabilities supported by all devices.
Public fields
Public constructors
AudioCapabilities
publicAudioCapabilities(
@Nullable int[] supportedEncodings,
int maxChannelCount
)
Public methods
getCapabilities
public static AudioCapabilities getCapabilities(
Context context,
AudioAttributes audioAttributes,
@Nullable AudioDeviceInfo routedDevice
)
Returns the current audio capabilities.
| Parameters | |
|---|---|
Context context |
A context for obtaining the current audio capabilities. |
AudioAttributes audioAttributes |
The |
@Nullable AudioDeviceInfo routedDevice |
The |
| Returns | |
|---|---|
AudioCapabilities |
The current audio capabilities for the device. |
getEncodingAndChannelConfigForPassthrough
public @Nullable Pair<Integer, Integer>getEncodingAndChannelConfigForPassthrough(Format format)
getEncodingAndChannelConfigForPassthrough
public @Nullable Pair<Integer, Integer> 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. Returns
null if passthrough of the format is unsupported.
| Parameters | |
|---|---|
Format format |
The |
AudioAttributes audioAttributes |
The |
getMaxChannelCount
public int getMaxChannelCount()
Returns the maximum number of channels the device can play at the same time.
isPassthroughPlaybackSupported
public boolean isPassthroughPlaybackSupported(
Format format,
AudioAttributes audioAttributes
)
Returns whether the device can do passthrough playback for format.
supportsEncoding
public boolean supportsEncoding(@C.Encoding int encoding)
Returns whether this device supports playback of the specified audio encoding.
| Parameters | |
|---|---|
@C.Encoding int encoding |
One of |
| Returns | |
|---|---|
boolean |
Whether this device supports playback the specified audio |