**
【1.音频输出设备】
**
android/frameworks/base/media/java/android/media/AudioSystem.java
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; //单声道蓝牙耳机 蓝牙 SCO,用于语音通话,十进制32
public static final int DEVICE_OUT_BLUETOOTH_SCO_HEADSET = 0x20;//蓝牙SCO耳机,十进制64
public static final int DEVICE_OUT_BLUETOOTH_SCO_CARKIT = 0x40;//蓝牙SCO车载
public static final int DEVICE_OUT_BLUETOOTH_A2DP = 0x80; //蓝牙高保真设备,用于听音乐, 十进制128
public static final int DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES = 0x100;//蓝牙高保真耳机,十进制256
public static final int DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER = 0x200; //蓝牙高保真扬声器 ,十进制512
public static final int DEVICE_OUT_AUX_DIGITAL = 0x400; //辅助数字输出AUX,不推荐,建议使用DEVICE_OUT_HDMI代替,十进制1024
public static final int DEVICE_OUT_HDMI = DEVICE_OUT_AUX_DIGITAL; //辅助数字输出HDMI,十进制1024
public static final int DEVICE_OUT_ANLG_DOCK_HEADSET = 0x800; //通过基座连接的模拟有线耳机,十进制2048
public static final int DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000; //通过基座连接的数字有线耳机,十进制4096
public static final int DEVICE_OUT_USB_ACCESSORY = 0x2000; //USB音频附件的音频输出,附件处于USB主机模式,而Android设备处于USB设备模式
public static final int DEVICE_OUT_USB_DEVICE = 0x4000; //USB音频设备的音频输出。 设备处于USB设备模式,而Android设备处于USB主机模式
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_OUT_HEARING_AID = 0x8000000;
public static final int DEVICE_OUT_DEFAULT = DEVICE_BIT_DEFAULT;
【2.音频流类型】
android/frameworks/base/media/java/android/media/AudioSystem.java
音频流 默认值 说明
STREAM_DEFAULT
-1 Used to identify the default audio stream volume
STREAM_VOICE_CALL 0 通话流 Used to identify the volume of audio streams for phone calls
STREAM_SYSTEM 1 系统声音流 Used to identify the volume of audio streams for system sounds
STREAM_RING
2 铃声流 Used to identify the volume of audio streams for the phone ring and message alerts
STREAM_MUSIC 3 音乐流 Used to identify the volume of audio streams for music playback
STREAM_ALARM
4 闹钟流 Used to identify the volume of audio streams for alarms
STREAM_NOTIFICATION
5 通知流 Used to identify the volume of audio streams for notifications
STREAM_BLUETOOTH_SCO 6 蓝牙通话流 Used to identify the volume of audio streams for phone calls when connected on bluetooth
STREAM_SYSTEM_ENFORCED
7 Used to identify the volume of audio streams for enforced system sounds in certain countries (e.g camera in Japan)
STREAM_DTMF
8 Used to identify the volume of audio streams for DTMF tones键盘拨号音
STREAM_TTS
9 (TTS: Text to Speech:文件到语言的音频流,即机器说话)Used to identify the volume of audio streams exclusively transmitted through the speaker (TTS) of the device
STREAM_ACCESSIBILITY 10 标识辅助功能提示音流Used to identify the volume of audio streams for accessibility prompts