After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 506928 - [alsamixer] add "PCM" as master fall back for cards that do not have 'Master' mixer
[alsamixer] add "PCM" as master fall back for cards that do not have 'Master'...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal major
: 0.10.16
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-01-02 21:22 UTC by Jerone Young
Modified: 2008-01-07 13:20 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jerone Young 2008-01-02 21:22:41 UTC
This issue here is that many new laptops are having sound cards that no longer include a hardware "Master" mixer. For there the "PCM" is actually the master mixer. This is displayed with the Lenovo Thinkpad T61 & X61 who both use the AD1984 sound card. 

For applications like the gnome volume control. Gstreamer is telling it to use the Microphone as the master control volume. This is wrong! The master find function needs to add PCM as a fallback if it cannot find 'Master' or 'Front' mixers.

I have a patch attached to fix this issue below:



This patch fixes issue with ALSA drivers that enable sound cards that do not
have a hardware 'Master' mixer. Instead on these cards there is only PCM as
the master. This patch adds PCM as a fall back if 'Master' nor 'Front' mixers
are found.


The problem being caused is that tools such as gnome-volume-control
& gnome-control-center are looking for a master they identify the microphone
and not PCM. This is demonstrated on the Lenovo Thinkad T61 & X61 using AD1984
chipset (using Intel HDA driver ALSA driver). This problem has also
been seen a Sony Vaio S4XP.

I've tested this patch on my Thinkpad T61 and it works perfect.

Bugzillas reporting this issue are:

https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/174292
https://bugzilla.redhat.com/show_bug.cgi?id=344911


Signed-off-by: Jerone Young <jerone@gmail.com>

diff -r 52cc0d2f47c2 ext/alsa/gstalsamixer.c
--- a/ext/alsa/gstalsamixer.c   Wed Dec 26 16:02:08 2007 -0600
+++ b/ext/alsa/gstalsamixer.c   Wed Dec 26 16:05:21 2007 -0600
@@ -154,6 +154,16 @@ gst_alsa_mixer_find_master_mixer (GstAls
    element = snd_mixer_elem_next (element);
  }

+  /*  If not, check if we have a playback mixer labelled as 'PCM' */
+  element = snd_mixer_first_elem (handle);
+  for (i = 0; i < count; i++) {
+    if (snd_mixer_selem_has_playback_volume (element) &&
+        strcmp (snd_mixer_selem_get_name (element), "PCM") == 0) {
+      return element;
+    }
+    element = snd_mixer_elem_next (element);
+  }
+
  /* If not, check if we have a playback mixer with both volume and switch */
  element = snd_mixer_first_elem (handle);
  for (i = 0; i < count; i++) {
Comment 1 Tim-Philipp Müller 2008-01-02 23:58:32 UTC
Thanks for the patch. Could you also provide the output of:

 $ amixer -D 'default'

and

 $ amixer -D 'hw:0'

?
Comment 2 Jerone Young 2008-01-03 00:14:52 UTC
amixer -D 'default':
===============================

Simple mixer control 'Headphone',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [on]
  Front Right: Playback [on]
Simple mixer control 'PCM',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 39
  Mono:
  Front Left: Playback 31 [79%] [-12.00dB]
  Front Right: Playback 31 [79%] [-12.00dB]
Simple mixer control 'Mic',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 22 [71%] [-1.50dB] [on]
  Front Right: Playback 22 [71%] [-1.50dB] [on]
Simple mixer control 'Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%]
  Front Right: 0 [0%]
Simple mixer control 'IEC958',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 39
  Mono:
  Front Left: Playback 39 [100%] [0.00dB] [off]
  Front Right: Playback 39 [100%] [0.00dB] [off]
Simple mixer control 'IEC958 Playback Source',0
  Capabilities: enum
  Items: 'PCM' 'ADC'
  Item0: 'PCM'
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 54
  Front Left: Capture 39 [72%] [0.00dB] [off]
  Front Right: Capture 39 [72%] [0.00dB] [off]
Simple mixer control 'Capture',1
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 54
  Front Left: Capture 39 [72%] [0.00dB] [off]
  Front Right: Capture 39 [72%] [0.00dB] [off]
Simple mixer control 'Beep',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Digital',0
  Capabilities: cvolume
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 120
  Front Left: Capture 60 [50%] [0.00dB]
  Front Right: Capture 60 [50%] [0.00dB]
Simple mixer control 'Docking Mic',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Docking Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%]
  Front Right: 0 [0%]
