Commit b0d992e2 authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA CVS update - Takashi Iwai <tiwai@suse.de>

ALSA<-OSS emulation
added fallback device selection for OSS mixer.
parent 79844cee
...@@ -872,7 +872,12 @@ static void mixer_slot_clear(snd_mixer_oss_slot_t *rslot) ...@@ -872,7 +872,12 @@ static void mixer_slot_clear(snd_mixer_oss_slot_t *rslot)
rslot->number = idx; 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 slot;
struct slot *pslot; struct slot *pslot;
...@@ -880,6 +885,10 @@ static int snd_mixer_oss_build_input(snd_mixer_oss_t *mixer, struct snd_mixer_os ...@@ -880,6 +885,10 @@ static int snd_mixer_oss_build_input(snd_mixer_oss_t *mixer, struct snd_mixer_os
snd_mixer_oss_slot_t *rslot; snd_mixer_oss_slot_t *rslot;
char str[64]; char str[64];
/* check if already assigned */
if (mixer->slots[ptr->oss_id].get_volume && ! replace_old)
return 0;
memset(&slot, 0, sizeof(slot)); memset(&slot, 0, sizeof(slot));
if (snd_mixer_oss_build_test(mixer, &slot, ptr->name, ptr->index, if (snd_mixer_oss_build_test(mixer, &slot, ptr->name, ptr->index,
SNDRV_MIXER_OSS_ITEM_GLOBAL)) SNDRV_MIXER_OSS_ITEM_GLOBAL))
...@@ -1084,7 +1093,7 @@ static void snd_mixer_oss_proc_write(snd_info_entry_t *entry, ...@@ -1084,7 +1093,7 @@ static void snd_mixer_oss_proc_write(snd_info_entry_t *entry,
goto __unlock; goto __unlock;
} }
tbl->index = idx; 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->name);
kfree(tbl); kfree(tbl);
} }
...@@ -1127,9 +1136,11 @@ static void snd_mixer_oss_build(snd_mixer_oss_t *mixer) ...@@ -1127,9 +1136,11 @@ static void snd_mixer_oss_build(snd_mixer_oss_t *mixer)
{ {
static struct snd_mixer_oss_assign_table table[] = { static struct snd_mixer_oss_assign_table table[] = {
{ SOUND_MIXER_VOLUME, "Master", 0 }, { SOUND_MIXER_VOLUME, "Master", 0 },
{ SOUND_MIXER_VOLUME, "Front", 0 }, /* fallback */
{ SOUND_MIXER_BASS, "Tone Control - Bass", 0 }, { SOUND_MIXER_BASS, "Tone Control - Bass", 0 },
{ SOUND_MIXER_TREBLE, "Tone Control - Treble", 0 }, { SOUND_MIXER_TREBLE, "Tone Control - Treble", 0 },
{ SOUND_MIXER_SYNTH, "Synth", 0 }, { SOUND_MIXER_SYNTH, "Synth", 0 },
{ SOUND_MIXER_SYNTH, "FM", 0 }, /* fallback */
{ SOUND_MIXER_PCM, "PCM", 0 }, { SOUND_MIXER_PCM, "PCM", 0 },
{ SOUND_MIXER_SPEAKER, "PC Speaker", 0 }, { SOUND_MIXER_SPEAKER, "PC Speaker", 0 },
{ SOUND_MIXER_LINE, "Line", 0 }, { SOUND_MIXER_LINE, "Line", 0 },
...@@ -1137,6 +1148,7 @@ static void snd_mixer_oss_build(snd_mixer_oss_t *mixer) ...@@ -1137,6 +1148,7 @@ static void snd_mixer_oss_build(snd_mixer_oss_t *mixer)
{ SOUND_MIXER_CD, "CD", 0 }, { SOUND_MIXER_CD, "CD", 0 },
{ SOUND_MIXER_IMIX, "Monitor Mix", 0 }, { SOUND_MIXER_IMIX, "Monitor Mix", 0 },
{ SOUND_MIXER_ALTPCM, "PCM", 1 }, { SOUND_MIXER_ALTPCM, "PCM", 1 },
{ SOUND_MIXER_ALTPCM, "Wave", 0 }, /* fallback */
{ SOUND_MIXER_RECLEV, "-- nothing --", 0 }, { SOUND_MIXER_RECLEV, "-- nothing --", 0 },
{ SOUND_MIXER_IGAIN, "Capture", 0 }, { SOUND_MIXER_IGAIN, "Capture", 0 },
{ SOUND_MIXER_OGAIN, "Playback", 0 }, { SOUND_MIXER_OGAIN, "Playback", 0 },
...@@ -1152,15 +1164,10 @@ static void snd_mixer_oss_build(snd_mixer_oss_t *mixer) ...@@ -1152,15 +1164,10 @@ static void snd_mixer_oss_build(snd_mixer_oss_t *mixer)
{ SOUND_MIXER_RADIO, "Radio", 0 }, { SOUND_MIXER_RADIO, "Radio", 0 },
{ SOUND_MIXER_MONITOR, "Monitor", 0 } { SOUND_MIXER_MONITOR, "Monitor", 0 }
}; };
static struct snd_mixer_oss_assign_table fm_table = {
SOUND_MIXER_SYNTH, "FM", 0
};
unsigned int idx; unsigned int idx;
for (idx = 0; idx < sizeof(table) / sizeof(struct snd_mixer_oss_assign_table); idx++) for (idx = 0; idx < sizeof(table) / sizeof(struct snd_mixer_oss_assign_table); idx++)
snd_mixer_oss_build_input(mixer, &table[idx], 0); snd_mixer_oss_build_input(mixer, &table[idx], 0, 0);
if (mixer->slots[SOUND_MIXER_SYNTH].get_volume == NULL)
snd_mixer_oss_build_input(mixer, &fm_table, 0);
if (mixer->mask_recsrc) { if (mixer->mask_recsrc) {
mixer->get_recsrc = snd_mixer_oss_get_recsrc2; mixer->get_recsrc = snd_mixer_oss_get_recsrc2;
mixer->put_recsrc = snd_mixer_oss_put_recsrc2; mixer->put_recsrc = snd_mixer_oss_put_recsrc2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment