Bug 125772

Summary: kmix capture level control does not work
Product: [Applications] kmix Reporter: Paul Worrall <p.r.worrall>
Component: generalAssignee: Christian Esken <esken>
Status: RESOLVED FIXED    
Severity: normal CC: cimmino.marco, marcus, martin.zboril
Priority: NOR    
Version: 2.6   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: fix capture volume slider behavior
amixer output
CA0106 amixer
cards output for CA0106
Output of command amixer for ALC650F
Proposed fix for wrong behaviour of capture slider
Output of amixer command for ALC655
Output of amixer command for STAC9750
ALSA output for Intel 82801H (ICH8 Family) HD Audio

Description Paul Worrall 2006-04-17 23:23:36 UTC
Version:           2.6 (using KDE 3.5.2, Gentoo)
Compiler:          gcc version 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)
OS:                Linux (i686) release 2.6.15-gentoo-r1-prw-r40

KMix: 2.6 (Using KDE 3.5.2)
Alsamixer: v1.0.10
Sound Card: VIA 8235
Chip: AD1980

I am able to set the capture level using alsamixer but the equivalent control in kmix seems to do nothing.
Comment 1 Christian Esken 2006-06-15 12:29:29 UTC
Please run Alsamixer and Kmix at the same time.
Change volume levels in both applications and see whether a change in KMix changes something in Alsamixer and vice versa.
If you change a Control, and don't see a change immediately, don't give up! Make sure to check EVERY control on the "other" mixer then. "Capture" volumes can be present sometimes in KMix's "Record" Tab, or "Play" Tab, or both, depending on your soundcard driver. Make also sure, you didn't hide any Mixer controls in KMix.
Comment 2 Paul Worrall 2006-06-17 00:37:48 UTC
I have done as you suggest: for each control in alsamixer, located the corresponding control in kmix and verified that adjustments in kmix affect alsamixer, and vice versa. I can confirm that capture is the only control which is 'disconnected' (i.e. I can alter it in either application but the changes are not reflected in the other).  I have also discovered that each time I choose 'split channels' for the capture control in kmix I get one more channel (2 the first time, 3 the second time, 4 the third.  I stopped when I got to 10). None of the controls are hidden in kmix.
Comment 3 Christian Esken 2006-06-18 14:38:24 UTC
Quite interesting observation. It really looks like KMix is trying to control a wrong/non-existant device. The "split channels" issue is very weird, and I currently cannot see how this could happen at all. It looks to be very hard (read: impossible) to fix this problem without having the corresponding soundcard at hand.
I'll surely take a look, but cannot promise anything.
Comment 4 Marco Cimmino 2006-06-26 11:06:43 UTC
Confirmed for me after upgrade to alsa 1.0.11, with 1.0.10 I had not this problem.
I have a sound blaster live 24 bit and ca0106 module.
Comment 5 Marco Cimmino 2006-06-26 11:11:49 UTC
Christian:
I think kmix look for changes in the volume right? so these changes are made in a file in /proc?
If yes we can post this or these files.
Comment 6 Marco Cimmino 2006-06-26 11:13:36 UTC
Christian:
I think kmix look for changes in the volume right? so these changes are made in a file in /proc?
If yes we can post this or these files.
Comment 7 Michael Kreuzer 2006-09-27 13:58:15 UTC
Created attachment 17935 [details]
fix capture volume slider behavior
Comment 8 Michael Kreuzer 2006-09-27 14:01:37 UTC
I have seen the same problem on my AC97 sound cards using
the snd-intel8x0 driver (Realtek ALC65x, Sigmatel, AD1980).
This problem has been introduced by the patch for the Bug 110807 (https://bugs.kde.org/show_bug.cgi?id=110807).
Attached is a patch that will fix it.
Attachment #17935 [details] 
Comment 9 Christian Esken 2006-09-28 17:55:41 UTC
The fix might work for you, but it is not correct for the general usage. In fact, it might break a lot of other soundcards.
We need something else, and I need your input here. Everybody interested in getting this fixed should please submit the output of the following two commands:

cat /proc/asound/cards
amixer
Comment 10 Christian Esken 2006-09-28 17:57:25 UTC
Forgot one thing:

Please tell which control (EXACT NAME) is problematic for you

Then add the output of the following two commands: 
 
 cat /proc/asound/cards 
 amixer 
Comment 11 Paul Worrall 2006-09-28 19:38:42 UTC
Created attachment 17956 [details]
amixer output
Comment 12 Paul Worrall 2006-09-28 19:40:01 UTC
Right, I've been through all the controls again and have the following observations (BTW since the initial bug report I have switched from Gentoo to Kubuntu.  No hardware change though)

1. Clicking a the red led in kmix selects an input as a capture source and causes alsamixer to show the legend 'CAPTUR' for that control.  A subsequent click on the same red led turns it off in kmix but does not affect the CAPTUR legend in alsamixer.

2. In alsamixer I have two slider controls: 'IEC958 Playback AC97-SPSA' and 'IEC958 Playback AC97-SPSA Capture'.  Adjusting the first also affects the second, but the second does not affect the first.  In kmix I have two slider controls both entitled 'IEC958 Playback AC97-SPSA' - one on the Output tab and one on the Input tab and they both seem to be driven by the 'IEC958 Playback AC97-SPSA' control in alsamixer (i.e. the 'IEC958 Playback AC97-SPSA Capture' control is not replicated in kmix). I don't think I had either of these controls when Gentoo was installed (it may .

3. The control entitled 'Capture' (in both applications) is still 'disconnected' and still has the strange behaviour when selecting 'split'

Here is the output of cat /proc/asound/cards:

0 [V8235          ]: VIA8233 - VIA 8235
                     VIA 8235 with AD1980 at 0xe000, irq 185

And I've added the output of amixer as an attachment. (see comment #11)
Comment 13 Marco Cimmino 2006-09-29 11:35:25 UTC
Created attachment 17959 [details]
CA0106 amixer

This is the amixer output for CA0106 card with alsa 1.0.13rc3
Comment 14 Marco Cimmino 2006-09-29 11:36:39 UTC
Created attachment 17960 [details]
cards output for CA0106

This is the cat /proc/asound/cards output for CA0106 card with alsa 1.0.13rc3
Comment 15 Marco Cimmino 2006-09-29 11:39:34 UTC
Christian I have attached the two files for my CA0106 (aka Sound Blaster Live! 24 bit integrated) and my problematic controls are all in the capture area:

1) Line-in
2) Mic
3) Phone
4) Aux

