From 7034b92d904baa71f1bc885d0078d8ab6ae47f35 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Mon, 24 Dec 2007 14:59:59 +0100 Subject: [PATCH] winealsa: Add special case for microphone source in mixer. Some microphones don't have a capture control, but a playback control instead. So use the playback volume, but still register it as capture volume. --- dlls/winealsa.drv/mixer.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/dlls/winealsa.drv/mixer.c b/dlls/winealsa.drv/mixer.c index 5065518c425..fb989dc2929 100644 --- a/dlls/winealsa.drv/mixer.c +++ b/dlls/winealsa.drv/mixer.c @@ -371,7 +371,8 @@ static void filllines(mixer *mmixer, snd_mixer_elem_t *mastelem, snd_mixer_elem_ const char * name = snd_mixer_selem_get_name(elem); DWORD comp = getcomponenttype(name); - if (snd_mixer_selem_has_playback_volume(elem)) + if (snd_mixer_selem_has_playback_volume(elem) && + (snd_mixer_selem_has_capture_volume(elem) || comp != MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE)) { (++mline)->component = comp; MultiByteToWideChar(CP_UNIXCP, 0, name, -1, mline->name, MAXPNAMELEN); @@ -382,7 +383,7 @@ static void filllines(mixer *mmixer, snd_mixer_elem_t *mastelem, snd_mixer_elem_ else if (!capt) continue; - if (capt && snd_mixer_selem_has_capture_volume(elem)) + if (capt && (snd_mixer_selem_has_capture_volume(elem) || comp == MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE)) { (++mline)->component = comp; MultiByteToWideChar(CP_UNIXCP, 0, name, -1, mline->name, MAXPNAMELEN); @@ -473,9 +474,19 @@ static void ALSA_MixerInit(void) captelem = elem; else if (!blacklisted(elem)) { + DWORD comp = getcomponenttype(snd_mixer_selem_get_name(elem)); + DWORD skip = 0; + + /* Work around buggy drivers: Make this a capture control if the name is recognised as a microphone */ if (snd_mixer_selem_has_capture_volume(elem)) ++capcontrols; - if (snd_mixer_selem_has_playback_volume(elem)) + else if (comp == MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE) + { + ++capcontrols; + skip = 1; + } + + if (!skip && snd_mixer_selem_has_playback_volume(elem)) { if (!strcasecmp(snd_mixer_selem_get_name(elem), "Headphone") && !headelem) headelem = elem;