Closed Vegz78 closed 2 years ago
To reiterate on this point and for my own memory:
MakeCode Arcade games are hardcoded to choose ALSA device hw:0,0, irrespectively of other audio settings on higher tiers, in Recalbox/RetroPie menus, different emulators, Pulseaudio etc.
hw:0,0 means the first audio card's first audio subdevice, if I am not mistaken.
Following the kernel versions >= 5 on Raspberry Pis using the vc4-kms-v3d graphics driver(e.g. Recalbox versions <= 8), this driver implements its own HDMI audio card device separated from the bcm2835 card, which now contains only the jack audio output subdevices, instead of both as in earlier kernel versions.
The audio setup for each system can be found by issuing commands like:
aplay -l
cat /proc/asound/cards
cat /proc/asound/devices
cat /proc/asound/modules
, andcat /proc/asound/pcm
etc.From the lack of full oversight on how this is set up on all various systems, including different upgrade paths, I've identified two functioning workarounds:
mount -o remount,rw /boot
nano /boot/config.txt
(Normally requires sudo
on systems other than Recalbox)dtoverlay=vc4-kms-v3d
to dtoverlay=vc4-kms-v3d,noaudio
(under section header [pi4] on Recalbox, usually in main section otherwise)dtparam=audio=on
in the main section or relevant section for Recalbox
With the advent of newer Linux kernels on the Raspberry Pi, specifically for the newest Recalbox version 8.0 on newer Linux kernels above version 5 and with the vc4-kms-v3d graphics driver, the HDMI audio is now delivered through a new separate vc4 device/module instead of the regular bcm2835, like before.
On some distros, like Recalbox v 8.0, the vc4 HDMI audio device is then not located on the alsa default hw:0,0 first audio device, which MakeCode Arcade(MCA) games requires for audio playback.
This means that MCA games plays back audio perfectly fine on JACK/analog output, but is also stuck to analog, without this workaround.
I have only tested on Recalbox v 8.0, and I am not sure if this applies as well to the regular Raspberry Pi OS and RetroPie distros on Linux kernel versions 5 and above. But it is likely that the same is true there in combination with the new vc4-kms-v3d driver, and possibly it will have a similar solution/workaround to the one described here.
It should also be possible to circumvent this problem by disabling the vc4-kms-v3d driver, or using the old fake vc4-fkms-v3d(maxframbuffers=2?) driver, but this is not desirable if you want the newest support for hardware accelerated graphics.
SOLUTION: The workaround that was tested ok for MCA HDMI sound on Recalbox v8.0 is based on the earlier fix for USB sound by @QuadDam / @Dace: McAirpos/issues/11 https://forum.makecode.com/t/just-finished-another-cabinet-for-school/5658/28 https://sudomod.com/forum/viewtopic.php?f=20&t=144
In addition, I found some required and working changes to the vc4-hdmi.conf by @dom at the Raspberry Pi forum: https://forums.raspberrypi.com/viewtopic.php?f=29&t=269769&p=1636828#p1636828
Steps: (NB!: REMEMBER TO BACK UP THE ORIGINAL FILES FIRST!)