分为 c++ 层 跟 java 层 java 层 在 frameworks/base/media/java/android/media/AudioSystem.java 里面
public static final int DEVICE_NONE = 0x0;
public static final int DEVICE_BIT_IN = 0x80000000;
public static final int DEVICE_BIT_DEFAULT = 0x40000000;
public static final int DEVICE_OUT_EARPIECE = 0x1;
public static final int DEVICE_OUT_SPEAKER = 0x2;
public static final int DEVICE_OUT_WIRED_HEADSET = 0x4;
public static final int DEVICE_OUT_WIRED_HEADPHONE = 0x8;
public static final int DEVICE_OUT_BLUETOOTH_SCO = 0x10;
public static final int DEVICE_OUT_BLUETOOTH_SCO_HEADSET = 0x20;
public static final int DEVICE_OUT_BLUETOOTH_SCO_CARKIT = 0x40;
public static final int DEVICE_OUT_BLUETOOTH_A2DP = 0x80;
public static final int DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES = 0x100;
public static final int DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER = 0x200;
public static final int DEVICE_OUT_AUX_DIGITAL = 0x400;
public static final int DEVICE_OUT_HDMI = DEVICE_OUT_AUX_DIGITAL;
public static final int DEVICE_OUT_ANLG_DOCK_HEADSET = 0x800;
public static final int DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000;
public static final int DEVICE_OUT_USB_ACCESSORY = 0x2000;
public static final int DEVICE_OUT_USB_DEVICE = 0x4000;
public static final int DEVICE_OUT_REMOTE_SUBMIX = 0x8000;
public static final int DEVICE_OUT_TELEPHONY_TX = 0x10000;
public static final int DEVICE_OUT_LINE = 0x20000;
public static final int DEVICE_OUT_HDMI_ARC = 0x40000;
public static final int DEVICE_OUT_SPDIF = 0x80000;
public static final int DEVICE_OUT_FM = 0x100000;
public static final int DEVICE_OUT_AUX_LINE = 0x200000;
public static final int DEVICE_OUT_SPEAKER_SAFE = 0x400000;
public static final int DEVICE_OUT_IP = 0x800000;
public static final int DEVICE_OUT_BUS = 0x1000000;
public static final int DEVICE_OUT_PROXY = 0x2000000;
public static final int DEVICE_OUT_USB_HEADSET = 0x4000000;
public static final int DEVICE_IN_COMMUNICATION = DEVICE_BIT_IN | 0x1;
public static final int DEVICE_IN_AMBIENT = DEVICE_BIT_IN | 0x2;
public static final int DEVICE_IN_BUILTIN_MIC = DEVICE_BIT_IN | 0x4;
public static final int DEVICE_IN_BLUETOOTH_SCO_HEADSET = DEVICE_BIT_IN | 0x8;
public static final int DEVICE_IN_WIRED_HEADSET = DEVICE_BIT_IN | 0x10;
public static final int DEVICE_IN_AUX_DIGITAL = DEVICE_BIT_IN | 0x20;
public static final int DEVICE_IN_HDMI = DEVICE_IN_AUX_DIGITAL;
public static final int DEVICE_IN_VOICE_CALL = DEVICE_BIT_IN | 0x40;
public static final int DEVICE_IN_TELEPHONY_RX = DEVICE_IN_VOICE_CALL;
public static final int DEVICE_IN_BACK_MIC = DEVICE_BIT_IN | 0x80;
public static final int DEVICE_IN_REMOTE_SUBMIX = DEVICE_BIT_IN | 0x100;
public static final int DEVICE_IN_ANLG_DOCK_HEADSET = DEVICE_BIT_IN | 0x200;
public static final int DEVICE_IN_DGTL_DOCK_HEADSET = DEVICE_BIT_IN | 0x400;
public static final int DEVICE_IN_USB_ACCESSORY = DEVICE_BIT_IN | 0x800;
public static final int DEVICE_IN_USB_DEVICE = DEVICE_BIT_IN | 0x1000;
public static final int DEVICE_IN_FM_TUNER = DEVICE_BIT_IN | 0x2000;
public static final int DEVICE_IN_TV_TUNER = DEVICE_BIT_IN | 0x4000;
public static final int DEVICE_IN_LINE = DEVICE_BIT_IN | 0x8000;
public static final int DEVICE_IN_SPDIF = DEVICE_BIT_IN | 0x10000;
public static final int DEVICE_IN_BLUETOOTH_A2DP = DEVICE_BIT_IN | 0x20000;
public static final int DEVICE_IN_LOOPBACK = DEVICE_BIT_IN | 0x40000;
public static final int DEVICE_IN_IP = DEVICE_BIT_IN | 0x80000;
public static final int DEVICE_IN_BUS = DEVICE_BIT_IN | 0x100000;
public static final int DEVICE_IN_PROXY = DEVICE_BIT_IN | 0x1000000;
public static final int DEVICE_IN_USB_HEADSET = DEVICE_BIT_IN | 0x2000000;
public static final int DEVICE_IN_DEFAULT = DEVICE_BIT_IN | DEVICE_BIT_DEFAULT;
c++ 层 system/media/audio/include/system/audio-base.h
enum {
AUDIO_DEVICE_NONE = 0u,
AUDIO_DEVICE_BIT_IN = 2147483648u,
AUDIO_DEVICE_BIT_DEFAULT = 1073741824u,
AUDIO_DEVICE_OUT_EARPIECE = 1u,
AUDIO_DEVICE_OUT_SPEAKER = 2u,
AUDIO_DEVICE_OUT_WIRED_HEADSET = 4u,
AUDIO_DEVICE_OUT_WIRED_HEADPHONE = 8u,
AUDIO_DEVICE_OUT_BLUETOOTH_SCO = 16u,
AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET = 32u,
AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT = 64u,
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP = 128u,
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES = 256u,
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER = 512u,
AUDIO_DEVICE_OUT_AUX_DIGITAL = 1024u,
AUDIO_DEVICE_OUT_HDMI = 1024u,
AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET = 2048u,
AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET = 4096u,
AUDIO_DEVICE_OUT_USB_ACCESSORY = 8192u,
AUDIO_DEVICE_OUT_USB_DEVICE = 16384u,
AUDIO_DEVICE_OUT_REMOTE_SUBMIX = 32768u,
AUDIO_DEVICE_OUT_TELEPHONY_TX = 65536u,
AUDIO_DEVICE_OUT_LINE = 131072u,
AUDIO_DEVICE_OUT_HDMI_ARC = 262144u,
AUDIO_DEVICE_OUT_SPDIF = 524288u,
AUDIO_DEVICE_OUT_FM = 1048576u,
AUDIO_DEVICE_OUT_AUX_LINE = 2097152u,
AUDIO_DEVICE_OUT_SPEAKER_SAFE = 4194304u,
AUDIO_DEVICE_OUT_IP = 8388608u,
AUDIO_DEVICE_OUT_BUS = 16777216u,
AUDIO_DEVICE_OUT_PROXY = 33554432u,
AUDIO_DEVICE_OUT_USB_HEADSET = 67108864u,
AUDIO_DEVICE_OUT_DEFAULT = 1073741824u,
AUDIO_DEVICE_OUT_ALL = 1207959551u,
AUDIO_DEVICE_OUT_ALL_A2DP = 896u,
AUDIO_DEVICE_OUT_ALL_SCO = 112u,
AUDIO_DEVICE_OUT_ALL_USB = 67133440u,
AUDIO_DEVICE_IN_COMMUNICATION = 2147483649u,
AUDIO_DEVICE_IN_AMBIENT = 2147483650u,
AUDIO_DEVICE_IN_BUILTIN_MIC = 2147483652u,
AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET = 2147483656u,
AUDIO_DEVICE_IN_WIRED_HEADSET = 2147483664u,
AUDIO_DEVICE_IN_AUX_DIGITAL = 2147483680u,
AUDIO_DEVICE_IN_HDMI = 2147483680u,
AUDIO_DEVICE_IN_VOICE_CALL = 2147483712u,
AUDIO_DEVICE_IN_TELEPHONY_RX = 2147483712u,
AUDIO_DEVICE_IN_BACK_MIC = 2147483776u,
AUDIO_DEVICE_IN_REMOTE_SUBMIX = 2147483904u,
AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET = 2147484160u,
AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET = 2147484672u,
AUDIO_DEVICE_IN_USB_ACCESSORY = 2147485696u,
AUDIO_DEVICE_IN_USB_DEVICE = 2147487744u,
AUDIO_DEVICE_IN_FM_TUNER = 2147491840u,
AUDIO_DEVICE_IN_TV_TUNER = 2147500032u,
AUDIO_DEVICE_IN_LINE = 2147516416u,
AUDIO_DEVICE_IN_SPDIF = 2147549184u,
AUDIO_DEVICE_IN_BLUETOOTH_A2DP = 2147614720u,
AUDIO_DEVICE_IN_LOOPBACK = 2147745792u,
AUDIO_DEVICE_IN_IP = 2148007936u,
AUDIO_DEVICE_IN_BUS = 2148532224u,
AUDIO_DEVICE_IN_PROXY = 2164260864u,
AUDIO_DEVICE_IN_USB_HEADSET = 2181038080u,
AUDIO_DEVICE_IN_DEFAULT = 3221225472u,
AUDIO_DEVICE_IN_ALL = 3273654271u,
AUDIO_DEVICE_IN_ALL_SCO = 2147483656u,
AUDIO_DEVICE_IN_ALL_USB = 2181044224u,
};
|