aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2008-02-15 21:48:00 -0800
committerChris Robinson <[email protected]>2008-02-15 21:48:00 -0800
commitb1bdd7c89f285649e5a3af2dbe68b358accf47eb (patch)
tree33d0533090099129a714654100958ce638913fdf
parentffe7a11866f7314022ae4d4ed5b26ed2beab7b6d (diff)
Add the first card after making sure there's a useable device on it
-rw-r--r--Alc/alsa.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/Alc/alsa.c b/Alc/alsa.c
index 09727ba9..fa655386 100644
--- a/Alc/alsa.c
+++ b/Alc/alsa.c
@@ -789,6 +789,8 @@ LOAD_FUNC(snd_card_next);
}
while (card >= 0) {
+ int firstDev = 1;
+
sprintf(name, "hw:%d", card);
if ((err = psnd_ctl_open(&handle, name, 0)) < 0) {
AL_PRINT("control open (%i): %s\n", card, psnd_strerror(err));
@@ -799,11 +801,6 @@ LOAD_FUNC(snd_card_next);
psnd_ctl_close(handle);
goto next_card;
}
- if(card < MAX_DEVICES-1) {
- snprintf(name, sizeof(name), "ALSA Software on %s",
- psnd_ctl_card_info_get_name(info));
- alsaDeviceList[card+1] = AppendDeviceList(name);
- }
dev = -1;
while (idx < MAX_ALL_DEVICES) {
@@ -813,6 +810,14 @@ LOAD_FUNC(snd_card_next);
AL_PRINT("snd_ctl_pcm_next_device failed\n");
if (dev < 0)
break;
+
+ if(firstDev && card < MAX_DEVICES-1) {
+ firstDev = 0;
+ snprintf(name, sizeof(name), "ALSA Software on %s",
+ psnd_ctl_card_info_get_name(info));
+ alsaDeviceList[card+1] = AppendDeviceList(name);
+ }
+
psnd_pcm_info_set_device(pcminfo, dev);
psnd_pcm_info_set_subdevice(pcminfo, 0);
psnd_pcm_info_set_stream(pcminfo, stream);