AudioDevicePort.javaAPI DocAndroid 5.1 API3591Thu Mar 12 22:22:30 GMT


public class AudioDevicePort extends AudioPort
The AudioDevicePort is a specialized type of AudioPort describing an input (e.g microphone) or output device (e.g speaker) of the system. An AudioDevicePort is an AudioPort controlled by the audio HAL, almost always a physical device at the boundary of the audio system. In addition to base audio port attributes, the device descriptor contains: - the device type (e.g AudioManager.DEVICE_OUT_SPEAKER) - the device address (e.g MAC adddress for AD2P sink).

Fields Summary
private final int
private final String
Constructors Summary
AudioDevicePort(AudioHandle handle, int[] samplingRates, int[] channelMasks, int[] formats, AudioGain[] gains, int type, String address)

             (AudioManager.isInputDevice(type) == true)  ?
                        AudioPort.ROLE_SOURCE : AudioPort.ROLE_SINK,
             samplingRates, channelMasks, formats, gains);
        mType = type;
        mAddress = address;
Methods Summary
public java.lang.Stringaddress()
Get the device address. Address format varies with the device type. - USB devices ({@link AudioManager#DEVICE_OUT_USB_DEVICE}, {@link AudioManager#DEVICE_IN_USB_DEVICE}) use an address composed of the ALSA card number and device number: "card=2;device=1" - Bluetooth devices ({@link AudioManager#DEVICE_OUT_BLUETOOTH_SCO}, {@link AudioManager#DEVICE_OUT_BLUETOOTH_SCO}, {@link AudioManager#DEVICE_OUT_BLUETOOTH_A2DP}) use the MAC address of the bluetooth device in the form "00:11:22:AA:BB:CC" as reported by {@link BluetoothDevice#getAddress()}. - Deivces that do not have an address will indicate an empty string "".

        return mAddress;
public AudioDevicePortConfigbuildConfig(int samplingRate, int channelMask, int format, AudioGainConfig gain)
Build a specific configuration of this audio device port for use by methods like AudioManager.connectAudioPatch().

        return new AudioDevicePortConfig(this, samplingRate, channelMask, format, gain);
public booleanequals(java.lang.Object o)

        if (o == null || !(o instanceof AudioDevicePort)) {
            return false;
        return super.equals(o);
public java.lang.StringtoString()

        String type = (mRole == ROLE_SOURCE ?
                            AudioSystem.getInputDeviceName(mType) :
        return "{" + super.toString()
                + ", mType: " + type
                + ", mAddress: " + mAddress
                + "}";
public inttype()
Get the device type (e.g AudioManager.DEVICE_OUT_SPEAKER)

        return mType;