Simple mixer control 'Input Source',0
  Capabilities: enum
  Items: 'Mic' 'Internal Mic' 'Mix'
  Item0: 'Mic'
Simple mixer control 'Input Source',1
  Capabilities: enum
  Items: 'Mic' 'Internal Mic' 'Mix'
  Item0: 'Mic'
Simple mixer control 'Internal Mic',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Internal Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%]
  Front Right: 0 [0%]
Simple mixer control 'Speaker',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [on]
  Front Right: Playback [on]




amixer -D 'hw:0':
====================================
Simple mixer control 'Headphone',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [on]
  Front Right: Playback [on]
Simple mixer control 'PCM',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 39
  Mono:
  Front Left: Playback 31 [79%] [-12.00dB]
  Front Right: Playback 31 [79%] [-12.00dB]
Simple mixer control 'Mic',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 22 [71%] [-1.50dB] [on]
  Front Right: Playback 22 [71%] [-1.50dB] [on]
Simple mixer control 'Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%]
  Front Right: 0 [0%]
Simple mixer control 'IEC958',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 39
  Mono:
  Front Left: Playback 39 [100%] [0.00dB] [off]
  Front Right: Playback 39 [100%] [0.00dB] [off]
Simple mixer control 'IEC958 Playback Source',0
  Capabilities: enum
  Items: 'PCM' 'ADC'
  Item0: 'PCM'
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 54
  Front Left: Capture 39 [72%] [0.00dB] [off]
  Front Right: Capture 39 [72%] [0.00dB] [off]
Simple mixer control 'Capture',1
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 54
  Front Left: Capture 39 [72%] [0.00dB] [off]
  Front Right: Capture 39 [72%] [0.00dB] [off]
Simple mixer control 'Beep',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Digital',0
  Capabilities: cvolume
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 120
  Front Left: Capture 60 [50%] [0.00dB]
  Front Right: Capture 60 [50%] [0.00dB]
Simple mixer control 'Docking Mic',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Docking Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%]
  Front Right: 0 [0%]
Simple mixer control 'Input Source',0
  Capabilities: enum
  Items: 'Mic' 'Internal Mic' 'Mix'
  Item0: 'Mic'
Simple mixer control 'Input Source',1
  Capabilities: enum
  Items: 'Mic' 'Internal Mic' 'Mix'
  Item0: 'Mic'
Simple mixer control 'Internal Mic',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Internal Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%]
  Front Right: 0 [0%]
Simple mixer control 'Speaker',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [on]
  Front Right: Playback [on]











Comment 3 Jerone Young 2008-01-05 23:24:04 UTC
To summaries the last post here is a simple list of the mixers available (as someone mentioned on the redhat bug I linked to):

PCM
Micrphone
Mic Boost
Capture
Capture 1
Beep
Docking Mic
Docking Mic Boost
Internal Mic
Internal Mic Boost

The current logic in find master is falling back to 'Microphone'. But it needs to be 'PCM'. So the simple solution that should not interfere with any other card is to have 'PCM' to be one of the last fallbacks before hitting the logic that is causing this problems.
Comment 4 Tim-Philipp Müller 2008-01-07 13:20:02 UTC
Thanks, committed:

 2008-01-07  Tim-Philipp Müller  <tim at centricular dot net>

        Patch by: Jerone Young <jerone at gmail com>

        * ext/alsa/gstalsamixer.c: (gst_alsa_mixer_find_master_mixer):
          If there's no mixer track by the name of 'Master' or 'Front',
          check if there's one called 'PCM' before trying the generic
          fallback logic (fixes #506928, where we pick 'Mic' as master
          track for the AD1984 card in a Thinkpad T61/X61 laptop).