All of them don't work with alsa 1.0.13rc3 and kmix 2.6.
It only works the switch that change the capture point.
Comment 16 Michael Kreuzer 2006-10-01 16:57:29 UTC
Created attachment 17980 [details]
Output of command amixer for ALC650F

Here are the outputs for my NVidia nForce2 onboard soundcard with alsa-1.0.12:
cat /proc/asound/cards

 0 [nForce2	   ]: NFORCE - NVidia nForce2
		      NVidia nForce2 with ALC650F at 0xdf087000, irq 193
 1 [UART	   ]: MPU-401 UART - MPU-401 UART
		      MPU-401 UART at 0x330, irq 5

The output of amixer is attached.
Comment 17 Michael Kreuzer 2006-10-02 00:22:25 UTC
The problematic control for the ALC650F is the
capture volume:

Simple mixer control 'Capture',0
Comment 18 Jonas Hurrelmann 2006-10-10 18:00:40 UTC
Created attachment 18078 [details]
Proposed fix for wrong behaviour of capture slider

I can confirm the problem with the capture volume with:

 0 [ICH6	   ]: ICH4 - Intel ICH6
		      Intel ICH6 with STAC9750,51 at 0xdffffe00, irq 169
Having:

Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch cswitch-joined

The problem here is that the capture device is marked as canCapture and
canRecord but the actual volume is set via volCapture.
(As it has cvolume and cswitch...)

I propose another patch that I think is generic and not will break other
things.
This should make sure that devices with snd_mixer_selem_has_capture_volume will
actually have this slider.
Comment 19 Gottfried Rossmanith 2006-10-10 21:53:10 UTC
Created attachment 18079 [details]
Output of amixer command for ALC655

