Update of /cvsroot/alsa/alsa-kernel/core/oss
In directory sc8-pr-cvs1:/tmp/cvs-serv31561

Modified Files:
        mixer_oss.c 
Log Message:
added fallback device selection for OSS mixer.



Index: mixer_oss.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/oss/mixer_oss.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- mixer_oss.c 25 Sep 2003 18:55:43 -0000      1.24
+++ mixer_oss.c 16 Oct 2003 12:01:04 -0000      1.25
@@ -872,7 +872,12 @@
        rslot->number = idx;
 }
 
-static int snd_mixer_oss_build_input(snd_mixer_oss_t *mixer, struct 
snd_mixer_oss_assign_table *ptr, int ptr_allocated)
+/*
+ * build an OSS mixer element.
+ * ptr_allocated means the entry is dynamically allocated (change via proc file).
+ * when replace_old = 1, the old entry is replaced with the new one.
+ */
+static int snd_mixer_oss_build_input(snd_mixer_oss_t *mixer, struct 
snd_mixer_oss_assign_table *ptr, int ptr_allocated, int replace_old)
 {
        struct slot slot;
        struct slot *pslot;
@@ -880,6 +885,10 @@
        snd_mixer_oss_slot_t *rslot;
        char str[64];   
        
+       /* check if already assigned */
+       if (mixer->slots[ptr->oss_id].get_volume && ! replace_old)
+               return 0;
+
        memset(&slot, 0, sizeof(slot));
        if (snd_mixer_oss_build_test(mixer, &slot, ptr->name, ptr->index,
                                     SNDRV_MIXER_OSS_ITEM_GLOBAL))
@@ -1084,7 +1093,7 @@
                        goto __unlock;
                }
                tbl->index = idx;
-               if (snd_mixer_oss_build_input(mixer, tbl, 1) <= 0) {
+               if (snd_mixer_oss_build_input(mixer, tbl, 1, 1) <= 0) {
                        kfree(tbl->name);
                        kfree(tbl);
                }
@@ -1127,9 +1136,11 @@
 {
        static struct snd_mixer_oss_assign_table table[] = {
                { SOUND_MIXER_VOLUME,   "Master",               0 },
+               { SOUND_MIXER_VOLUME,   "Front",                0 }, /* fallback */
                { SOUND_MIXER_BASS,     "Tone Control - Bass",  0 },
                { SOUND_MIXER_TREBLE,   "Tone Control - Treble", 0 },
                { SOUND_MIXER_SYNTH,    "Synth",                0 },
+               { SOUND_MIXER_SYNTH,    "FM",                   0 }, /* fallback */
                { SOUND_MIXER_PCM,      "PCM",                  0 },
                { SOUND_MIXER_SPEAKER,  "PC Speaker",           0 },
                { SOUND_MIXER_LINE,     "Line",                 0 },
@@ -1137,6 +1148,7 @@
                { SOUND_MIXER_CD,       "CD",                   0 },
                { SOUND_MIXER_IMIX,     "Monitor Mix",          0 },
                { SOUND_MIXER_ALTPCM,   "PCM",                  1 },
+               { SOUND_MIXER_ALTPCM,   "Wave",                 0 }, /* fallback */
                { SOUND_MIXER_RECLEV,   "-- nothing --",        0 },
                { SOUND_MIXER_IGAIN,    "Capture",              0 },
                { SOUND_MIXER_OGAIN,    "Playback",             0 },
@@ -1152,15 +1164,10 @@
                { SOUND_MIXER_RADIO,    "Radio",                0 },
                { SOUND_MIXER_MONITOR,  "Monitor",              0 }
        };
-       static struct snd_mixer_oss_assign_table fm_table = {
-               SOUND_MIXER_SYNTH,      "FM",                   0
-       };
        unsigned int idx;
        
        for (idx = 0; idx < sizeof(table) / sizeof(struct snd_mixer_oss_assign_table); 
idx++)
-               snd_mixer_oss_build_input(mixer, &table[idx], 0);
-       if (mixer->slots[SOUND_MIXER_SYNTH].get_volume == NULL)
-               snd_mixer_oss_build_input(mixer, &fm_table, 0);
+               snd_mixer_oss_build_input(mixer, &table[idx], 0, 0);
        if (mixer->mask_recsrc) {
                mixer->get_recsrc = snd_mixer_oss_get_recsrc2;
                mixer->put_recsrc = snd_mixer_oss_put_recsrc2;



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to