Passer directement au contenu

Les plus consultés

Consultés récemment

navigation

AudioDeviceInfo

public final class AudioDeviceInfo
extends Object

java.lang.Object
   ↳ android.media.AudioDeviceInfo


Class to provide information about the audio devices.

Summary

Constants

int TYPE_AUX_LINE

A device type describing the auxiliary line-level connectors.

int TYPE_BLUETOOTH_A2DP

A device type describing a Bluetooth device supporting the A2DP profile.

int TYPE_BLUETOOTH_SCO

A device type describing a Bluetooth device typically used for telephony.

int TYPE_BUILTIN_EARPIECE

A device type describing the attached earphone speaker.

int TYPE_BUILTIN_MIC

A device type describing the microphone(s) built in a device.

int TYPE_BUILTIN_SPEAKER

A device type describing the speaker system (i.e.

int TYPE_BUS

A type-agnostic device used for communication with external audio systems

int TYPE_DOCK

A device type describing the audio device associated with a dock.

int TYPE_FM

A device type associated with the transmission of audio signals over FM.

int TYPE_FM_TUNER

A device type for accessing the audio content transmitted over FM.

int TYPE_HDMI

A device type describing an HDMI connection .

int TYPE_HDMI_ARC

A device type describing the Audio Return Channel of an HDMI connection.

int TYPE_IP

A device type connected over IP.

int TYPE_LINE_ANALOG

A device type describing an analog line-level connection.

int TYPE_LINE_DIGITAL

A device type describing a digital line connection (e.g.

int TYPE_TELEPHONY

A device type describing the transmission of audio signals over the telephony network.

int TYPE_TV_TUNER

A device type for accessing the audio content transmitted over the TV tuner system.

int TYPE_UNKNOWN

A device type associated with an unknown or uninitialized device.

int TYPE_USB_ACCESSORY

A device type describing a USB audio device in accessory mode.

int TYPE_USB_DEVICE

A device type describing a USB audio device.

int TYPE_USB_HEADSET

A device type describing a USB audio headset.

int TYPE_WIRED_HEADPHONES

A device type describing a pair of wired headphones.

int TYPE_WIRED_HEADSET

A device type describing a headset, which is the combination of a headphones and microphone.

Public methods

boolean equals(Object o)

Indicates whether some other object is "equal to" this one.

int[] getChannelCounts()
int[] getChannelIndexMasks()
int[] getChannelMasks()
int[] getEncodings()
int getId()
CharSequence getProductName()
int[] getSampleRates()
int getType()
int hashCode()

Returns a hash code value for the object.

boolean isSink()
boolean isSource()

Inherited methods

Constants

TYPE_AUX_LINE

added in API level 23
int TYPE_AUX_LINE

A device type describing the auxiliary line-level connectors.

Constant Value: 19 (0x00000013)

TYPE_BLUETOOTH_A2DP

added in API level 23
int TYPE_BLUETOOTH_A2DP

A device type describing a Bluetooth device supporting the A2DP profile.

Constant Value: 8 (0x00000008)

TYPE_BLUETOOTH_SCO

added in API level 23
int TYPE_BLUETOOTH_SCO

A device type describing a Bluetooth device typically used for telephony.

Constant Value: 7 (0x00000007)

TYPE_BUILTIN_EARPIECE

added in API level 23
int TYPE_BUILTIN_EARPIECE

A device type describing the attached earphone speaker.

Constant Value: 1 (0x00000001)

TYPE_BUILTIN_MIC

added in API level 23
int TYPE_BUILTIN_MIC

A device type describing the microphone(s) built in a device.

Constant Value: 15 (0x0000000f)

TYPE_BUILTIN_SPEAKER

added in API level 23
int TYPE_BUILTIN_SPEAKER

A device type describing the speaker system (i.e. a mono speaker or stereo speakers) built in a device.

Constant Value: 2 (0x00000002)

TYPE_BUS

added in API level 24
int TYPE_BUS

A type-agnostic device used for communication with external audio systems

Constant Value: 21 (0x00000015)

TYPE_DOCK

added in API level 23
int TYPE_DOCK

A device type describing the audio device associated with a dock.

Constant Value: 13 (0x0000000d)

TYPE_FM

added in API level 23
int TYPE_FM

A device type associated with the transmission of audio signals over FM.

Constant Value: 14 (0x0000000e)

TYPE_FM_TUNER

added in API level 23
int TYPE_FM_TUNER

A device type for accessing the audio content transmitted over FM.

Constant Value: 16 (0x00000010)

TYPE_HDMI

added in API level 23
int TYPE_HDMI

A device type describing an HDMI connection .

Constant Value: 9 (0x00000009)

TYPE_HDMI_ARC

added in API level 23
int TYPE_HDMI_ARC

A device type describing the Audio Return Channel of an HDMI connection.

Constant Value: 10 (0x0000000a)

TYPE_IP

added in API level 23
int TYPE_IP

A device type connected over IP.

Constant Value: 20 (0x00000014)

TYPE_LINE_ANALOG

added in API level 23
int TYPE_LINE_ANALOG

A device type describing an analog line-level connection.

Constant Value: 5 (0x00000005)

TYPE_LINE_DIGITAL

added in API level 23
int TYPE_LINE_DIGITAL

A device type describing a digital line connection (e.g. SPDIF).

Constant Value: 6 (0x00000006)

TYPE_TELEPHONY

added in API level 23
int TYPE_TELEPHONY

A device type describing the transmission of audio signals over the telephony network.

Constant Value: 18 (0x00000012)

TYPE_TV_TUNER

added in API level 23
int TYPE_TV_TUNER

A device type for accessing the audio content transmitted over the TV tuner system.

Constant Value: 17 (0x00000011)

TYPE_UNKNOWN

added in API level 23
int TYPE_UNKNOWN

A device type associated with an unknown or uninitialized device.

Constant Value: 0 (0x00000000)

TYPE_USB_ACCESSORY

added in API level 23
int TYPE_USB_ACCESSORY

A device type describing a USB audio device in accessory mode.

Constant Value: 12 (0x0000000c)

TYPE_USB_DEVICE

added in API level 23
int TYPE_USB_DEVICE

A device type describing a USB audio device.

Constant Value: 11 (0x0000000b)

TYPE_USB_HEADSET

added in API level 26
int TYPE_USB_HEADSET

A device type describing a USB audio headset.

Constant Value: 22 (0x00000016)

TYPE_WIRED_HEADPHONES

added in API level 23
int TYPE_WIRED_HEADPHONES

A device type describing a pair of wired headphones.

Constant Value: 4 (0x00000004)

TYPE_WIRED_HEADSET

added in API level 23
int TYPE_WIRED_HEADSET

A device type describing a headset, which is the combination of a headphones and microphone.

Constant Value: 3 (0x00000003)

Public methods

equals

added in API level 23
boolean equals (Object o)

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true).

Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.

Parameters
o Object: the reference object with which to compare.

Returns
boolean true if this object is the same as the obj argument; false otherwise.

getChannelCounts

added in API level 23
int[] getChannelCounts ()

Returns
int[] An array of channel counts (1, 2, 4, ...) for which this audio device can be configured. Note: an empty array indicates that the device supports arbitrary channel counts.

This value will never be null.

getChannelIndexMasks

added in API level 23
int[] getChannelIndexMasks ()

Returns
int[] An array of channel index masks for which this audio device can be configured.

This value will never be null.

getChannelMasks

added in API level 23
int[] getChannelMasks ()

Returns
int[] An array of channel position masks (e.g. CHANNEL_IN_STEREO, CHANNEL_OUT_7POINT1) for which this audio device can be configured.

This value will never be null.

getEncodings

added in API level 23
int[] getEncodings ()

Returns
int[] An array of audio encodings (e.g. ENCODING_PCM_16BIT, ENCODING_PCM_FLOAT) supported by the audio device. ENCODING_PCM_FLOAT indicates the device supports more than 16 bits of integer precision. As there is no AudioFormat constant specifically defined for 24-bit PCM, the value ENCODING_PCM_FLOAT indicates that AudioTrack or AudioRecord can preserve at least 24 bits of integer precision to that device.

This value will never be null.

getId

added in API level 23
int getId ()

Returns
int The internal device ID.

getProductName

added in API level 23
CharSequence getProductName ()

Returns
CharSequence The human-readable name of the audio device.

getSampleRates

added in API level 23
int[] getSampleRates ()

Returns
int[] An array of sample rates supported by the audio device. Note: an empty array indicates that the device supports arbitrary rates.

This value will never be null.

getType

added in API level 23
int getType ()

Returns
int The device type identifier of the audio device (i.e. TYPE_BUILTIN_SPEAKER).

hashCode

added in API level 23
int hashCode ()

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the Java™ programming language.)

