Automatically select connected ALSA device
#1
Hey guys,

I use both ALSA and PulseAudio on my Ubuntu 14.04/Gotham 13 htpc (steam BPM 'just works' with PA) and am start/stopping PA as required, generally xbmc only uses ALSA but occasionally I will run xbmc with PA running (because of Steam bpm's 'return to desktop' option) and PA is detected and used by xbmc with no user input. The thing is that next time I run xbmc without PA running xbmc automatically selects the first audio device, which results in no sound as the 2nd device is what is connected. After manually changing xbmc to use the connected ALSA device everything works great. On a fresh install of a late OE 4 beta the first device is selected aswell.

So does any one know of a way I can have xbmc use a specific ALSA device when not using PA after running xbmc with PA? Can I achieve this via a a default device in ~/.asoundrc? I could probably use a script to check if pa is running and what device xbmc is using, but that seems kinda clunky. Also I could maybe change my cabling so its connected to the first device, but this isn't a method that could work across multiple machines. Or can I disable all unused devices at a system level?

Any suggestions are appreciated.
Reply
#2
OE does not ship with pulseaudio. So I really wonder.

Just start xbmc with: AE_SINK=ALSA xbmc (like the wiki says :-))
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#3
Nah not using pa with oe, just saying that on 1st boot it also selects the first device in the list, not the device that xbmc shows as having a tv connected connected (2nd device).

Ive been using the environmental variable but the thing is that while it always exposes the alsa devices with pa running, the alsa device I use only shows up maybe half the time, while all the others still do, so I took the wiki's advice that it would cause problems and stopped using it Smile

Using a simple .asoundrc file to set the default device seems to have done the trick, when either pa or alsa is being used the the right device is automatically chosen. Now I can get the best of both worlds Big Grin

fritsch I have two questions hopefully you can answer

Does having pa installed, but not running, impact xbmc with alsa?
Can you recommend anything with the following ~/.asoundrc file for usage in the above scenario?

Code:
pcm.!default {
    type hw
    card 0
    device 7
    }

    ctl.!default {
    type hw
    card 0
    device 7
    }

Thanks!
Reply
#4
That's a simple default file. That won't harm.

But you never know which device PA is currently holding. If e.g. the same hdmi out is the pa default device. It will try to access it every time something is played via the PA server. That will kill xbmc output, make it crash and what not ...

That's the reason I warn to use exclusive ALSA when pa server is installed and running.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#5
Thanks for the info fritsch (again Wink).
Reply
#6
(2014-05-13, 08:47)fritsch Wrote: OE does not ship with pulseaudio. So I really wonder.

Just start xbmc with: AE_SINK=ALSA xbmc (like the wiki says :-))

How to start xbmcbunto with that parameter ?

Thanks in advance.
ynwa
Reply
#7
xbmcbuntu does not install pulseaudio - so not needed.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#8
I had it in /etc/environment
Reply

Logout Mark Read Team Forum Stats Members Help
Automatically select connected ALSA device0