public class AudioDeviceDescriptor extends Object
The device details include the ID, name, address, type (defined by DeviceType),
and role (defined by DeviceRole).
SystemCapability.Multimedia#AUDIO| 限定符和类型 | 类 | 说明 |
|---|---|---|
static class |
AudioDeviceDescriptor.DeviceFlag |
Describes audio device flags.
|
static class |
AudioDeviceDescriptor.DeviceRole |
Describes audio device roles.
|
static class |
AudioDeviceDescriptor.DeviceType |
Describes audio device types.
|
| 构造器 | 说明 |
|---|---|
AudioDeviceDescriptor(int id,
String name,
String address,
AudioDeviceDescriptor.DeviceType type,
AudioDeviceDescriptor.DeviceRole role,
int[] samplingRates,
int[] channelMasks,
int[] channelIndexMasks,
List<AudioStreamInfo.EncodingFormat> encodings) |
A constructor used to create an
AudioDeviceDescriptor instance. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
boolean |
equals(Object object) |
Checks whether the audio device details, including the ID, name, address, type, and role, specified by the
input parameters of the
AudioDeviceDescriptor method are the same as those of an existing audio device. |
String |
getAddress() |
Obtains a device address.
|
int[] |
getChannelCounts() |
Obtains an array whose elements indicate the channel types supported by the device.
|
int[] |
getChannelIndexMasks() |
Obtains the channel index masks.
|
int[] |
getChannelMasks() |
Obtains the channel masks.
|
List<AudioStreamInfo.EncodingFormat> |
getEncodings() |
Obtains the encoding formats.
|
int |
getId() |
Obtains a device ID.
|
String |
getName() |
Obtains a device name.
|
AudioDeviceDescriptor.DeviceRole |
getRole() |
Obtains a device role.
|
int[] |
getSamplingRates() |
Obtains the sampling rates.
|
AudioDeviceDescriptor.DeviceType |
getType() |
Obtains a device type.
|
int |
hashCode() |
Generates a hash code value based on the ID, name, address, type, role, sampling rates, channel masks,
and channel index masks of the device.
|
boolean |
isInputDevice() |
Checks whether the device is an input device.
|
boolean |
isOutputDevice() |
Checks whether the device is an output device.
|
void |
setAddress(String address) |
Sets a device address.
|
void |
setChannelIndexMasks(int[] channelIndexMasks) |
Sets the channel index masks.
|
void |
setChannelMasks(int[] channelMasks) |
Sets the channel masks.
|
void |
setEncodings(List<AudioStreamInfo.EncodingFormat> encodings) |
Sets the encoding formats.
|
void |
setId(int id) |
Sets a device ID.
|
void |
setName(String name) |
Sets a device name.
|
void |
setRole(AudioDeviceDescriptor.DeviceRole role) |
Sets a device role.
|
void |
setSamplingRates(int[] samplingRates) |
Sets the sampling rates.
|
void |
setType(AudioDeviceDescriptor.DeviceType type) |
Sets a device type.
|
public AudioDeviceDescriptor(int id,
String name,
String address,
AudioDeviceDescriptor.DeviceType type,
AudioDeviceDescriptor.DeviceRole role,
int[] samplingRates,
int[] channelMasks,
int[] channelIndexMasks,
List<AudioStreamInfo.EncodingFormat> encodings)
AudioDeviceDescriptor instance.id - Indicates the device ID.name - Indicates the device name.address - Indicates the device address.type - Indicates the device type defined by DeviceType.role - Indicates the device role defined by DeviceRole.public boolean equals(Object object)
AudioDeviceDescriptor method are the same as those of an existing audio device.
This method overrides the equals method.
equals 在类中 Objectobject - Indicates an AudioDeviceDescriptor object.true if the device details are the same; returns false otherwise.Object.hashCode(),
HashMappublic int hashCode()
hashCode 在类中 ObjectObject.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)public boolean isOutputDevice()
true if the device is an output device; returns false otherwise.public boolean isInputDevice()
true if the device is an input device; returns false otherwise.public int getId()
public void setId(int id)
id - Indicates the device ID.public String getName()
public void setName(String name)
name - Indicates the device name.public String getAddress()
public void setAddress(String address)
address - Indicates the device address.public AudioDeviceDescriptor.DeviceType getType()
DeviceType.public void setType(AudioDeviceDescriptor.DeviceType type)
type - Indicates the device type defined by DeviceType.public AudioDeviceDescriptor.DeviceRole getRole()
DeviceRole.public void setRole(AudioDeviceDescriptor.DeviceRole role)
role - Indicates the device role defined by DeviceRole.public int[] getSamplingRates()
public void setSamplingRates(int[] samplingRates)
samplingRates - Indicates the sampling rates to set.public int[] getChannelMasks()
public void setChannelMasks(int[] channelMasks)
channelMasks - Indicates the channel masks to set.public int[] getChannelIndexMasks()
public void setChannelIndexMasks(int[] channelIndexMasks)
channelIndexMasks - Indicates the channel index masks to set.public List<AudioStreamInfo.EncodingFormat> getEncodings()
public void setEncodings(List<AudioStreamInfo.EncodingFormat> encodings)
encodings - Indicates the encoding formats to set.public int[] getChannelCounts()
For example, {1, 2, 4} indicates that the device supports single channel, dual channel, and quad channel. If the obtained array is empty, the device supports any channel types, including single channel, dual channel, quad channel, six channel, and eight channel.