Multi Sound Output for different applications

This is quite messy so I will try to explain it as well as I can.

I have setup osmc on a RPI3b+, I have connected to it a pcm5012 dac via the gpio.
I want to be able to use Steam Link(installed as a script with an addon integration), Retropie (installed using the retrosmc), Osmc and Squeezelite all on the one pi, obviously not at once. I was the sound for everything to go out the pi except for the squeezelite which I want to use the dac since I have speakers which get turned on when music is playing.

I initially got it kind of working following a tutorial on instructables but it was a bit messy and alsa was moaning about being busy in retropie. I instead realised I could actually use osmc to configure the dac as hifi-berry-overlay which worked for a short while.

The issue now is that Steam Link and Retropie do not seem to be able to output any sound however squeezelite is using the dac perfectly fine and osmc I can watch things using the hdmi and the tv speakers.

Any idea how I can force those 2 to use hdmi as sound output?
Thanks for any help

Hi

Unfortunately only one program can occupy the ALSA sink at a single time. At least – without some complex reconfiguration that isn’t ideal.

Well I installed alsamixer-utils since it wasn’t by default so the only device showing up in ALSA is the DAC that I’m using. So the HDMI and AUX connections don’t show up in it so OSMC sound works fine using HDMI while squeezelite uses the DAC at the same time.
What’s annoying me is that SteamLink and Retropie initially used the hdmi as their sound output but now they aren’t using anything or if they are they’re trying to use the dac which obviously they can’t.
So do you have any idea how I can make them use the HDMI like OSMC?

Assuming you mean alsa-utils which includes alsamixer. What do you mean by ‘showing up in ALSA’? Please post the output of aplay -l and aplay -L.

Sorry if I’m missing something but why obviously?

Is there a config file for Steamlink by which you can specify the audio sink? @hissingshark may have some ideas about Retropie.

Yes sorry I meant I installed alsa-utils

aplay -l

Blockquote **** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 [HifiBerry DAC HiFi pcm5102a-hifi-0]
Subdevices: 0/1

and aplay -L

Blockquote null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=sndrpihifiberry
snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
Default Audio Device
sysdefault:CARD=sndrpihifiberry
snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
Default Audio Device
dmix:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
Direct sample mixing device
dsnoop:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
Direct sample snooping device
hw:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
Direct hardware device without any conversions
plughw:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
Hardware device with all software conversions

I meant obviously as in squeezelite “hogs” the alsa and doesn’t allow any other program to use it for their own output. Sorry that was not very clear

In regards to the steamlink I’m not too sure, config file doesn’t seem to have anything pointing to sound nor does the bash. I’m using the script from this Osmc thread to set it up SteamLink

I’m absolutely no expert with regard to audio. But EmulationStation has audio options, so you could try and select HDMI from there. However I’m not sure if that will do any more than give you GUI sounds there, rather than affect the launched emulators. They should all be using the default ALSA device - which in your case is the DAC. Not sure why you aren’t seeing the usual:

hw:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct hardware device without any conversions
hw:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct hardware device without any conversions
hw:CARD=ALSA,DEV=2
    bcm2835 ALSA, bcm2835 IEC958/HDMI1
    Direct hardware device without any conversions

Presumably you have done something with an asound.conf or something to hide them, either during your “tutorial on instructables” or when you “configure the dac as hifi-berry-overlay which worked for a short while”.
When you say it worked, does that include RetroPie? And what if anything triggered the change?

Okay I have scratched the entire thing, installed steam link, sound comes out tv, install retropie sound still comes out speaker.
Install squeezelite and it’s sound comes out of the tv, enable hifiberry-dac-overlay in the osmc settings and steam and retropie don’t work but osmc still manages to use the hdmi.
Steam and Retro complain about alsa being busy so it’s definitely squeezelite and the dac

here is squeezelite -l before enabling the dac:
Output devices: null - Discard all samples (playback) or generate zero samples (capture) default:CARD=ALSA - bcm2835 ALSA, bcm2835 ALSA - Default Audio Device sysdefault:CARD=ALSA - bcm2835 ALSA, bcm2835 ALSA - Default Audio Device dmix:CARD=ALSA,DEV=0 - bcm2835 ALSA, bcm2835 ALSA - Direct sample mixing device dmix:CARD=ALSA,DEV=1 - bcm2835 ALSA, bcm2835 IEC958/HDMI - Direct sample mixing device dmix:CARD=ALSA,DEV=2 - bcm2835 ALSA, bcm2835 IEC958/HDMI1 - Direct sample mixing device dsnoop:CARD=ALSA,DEV=0 - bcm2835 ALSA, bcm2835 ALSA - Direct sample snooping device dsnoop:CARD=ALSA,DEV=1 - bcm2835 ALSA, bcm2835 IEC958/HDMI - Direct sample snooping device dsnoop:CARD=ALSA,DEV=2 - bcm2835 ALSA, bcm2835 IEC958/HDMI1 - Direct sample snooping device hw:CARD=ALSA,DEV=0 - bcm2835 ALSA, bcm2835 ALSA - Direct hardware device without any conversions hw:CARD=ALSA,DEV=1 - bcm2835 ALSA, bcm2835 IEC958/HDMI - Direct hardware device without any conversions hw:CARD=ALSA,DEV=2 - bcm2835 ALSA, bcm2835 IEC958/HDMI1 - Direct hardware device without any conversions plughw:CARD=ALSA,DEV=0 - bcm2835 ALSA, bcm2835 ALSA - Hardware device with all software conversions plughw:CARD=ALSA,DEV=1 - bcm2835 ALSA, bcm2835 IEC958/HDMI - Hardware device with all software conversions plughw:CARD=ALSA,DEV=2 - bcm2835 ALSA, bcm2835 IEC958/HDMI1 - Hardware device with all software conversions

and squeezelite -l after enabling the dac:
Output devices: null - Discard all samples (playback) or generate zero samples (capture) default:CARD=sndrpihifiberry - snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0 - Default Audio Device sysdefault:CARD=sndrpihifiberry - snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0 - Default Audio Device dmix:CARD=sndrpihifiberry,DEV=0 - snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0 - Direct sample mixing device dsnoop:CARD=sndrpihifiberry,DEV=0 - snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0 - Direct sample snooping device hw:CARD=sndrpihifiberry,DEV=0 - snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0 - Direct hardware device without any conversions plughw:CARD=sndrpihifiberry,DEV=0 - snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0 - Hardware device with all software conversions

doing an aplay -l only gives the dac

So it seems that enabling the dac overrides all the other devices. However for some reason in the sound settings of osmc it only sees, Hdmi, analogue or hdmi and analogue which must be why it still works and watchings movies and shows works perfectly fine

It works!!! so using the built in method of adding a dac breaks it and doesn’t seem to allow osmc to use it as it’s sound output. However I have setup the dac using the tutorial on instructables, I think I may have messed up slightly in the asound.conf I made as now all the outputs show up in aplay -l and the default is still hdmi. This means that all the sound goes out the tv except squeezelite which will go out my speakers.

Thank you all very much for your help, the only thing I need to figure out is why it fails whenever it I try to connect it to my 5Ghz wifi