batocera-linux / batocera.linux

batocera.linux
https://batocera.org
Other
1.81k stars 463 forks source link

Only stereo audio over HDMI #11122

Open rs-gh-asdf opened 3 months ago

rs-gh-asdf commented 3 months ago

Batocera build version

38o 2023/10/14 21:43

Your architecture

x86_64, "Beelink SER5" mini pc

Your Graphic Processor Unit(s) (GPU)

Integrated AMD Ryzen 7 5700U

Issue description

Firstly, I understand that surround sound makes no sense in emulators. I notice this issue within Kodi, but I don't think that it is a Kodi problem. When I choose 5.1 audio in Kodi and play a 5.1 media, I only get sound to my front left and front right speakers.

Detailed reproduction steps

Details of any attempts to fix this yourself

My Batocera Linux machine has an HDMI port which I plug in to an amplifier/receiver that is capable of 5.1 surround sound. I have speakers wired to accommodate this. The amplifier sends the video signal on to a screen.

In the main EmulationStation menu, when I go to System Settings > Hardware > Audio Output, I have some options:

In this same menu under Audio Profile, I have only these options:

These profiles are the only ones available regardless of which Audio Output I select. To get sound to go to my speakers, I have to select the HDMI 2 output. I have no option in this menu to choose a surround sound profile like is shown in this screenshot.

When I go into Kodi, under Settings > System > Audio > Audio output device, I have these options:

HDMI (#)1 is notably missing from this list. I understand that Kodi starts at index 0 for HDMI outputs and EmulationStation starts at index 1 for HDMI outputs, so the output that I use for ES is not available in Kodi. I can, however, get audio to go to my speakers by selecting the PipeWire Sound Server device. I have set the "Number of channels" to 5.1. However, audio only comes out of my front left and front right speakers.

To investigate further, I logged into my Batocera machine over SSH and looked through the output of pw-cli info 45 where 45 is my audio output device. I believe that the output indicates only 2 channels available:

        id: 45
        permissions: rwxm-
        type: PipeWire:Interface:Node/3
*       input ports: 2/65
*       output ports: 2/0
*       state: "running"
*       properties:
*               alsa.card = "0"
*               alsa.card_name = "HD-Audio Generic"
*               alsa.class = "generic"
*               alsa.device = "7"
*               alsa.driver_name = "snd_hda_intel"
*               alsa.id = "HDMI 1"
*               alsa.long_card_name = "HD-Audio Generic at 0xfccc8000 irq 80"
*               alsa.mixer_device = "_ucm0001.hw:Generic"
*               alsa.name = "NS-40D510NA21"
*               alsa.resolution_bits = "16"
*               alsa.subclass = "generic-mix"
*               alsa.subdevice = "0"
*               alsa.subdevice_name = "subdevice #0"
*               api.alsa.card.longname = "HD-Audio Generic at 0xfccc8000 irq 80"
*               api.alsa.card.name = "HD-Audio Generic"
*               api.alsa.open.ucm = "true"
*               api.alsa.path = "hw:Generic,7"
*               api.alsa.pcm.card = "0"
*               api.alsa.pcm.stream = "playback"
*               audio.channels = "2"
*               audio.position = "FL,FR"
*               card.profile.device = "2"
*               device.api = "alsa"
*               device.class = "sound"
*               device.id = "36"
*               device.profile.description = "HDMI / DisplayPort 2 Output"
*               device.profile.name = "HiFi: hw:Generic,7: sink"
*               device.routes = "1"
*               factory.name = "api.alsa.pcm.sink"
*               media.class = "Audio/Sink"
*               node.description = "Renoir Radeon High Definition Audio Controller HDMI / DisplayPort 2 Output"
*               node.name = "alsa_output.pci-0000_04_00.1.HiFi__hw_Generic_7__sink"
*               node.nick = "NS-40D510NA21"
*               node.pause-on-idle = "false"
*               object.path = "alsa:pcm:0:hw:Generic,7:playback"
*               priority.driver = "632"
*               priority.session = "632"
*               factory.id = "18"
*               clock.quantum-limit = "8192"
*               client.id = "34"
*               node.driver = "true"
*               factory.mode = "merge"
*               audio.adapt.follower = ""
*               library.name = "audioconvert/libspa-audioconvert"
*               object.id = "45"
*               object.serial = "46"
*               node.max-latency = "16384/48000"
*               api.alsa.period-size = "1024"
*               api.alsa.period-num = "32"
*               api.alsa.headroom = "0"
*       params: (9)
*         3 (Spa:Enum:ParamId:EnumFormat) r-
*         1 (Spa:Enum:ParamId:PropInfo) r-
*         2 (Spa:Enum:ParamId:Props) rw
*         4 (Spa:Enum:ParamId:Format) rw
*         10 (Spa:Enum:ParamId:EnumPortConfig) r-
*         11 (Spa:Enum:ParamId:PortConfig) rw
*         15 (Spa:Enum:ParamId:Latency) rw
*         16 (Spa:Enum:ParamId:ProcessLatency) rw
*         17 (Spa:Enum:ParamId:Tag) rw

At first I assumed that I had some hardware limitation on the HDMI port in this mini pc. I do know that when I use a USB-C hub to plug my laptop in via HDMI to this same exact cable, I am able to address all channels individually and select Digital Surround 5.1 as my Profile for the device in pavucontrol. My laptop is using Pipewire as well so pavucontrol is just the frontend that I use to manipulate it. I plugged this same exact USB-C hub into my Batocera machine and ran the HDMI cable into that. However, the above behavior of only having 2.0 channels available was still present even on this HDMI port that I know is capable of 5.1. The only difference is that it changed from (#)2 to (#)1 in the ES menu and the pipewire id changed from 45 to 46. Other than that, the exact same behavior was present.

To test further, I booted a live Xubuntu 22.04 ISO on the machine that has Batocera installed. In this live image, I only had the audio output option for "Play Hifi Quality Music". Ubuntu moved to PipeWire in 22.10, so I booted Xubuntu 23.04. Here, on PipeWire again, I had the same two options for audio Profile in pavucontrol that I had in the ES menu on Batocera. I don't know where the list of available audio profiles comes from, but the same USB hub with an HDMI port shows more available profiles on my laptop.

I am a bit lost here because Linux audio has always seemed mysterious to me.

Details of any modifications you have made to Batocera.

I have installed a few flatpaks

Logs and data

No response

dmanlfc commented 3 months ago

https://github.com/batocera-linux/batocera.linux/issues/7335