Dela via


AudioManager.GetDirectPlaybackSupport(AudioFormat, AudioAttributes) Method

Definition

Returns a bitfield representing the different forms of direct playback currently available for a given audio format.

[Android.Runtime.Register("getDirectPlaybackSupport", "(Landroid/media/AudioFormat;Landroid/media/AudioAttributes;)I", "", ApiSince=33)]
public static int GetDirectPlaybackSupport (Android.Media.AudioFormat format, Android.Media.AudioAttributes attributes);
[<Android.Runtime.Register("getDirectPlaybackSupport", "(Landroid/media/AudioFormat;Landroid/media/AudioAttributes;)I", "", ApiSince=33)>]
static member GetDirectPlaybackSupport : Android.Media.AudioFormat * Android.Media.AudioAttributes -> int

Parameters

format
AudioFormat

the audio format (codec, sample rate, channels) being checked.

attributes
AudioAttributes

the AudioAttributes to be used for playback

Returns

the direct playback mode available with given format and attributes. The returned value will be #DIRECT_PLAYBACK_NOT_SUPPORTED or a combination of #DIRECT_PLAYBACK_OFFLOAD_SUPPORTED, #DIRECT_PLAYBACK_OFFLOAD_GAPLESS_SUPPORTED and #DIRECT_PLAYBACK_BITSTREAM_SUPPORTED. Note that if #DIRECT_PLAYBACK_OFFLOAD_GAPLESS_SUPPORTED is present in the returned value, then #DIRECT_PLAYBACK_OFFLOAD_SUPPORTED will be too.

Attributes

Remarks

Returns a bitfield representing the different forms of direct playback currently available for a given audio format.

Direct playback means that the audio stream is not altered by the framework. The audio stream will not be resampled, volume scaled, downmixed or mixed with other content by the framework. But it may be wrapped in a higher level protocol such as IEC61937 for passthrough.

Checking for direct support can help the app select the representation of audio content that most closely matches the capabilities of the device and peripherals (e.g. A/V receiver) connected to it. Note that the provided stream can still be re-encoded or mixed with other streams, if needed.

Java documentation for android.media.AudioManager.getDirectPlaybackSupport(android.media.AudioFormat, android.media.AudioAttributes).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to