|
|
本帖最后由 窄口牛 于 2024-8-31 19:17 编辑
How to fix HDMI audio in Android-x86 if it doesn’t work out of the box
如何修复HDMI音频在Android-x86如果它不工作的开箱即用
hernaaan海尔纳安 General一般 08/02/2018 2 minutos2分钟
Okay. I’m writing this mini tutorial after several hours of reading and trying different things. I hope it works for you too.
好吧我写这个迷你教程后,几个小时的阅读和尝试不同的东西。我希望它也能为你工作。
Let’s say you have a laptop and boot Android-x86 from there. Maybe from HDD or maybe from USB, I think it doesn’t matter. And you connect your TV to it. You modify Grub to set HDMI-only output (‘video=LVDS-1:d’ did for me), and you get video.
假设你有一台笔记本电脑,从那里靴子Android-x86。也许从HDD或USB,我认为这并不重要。你把电视连接到它上,修改Grub设置为只输出HDMI(我是这样做的),然后你就可以看到视频了。
If you then notice you have no sound at all, try this. Oh, and beforehand, have a short WAV file stored in the system.
如果你注意到你没有声音,试试这个。哦,在此之前,在系统中存储一个简短的WAV文件。
1) Open a terminal (from Android menu) and ask for root access with ‘su’.
1)打开一个终端(从Android菜单),并要求根访问与'苏'.
2) Check what number your HDMI card is:
# cat /proc/asound/cards
2)检查您的HDMI卡的编号:
Generally, «0» is onboard audio and «1» is HDMI.
通常,«0»是板载音频,«1»是HDMI。
3) Check which devices are associated to your HDMI card:
# ls -l /dev/snd/
3)检查哪些设备与HDMI卡关联:
Here you have you take note of all the pcmC*D*p values, where C* is the number of the card from step 2.
在这里,您需要注意所有pcmC*D*p值,其中C* 是第2步中的卡号。
4) Activate sound for the card with the following commands:
# alsa_amixer -c1 set 'IEC958',0 on
# alsa_amixer -c1 set 'IEC958',1 on
# alsa_amixer -c1 set 'IEC958',2 on
# alsa_amixer -c1 set 'IEC958',3 on
4)使用以下命令激活卡的声音:
In this example, I’m using card «1» (check step 2 for yours).
在这个例子中,我使用卡«1»(检查步骤2为您的)。
5) Then, testing. To check which is the correct device you’ll need the WAV file mentioned before:
# alsa_aplay -Dplughw:1,3 /storage/path_to_file/sample.wav
# alsa_aplay -Dplughw:1,7 /storage/path_to_file/sample.wav
# alsa_aplay -Dplughw:1,8 /storage/path_to_file/sample.wav
# alsa_aplay -Dplughw:1,9 /storage/path_to_file/sample.wav
5)然后是测试。要检查哪个是正确的设备,您需要前面提到的WAV文件:
In this example, I checked devices «3», «7», «8» and «9» from card «1» (check step 2 for your card, and step 3 for its devices). You’ll hear sound in the right one.
在本例中,我检查了卡«1»中的设备«3»、«7»、«8»和«9»(检查您的卡的步骤2,检查其设备的步骤3)。你会听到右边的声音。
6) When you get the correct device, proceed to edit the boot script to make the changes permanent:
# vi /system/etc/init.sh
6)获得正确的设备后,继续编辑靴子脚本,以使更改永久化:
Add these lines in the «function init_hal_audio()» section, right below «esac»:
alsa_amixer -c1 set 'IEC958',0 on
alsa_amixer -c1 set 'IEC958',1 on
alsa_amixer -c1 set 'IEC958',2 on
alsa_amixer -c1 set 'IEC958',3 on
mv /dev/snd/pcmC1D3p /dev/snd/pcmC1D3p.original
ln -sf /dev/snd/pcmC1D7p /dev/snd/pcmC1D3p
在«function init_hal_audio()»部分中添加以下行,就在«esac»下面:
Where:
«c1» is your HDMI card (step 2),
«pcmC1D7p» is your audible device (step 5),
and «pcmC1D3p» is the FIRST one of the card (as seen in step 3).
其中:«c1»是您的HDMI卡(步骤2),
«pcmC1D7p»是您的音频设备(第5步),
而«pcmC1D3p»是卡的第一个(如步骤3所示)。
This will allow you to keep the onboard sound if you choose to boot without HDMI video.
这将允许您保持板载的声音,如果您选择靴子没有HDMI视频。
7) Reboot to check if you did everything okay.
7)重新启动以检查您是否一切正常。
于是我就这么解决了
rm -rf /dev/snd/controlC0
rm -rf /dev/snd/hwC0D*
alsa_amixer -c1 set 'IEC958',0 on
alsa_amixer -c1 set 'IEC958',1 on
mv /dev/snd/pcmC1D3p /dev/snd/pcmC1D3p.original
ln -sf /dev/snd/pcmC1D7p /dev/snd/pcmC1D3p
不过英伟达独显不提供驱动,所以大部分都运行不好。按摩店貌似还行?
|
|