Here is the output of the onboard soundchip (Laptop MEDION 95400) with
alsa-1.0.13:

cat /proc/asound/cards
 0 [I82801DBICH4   ]: ICH4 - Intel 82801DB-ICH4
		      Intel 82801DB-ICH4 with ALC655 at 0xe0000c00, irq 10

The problematic control for the ALC655 is the capture volume:

Simple mixer control 'Capture',0
Comment 20 Gottfried Rossmanith 2006-10-14 21:53:09 UTC
Created attachment 18120 [details]
Output of amixer command for STAC9750

Here is the output of the onboard soundchip (Laptop Fujitsu Siemens S7010) with

alsa-1.0.13:

cat /proc/asound/cards
 0 [I82801DBICH4   ]: ICH4 - Intel 82801DB-ICH4
		      Intel 82801DB-ICH4 with STAC9750,51 at 0xd0100c00, irq 11


The problematic control for the STAC9750 is the capture volume:

Simple mixer control 'Capture',0
Comment 21 Marco Cimmino 2006-10-26 10:53:22 UTC
guys this bug is very annoying and we provide a lot of info, now need to be fixed!
Then vote for this bug, I putted 20 vote, do it you too!!!
Comment 22 Christian Esken 2006-10-27 19:32:29 UTC
This problem is probably unfixable, because there is no ALSA mixer documentation. I recommend you switch to OSS instead. Currently you can enable OSS in KMix via the following hack.

Quit KMix and add the follwing line in ~/.kde/share/config/kmixrc directly below the "Menubar=..." line.

MultiDriver=true

Start KMix, you will see your soundcard twice. select the new Mixer, and regulate the volume with the new Mixer.

Its a bit complicated at the moment, but I always hoped ALSA would start providing documentation at some point of time.

PS: You might want to inspect the ALSA mixer docmentation yourself: http://www.alsa-project.org/alsa-doc/alsa-lib/mixer.html
Comment 23 Marco Cimmino 2006-10-29 17:44:07 UTC
> This problem is probably unfixable, because there is no ALSA mixer documentation. I recommend you switch to OSS instead. Currently you can enable OSS in KMix via the following hack. 