Returns
int a hash code value for this object.

isSink

added in API level 23
boolean isSink ()

Returns
boolean true if the audio device is a sink for audio data (i.e. an output).

isSource

added in API level 23
boolean isSource ()

Returns
boolean true if the audio device is a source for audio data (e.e an input).

Ce site Web utilise des cookies pour enregistrer vos préférences relatives à la langue du site et aux options d'affichage.

Recevez les dernières actualités destinées aux développeurs Android, ainsi que des conseils qui vous mèneront vers le succès sur Google Play.

* Champs obligatoires

Super !

Suivez Google Developers sur WeChat

Consulter ce site en  ?

Vous avez demandé une page en , mais la langue indiquée dans vos préférences linguistiques pour ce site est la suivante : .

Souhaitez-vous modifier vos préférences linguistiques et parcourir ce site en  ? Pour modifier ultérieurement vos préférences linguistiques, utilisez le menu "Langue" au bas de chaque page.

Cette classe nécessite le niveau d'API  ou supérieur

Ce document est masqué, car vous avez sélectionné le niveau d'API  pour la documentation. Vous pouvez modifier le niveau d'API pour la documentation avec le sélecteur situé au-dessus du menu de navigation de gauche.

Pour découvrir comment déterminer le niveau d'API nécessaire pour votre application, consultez le guide sur la prise en charge des différentes versions de plate-forme (en anglais).

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)