Linux Simultaneous audio output with ALSA (HDMI, Analog)
#1
Hello everybody,

in my setup i have a HTPC with XBMC 13.2 on a Ubuntu-Linux 14.04LTS Server. It is connected via HDMI to my TV. Sound is done by an old Yamaha AV-Receiver without HDMI, so it is connected directly to the TV via S/PDIF. The HTPC is always on, i just turn on/off the TV.

Iam using this setup for years now, but now i want to be able to play musik with XBMC without turning on the TV. On the hardware side this is very easy: The Yamaha receiver has a AUTO-Input detection with a fallback to analog, if no S/PDIF-Signal is detected. So, if my TV is turned off, it would be easily possible to play musik using the analog interface. So the idea was to make my HTPC to put out sound on HDMI as well as on analog output.

I found this guide to do this using ALSA. It basically works, at leas for playing music. But when i try to play a Movie with digital multichannel sound the playback is stuttering and makes XBMC crash very often. In the logs i found the message
Quote: ERROR: CDVDAudio::AddPacketsRenderer - timeout adding data to renderer
So there seams to be a issue with passthrough. Unlike the guide i didnt found a way to set a custom passthrough device in 13.2 (even in expert mode), so i tried to set in advancedsettings.xml without success.

Do you have any hints for me? My config is exactly as in the guide, except the HDMI output is on card 0 (and i do not need any module-parameters because of intel hardware).
Reply
#2
Ask the people in the guide. We have a reason why we don't support such hacks in our xbmc code.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#3
Ok. That's the kind of response that nobody wants to hear.

Let me concretize the question, maybe i can get a bit further:
  1. Is it possible to set a custom Passthrough device somehow? When i set audio-devices via advancedsettings.xml i do not find any information in Log or the menu about which interface is really used.
  2. Would pulseaudio do things better?
  3. If you have reasons to not help me doing it this way, whats your suggestion for me to solve my Problem? The solutions i found was:
    • Use another Audio-Player-Software on the analog output (really annoying because i would need different ways to play musik depending on the power-state of my TV)
    • Buy a new AV-Receiver with HDMI which is able to play sounds from HDMI even if TV is turned off. Also no good idea, as there is no other need to do so. Such devices don't grow on trees.
    • Connect the HTPC directly to AV-Receiver via S/PDIF. My HTPC has no S/PDIF, so i would need a extra audio card. But in the main, i would have problems with A/V-sync because of TV input lag.
    • Try to figure out powerstate of TV and change audio device accordingly. Sounds unstable and i have no idea how to change xbmc audio device via script.
    • Make the HTPC output 2-channel audio simultaneous on HDMI and analog output - the best solution if it would work correctly
Reply
#4
Quote:Try to figure out powerstate of TV and change audio device accordingly. Sounds unstable and i have no idea how to change xbmc audio device via script.

If you can do this changing xbmc's audio output via script is easy, eg I have a script that pings my networked avr - If I get a response, script changes xbmc audio settings to 'avr mode' (hd formats, 5.1 ch etc). No ping response and it changes to 'tv mode' (pcm, 2ch etc).
Reply
#5
Ok, maybe its a way... detect the TV powerstate is not easy. Does anyone have any documentation or info concerning xbmc audio settings scripting for me? Can it be done by JSON/REST?
Reply
#6
(2014-11-10, 09:26)LukasW Wrote: Is it possible to set a custom Passthrough device somehow? When i set audio-devices via advancedsettings.xml i do not find any information in Log or the menu about which interface is really used.

The option hasn't been there since Eden since it is no longer needed. You'll get the available devices as a list to choose from.

(2014-11-10, 09:26)LukasW Wrote: Would pulseaudio do things better?

https://wiki.archlinux.org/index.php/Pul...log_output

(2014-11-10, 09:26)LukasW Wrote: Buy a new AV-Receiver with HDMI which is able to play sounds from HDMI even if TV is turned off. Also no good idea, as there is no other need to do so. Such devices don't grow on trees.

If your AVR has HDMI then you connect your HTPC there, then the AVR is connected to the TV. No need to have the TV on just to get sound.

(2014-11-10, 09:26)LukasW Wrote: Connect the HTPC directly to AV-Receiver via S/PDIF. My HTPC has no S/PDIF, so i would need a extra audio card. But in the main, i would have problems with A/V-sync because of TV input lag.

Audio sync can be corrected using advancesettings.xml.

I suggest you try Pulseaudio. I don't know how well it works with passthrough and multi-channel audio in general though (I don't use it because it does stupid things I don't want it to do).
Reply
#7
http://forum.kodi.tv/showthread.php?tid=192480

I don't know if this will have the options you want.... I only use it for hdmi/analog.... but it works awesome...
Reply
#8
Thank you for your answers, looks like i have a real chance.

Detecting tv powerstate appears to be impossible for my tv without HDMI-CEC (and my pulse8-adapter doesnt work because of long cables), so it does not really help to have the possibility to set audio device through JSON/REST (which looks like it is no big problem).

Buy a new avr is no option atm and will lead to other problems in my setup.

The patch mentioned by methcat looks interesting. But first of all I will test pulseaudio solution, this would be my favourite if passthrough works. I'll get back when its tested!
Reply
#9
Ok, ive tested pulseaudio. In general the result is much more useable than last time i tested pa, passthrough works and configuration is more or less easy.
This does not apply to the bridge mode. In my Setup i do only have one soundcard, where i can select the output port. So HDMI is not on an extra card which could be used in parallel. With some configuration in /etc/pulse/default.pa i got it finally working on HDMI and analog out simultaneously, but unfortunately passthrough seams to be impossible for the bridge device. So back to start.
The patch solution could be working, but always built xbmc from sources? It doesnt look like such a feature will soon be part of main-tree (see comment of fritsch), so even if it would work its not a long term solution.

Iam a bit depressed on that. Is that really so hard to do?
Reply
#10
Yeah,the patch author has been great, but no promises. It's funny that the patch for the previous architecture wasn't thought feasible with the 13 audio engine, but what do you know, here it is. Can almost always be done, just requires a capable person who actually wants it...
Reply

Logout Mark Read Team Forum Stats Members Help
Simultaneous audio output with ALSA (HDMI, Analog)0