[MPlayer-dev-eng] [PATCH] add alsa9 mixer seletion (fwd)

Roland Kuhn rkuhn at e18.physik.tu-muenchen.de
Tue Sep 16 00:05:58 CEST 2003


Hi!

I've noticed that the -pre1 alsa9 code always uses card 'default' and control 
'PCM' for the mixer. Well, I usually use hw:1,0,1 for playback, so I wrote the 
following patch:

--- ao_alsa9.c-rk       2003-09-15 22:41:33.000000000 +0200
+++ ao_alsa9.c  2003-09-15 23:39:42.000000000 +0200
@ -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 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;

==============================

Any chance something like this could go in? Works like a charm for me ;-) Now 
I can use "-mixer hw:1/Master" so that the 0/9 keys operate on the correct 
control.

Ciao,
					Roland

+---------------------------+-------------------------+
|    TU Muenchen            |                         |
|    Physik-Department E18  |  Raum    3558           |
|    James-Franck-Str.      |  Telefon 089/289-12592  |
|    85747 Garching         |  Telefax 089/289-12570  |
+---------------------------+-------------------------+




More information about the MPlayer-dev-eng mailing list