[PATCH] Choosing audio device for alsa
Free media player with support for Youtube
Brought to you by:
rvm
I use radeonhd with my GPU which allows me to play audio through HDMI. For that I have to use
-ao alsa:device=hw=1.3
It would be nice to let user choose audio device in GUI of SMPlayer in preferences.
I prepared 2 of 3 patches to implement that. I'll prepare third (last) if these 2 will be commited.
My only problem about these patches is that I do know nothing Windows-specific programming. I guess there isn't "aplay" command on Windows. Does alsa even support device=hw=... on Windows? Could someone else implement this?
0001.scan.for.devices.patch
0002.add.devices.to.preferences.patch
File Added: 0002.add.devices.to.preferences.patch
Moved to the patches tracker.
I've just implemented in a different way (see alsa_devices.diff). Instead of modifying inforeader, I created "deviceinfo" where in the future I could also add functions to get the audio devices and available screens for Windows.
But there's a problem. It doesn't work for me.
alsa -l displays this:
**** List of PLAYBACK Hardware Devices ****
card 0: rev60 [VIA 823x rev60], device 0: VIA 823x rev60 [VIA 823x rev60]
Subdevices: 4/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
card 0: rev60 [VIA 823x rev60], device 1: VIA 823x rev60 [VIA 823x rev60]
Subdevices: 1/1
Subdevice #0: subdevice #0
But when mplayer is called with -ao alsa:device=0.0 or -ao alsa:device=0.1 I get no sound.
[AO_ALSA] alsa-lib: pcm.c:1974:(snd_pcm_open_noupdate) Unknown PCM 0,0
[AO_ALSA] Playback open error: No such file or directory
Failed to initialize audio driver 'alsa:device=0.0'
Could not open/initialize audio device -> no sound.
Maybe I'm not passing the device properly (that wasn't on your patches).
Ah, I've just seen that you use "-ao alsa:device=hw=1.3".
-ao alsa:device=hw=0.0 works for me too.
So I committed the patch in svn r1946.
Generally I like your code, it's cleaner.
Just wondering if adding devices to ao_combo is good idea. Currently I have 11 audio outputs in this combobox which cause little mess. Maybe we should add additional GUI elements for specified audio outputs?
For example "ALSA device" QComboBox which would appear only if alsa is selected in "Audio"?
Anyway thanks for implementing & commiting :)
I've done that way just simply because it was the fastest and easiest way to do it.
Yes, maybe a combobox would be better, but that would require many more modifications.