声卡0怎么配置才能跟HDMI同时输出一样的声音,下面是具体描述:
1、硬件连接
声卡0的连接是芯片的ADC音频输出脚直接接到DA芯片输出
2、cat /proc/asound/cards
0 [rockchiprk3229 ]: rockchip_rk3229 - rockchip,rk3229
rockchip,rk3229
1 [rockchiphdmi ]: rockchip_hdmi - rockchip,hdmi
rockchip,hdmi
2 [ROCKCHIPSPDIF ]: ROCKCHIP_SPDIF - ROCKCHIP,SPDIF
ROCKCHIP,SPDIF
3、具体修改
frameworks/base$ git diff ./
diff --git a/services/core/java/com/androidrver/WiredAccessoryManager.java b/services/core/java/com/androidrver/WiredAccessoryManager.java
index bf6299cffdb3..67d9f972a07a 100644
--- a/services/core/java/com/androidrver/WiredAccessoryManager.java
+++ b/services/core/java/com/androidrver/WiredAccessoryManager.java
@@ -55,7 +55,7 @@ import java.util.Locale;*/final class WiredAccessoryManager implements WiredAccessoryCallbacks {private static final String TAG = WiredAccessoryManager.class.getSimpleName();
- private static final boolean LOG = false;
+ private static final boolean LOG = true;private static final int BIT_HEADSET = (1 << 0);private static final int BIT_HEADSET_NO_MIC = (1 << 1);
@@ -408,6 +408,7 @@ final class WiredAccessoryManager implements WiredAccessoryCallbacks {//// If the kernel does not have an "hdmi_audio" switch, just fall back on the older// "hdmi" switch instead.
+/*uei = new UEventInfo(NAME_HDMI_AUDIO, BIT_HDMI_AUDIO, 0, 0);if (uei.checkSwitchExists()) {retVal.add(uei);
@@ -420,6 +421,7 @@ final class WiredAccessoryManager implements WiredAccessoryCallbacks {}}+ */return retVal;}@@ -530,7 +532,7 @@ final class WiredAccessoryManager implements WiredAccessoryCallbacks {// new state will be like STATE=MICROPHONE=1\nHEADPHONE=0updateBit(maskAndState, BIT_HEADSET_NO_MIC, status, "HEADPHONE") ;updateBit(maskAndState, BIT_HEADSET, status,"MICROPHONE") ;
- updateBit(maskAndState, BIT_HDMI_AUDIO, status,"HDMI") ;
+ // updateBit(maskAndState, BIT_HDMI_AUDIO, status,"HDMI") ;updateBit(maskAndState, BIT_DP_AUDIO, status,"DP");updateBit(maskAndState, BIT_LINEOUT, status,"LINE-OUT") ;if (LOG) Slog.v(TAG, "mask " + maskAndState[0] + " state " + maskAndState[1]);tinyalsa_hal$ vim audio_hw.c
lxt@ubuntu101:~/audio/tinyalsa_hal$ git diff ./
diff --git a/tinyalsa_hal/audio_hw.c b/tinyalsa_hal/audio_hw.c
index fb1471e..dfec724 100755
--- a/tinyalsa_hal/audio_hw.c
+++ b/tinyalsa_hal/audio_hw.c
@@ -994,7 +994,7 @@ static int start_output_stream(struct stream_out *out)out->device &= ~(AUDIO_DEVICE_OUT_AUX_DIGITAL | AUDIO_DEVICE_OUT_SPDIF);#endif- if (out->device & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
+ //if (out->device & AUDIO_DEVICE_OUT_AUX_DIGITAL) {audio_devices_t route_device = out->device & AUDIO_DEVICE_OUT_AUX_DIGITAL;route_pcm_card_open(adev->dev_out[SND_OUT_SOUND_CARD_HDMI].card, getRouteFromDevice(route_device));@@ -1037,7 +1037,7 @@ static int start_output_stream(struct stream_out *out)ALOGD("The current HDMI is DVI mode");out->device |= AUDIO_DEVICE_OUT_SPEAKER;}
- }
+ //}if (out->device & (AUDIO_DEVICE_OUT_SPEAKER |AUDIO_DEVICE_OUT_WIRED_HEADSET |