Maarten Lankhorst : winealsa: Add special case for microphone source in mixer.

Alexandre Julliard julliard at winehq.org
Mon Dec 24 14:21:38 CST 2007


Module: wine
Branch: master
Commit: 7034b92d904baa71f1bc885d0078d8ab6ae47f35
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7034b92d904baa71f1bc885d0078d8ab6ae47f35

Author: Maarten Lankhorst <maarten at codeweavers.com>
Date:   Mon Dec 24 14:59:59 2007 +0100

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 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/dlls/winealsa.drv/mixer.c b/dlls/winealsa.drv/mixer.c
index 5065518..fb989dc 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;




More information about the wine-cvs mailing list