changeset 11764:129caea8bebc

use -mixer with alsa9 patch by Roland Kuhn <rkuhn@e18.physik.tu-muenchen.de>
author attila
date Sat, 10 Jan 2004 09:10:52 +0000
parents 053a82066c60
children e0b096f0e640
files libao2/ao_alsa1x.c libao2/ao_alsa9.c
diffstat 2 files changed, 36 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_alsa1x.c	Fri Jan 09 03:36:40 2004 +0000
+++ b/libao2/ao_alsa1x.c	Sat Jan 10 09:10:52 2004 +0000
@@ -18,6 +18,7 @@
 #include <sys/poll.h>
 
 #include "../config.h"
+#include "../mixer.h"
 
 #if HAVE_SYS_ASOUNDLIB_H
 #include <sys/asoundlib.h>
@@ -96,13 +97,28 @@
       snd_mixer_elem_t *elem;
       snd_mixer_selem_id_t *sid;
 
-      const char *mix_name = "PCM";
-      char *card = "default";
+      static const char *mix_name = NULL;
+      static char *card = NULL;
 
       long pmin, pmax;
       long get_vol, set_vol;
       float calc_vol, diff, f_multi;
 
+      if(mix_name == NULL){
+        if(mixer_device) {
+          card = strdup(mixer_device);
+          mix_name = strchr(card, '/');
+          if(mix_name) {
+            *mix_name++ = 0;
+          } else {
+            mix_name = "PCM";
+          }
+        } else {
+          mix_name = "PCM";
+          card = "default";
+        }
+      }
+
       if(ao_data.format == AFMT_AC3)
 	return CONTROL_TRUE;
 
--- a/libao2/ao_alsa9.c	Fri Jan 09 03:36:40 2004 +0000
+++ b/libao2/ao_alsa9.c	Sat Jan 10 09:10:52 2004 +0000
@@ -18,6 +18,7 @@
 #include <sys/poll.h>
 
 #include "../config.h"
+#include "../mixer.h"
 
 #if HAVE_SYS_ASOUNDLIB_H
 #include <sys/asoundlib.h>
@@ -96,13 +97,28 @@
       snd_mixer_elem_t *elem;
       snd_mixer_selem_id_t *sid;
 
-      const char *mix_name = "PCM";
-      char *card = "default";
+      static const char *mix_name = NULL;
+      static char *card = NULL;
 
       long pmin, pmax;
       long get_vol, set_vol;
       float calc_vol, diff, f_multi;
 
+      if(mix_name == NULL){
+        if(mixer_device) {
+          card = strdup(mixer_device);
+          mix_name = strchr(card, '/');
+          if(mix_name) {
+            *mix_name++ = 0;
+          } else {
+            mix_name = "PCM";
+          }
+        } else {
+          mix_name = "PCM";
+          card = "default";
+        }
+      }
+
       if(ao_data.format == AFMT_AC3)
 	return CONTROL_TRUE;