unfixable? So why kamix works perfectly with my card? I suggest all people have trouble with kmix to switch to kamix!
http://kamix.sourceforge.net/
Comment 24 Jonas Hurrelmann 2006-11-05 22:25:51 UTC
The problem *is* fixable. 
The particular "if" statement has flaws as it checks for (canCapture && !canRecord) although the combination "cvolume cswitch" can occur. Probably all of the mentioned soundcards have both flags set on the capture device.
Either have a look at my proposed patch or handle the problem in another way.
Comment 25 Christian Esken 2006-11-06 00:46:44 UTC
Jonas, I need to guess a lot as there is no documentation at all on the mixer API. :-(
As explained in comment 9, I cannot apply your patch as is, as it likely breaks other soundcards. Doing it 100% right needs a lot of time (in terms of coding, verifying  and testing). I don't have the time but I'll happily integrate patches if a I am confident that they don't break existing scenarios. It is possibly better to do that in personal mail though.

PS: Actually there are several theoretical problems, like having "cswitch pswitch" and possibly on some combination on "combined" switches [whatever combined switches are is still a mystery the ALSA developers keep to themselves]. Thus I have reworked everything in the KDE4 branch already.
Comment 26 Marco Cimmino 2006-11-10 11:40:16 UTC
Created an alsa bug for documentation.
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=2606
Comment 27 Christian Esken 2006-12-22 20:36:02 UTC
*** Bug 134876 has been marked as a duplicate of this bug. ***
Comment 28 Achim Herwig 2007-03-31 13:41:14 UTC
Created attachment 20137 [details]
ALSA output for Intel 82801H (ICH8 Family) HD Audio

Me 2!

Everything works (alsamixer directly shows changes), only the two input levels
are disconnected. Turning on and off the two captures work, though.

KAMix from SuSE correctly influences the capture levels, but seems a weird
application otherwise....
Comment 29 Vassilii Khachaturov 2007-04-23 12:55:42 UTC
Me too. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=420214
for my asound.state, lspci, involved alsa-utils version etc.
 
$ cat /proc/asound/cards
 0 [ICH5           ]: ICH4 - Intel ICH5
                      Intel ICH5 with AD1981B at 0xe0000800, irq 209
Comment 30 Christian Esken 2007-06-11 00:12:28 UTC
Fixed for KDE4. SVN Revision 673714

I just put some days work in this issue. The real fix is really very, very complicated. Not only the mixer backend is involved - several GUI elements need to be touched, and the internal data structures must totally be reworked. I am sure that no 100 line patch will *really* fix all possible combinations. Thus the target milestone is KDE4.

If anybody has access to KDE4 (hint: KDE 4.0-alpha1 is too old), I would be very grateful for receiving test results. I'll keep this bug report open for now.
Comment 31 Christian Esken 2007-06-16 20:32:10 UTC
Update: All ALSA devices now work properly. As far as I see all kinds of combinations work now. Some "combined" or "common" can show up multiple times, but they are all operable.
Comment 32 Christian Esken 2007-06-17 16:00:41 UTC
SVN commit 676707 by esken:

Finalized optimal ALSA support. The last open issue (pswitch cswitch) is
now resolved.

BUGS: 123560
BUGS: 135729
BUGS: 126012
BUGS: 125772



 M  +30 -15    mdwslider.cpp  


--- trunk/KDE/kdemultimedia/kmix/mdwslider.cpp #676706:676707
@@ -234,22 +234,36 @@
 
 
 
-    // --- SLIDERS ---------------------------
-    QBoxLayout *volLayout;
-    if ( _orientation == Qt::Vertical ) {
-        volLayout = new QHBoxLayout( );
-        volLayout->setAlignment(Qt::AlignVCenter);
-    }
-    else {
-        volLayout = new QVBoxLayout(  );
-        volLayout->setAlignment(Qt::AlignHCenter);
-    }
-    sliLayout->addItem( volLayout );
+   // --- SLIDERS ---------------------------
+   QBoxLayout *volLayout;
+   if ( _orientation == Qt::Vertical ) {
+      volLayout = new QHBoxLayout( );
+      volLayout->setAlignment(Qt::AlignVCenter);
+   }
+   else {
+      volLayout = new QVBoxLayout(  );
+      volLayout->setAlignment(Qt::AlignHCenter);
+   }
+   sliLayout->addItem( volLayout );
 
-    if ( m_mixdevice->playbackVolume().count() > 0 )
-       addSliders( volLayout, 'p' );
-    if ( m_mixdevice->captureVolume().count() > 0 )
+   if ( m_mixdevice->playbackVolume().count() > 0 )
+      addSliders( volLayout, 'p' );
+   if ( m_mixdevice->captureVolume().count() > 0 )
        addSliders( volLayout, 'c' );
+   if ( m_mixdevice->playbackVolume().count() == 0 && m_mixdevice->captureVolume().count() == 0 )
+   {  // no siders => put a label with the name.
+      // But I won't add " (capture)" as on the sliders, because there is only one "column"
+      if ( _orientation == Qt::Vertical ) {
+         m_label = new VerticalText( this, m_mixdevice->readableName() );
+      }
+      else {
+         m_label = new QLabel(this);
+         static_cast<QLabel*>(m_label)->setText(m_mixdevice->readableName());
+      }
+      volLayout->addWidget( m_label );
+      m_label->installEventFilter( this );
+      m_label->setToolTip( m_mixdevice->readableName() );  // @todo: Whatsthis, explaining the device
+   }
 
    // --- RECORD SOURCE LED --------------------------
    if ( showRecordLED )
@@ -277,7 +291,8 @@
          reclayout->addWidget( m_recordLED );
          connect(m_recordLED, SIGNAL(stateChanged(bool)), this, SLOT(setRecsrc(bool)));
          m_recordLED->installEventFilter( this );
-         m_recordLED->setToolTip( i18n( "Record" ) );
+         QString muteTip( i18n( "Capture/Uncapture %1", m_mixdevice->readableName() ) );
+         m_recordLED->setToolTip( muteTip );  // @todo: Whatsthis, explaining the device
       } // has Record LED
       else
       {