if ((devices2.isEmpty()) && (strategy != STRATEGY_SONIFICATION)) { // no sonification on aux digital (e.g. HDMI) devices2 = availableOutputDevices.getDevicesFromType(AUDIO_DEVICE_OUT_AUX_DIGITAL); } //priority Wired > a2dp > hdmi > hdmi 1 > spdif > spdif 1 if ((devices2.isEmpty()) && (strategy != STRATEGY_SONIFICATION)) { devices2 = availableOutputDevices.getDevicesFromType(AUDIO_DEVICE_OUT_HDMI_1); } if ((devices2.isEmpty()) && (strategy != STRATEGY_SONIFICATION)) { devices2 = availableOutputDevices.getDevicesFromType(AUDIO_DEVICE_OUT_SPDIF); } if ((devices2.isEmpty()) && (strategy != STRATEGY_SONIFICATION)) { devices2 = availableOutputDevices.getDevicesFromType(AUDIO_DEVICE_OUT_SPDIF_1); } if ((devices2.isEmpty()) && (getForceUse(AUDIO_POLICY_FORCE_FOR_DOCK) == AUDIO_POLICY_FORCE_ANALOG_DOCK)) { devices2 = availableOutputDevices.getDevicesFromType( AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET); } if (devices2.isEmpty()) { devices2 = availableOutputDevices.getDevicesFromType(AUDIO_DEVICE_OUT_SPEAKER); }
时间: 2024-04-26 17:24:51 浏览: 77
audio system
这段代码是关于Android平台上的音频输出设备选择的代码。首先判断是否有可用的输出设备,并且当前的策略不是声音提示(sonification)。如果没有可用设备,则按照优先级选择不同类型的设备,包括有线耳机、蓝牙A2DP、HDMI、SPDIF、模拟音频接口等。如果强制使用音频扬声器的话,则使用音频扬声器作为输出设备。
阅读全文