From: Takashi Iwai Subject: Re: [PATCH] [SOUND] recording gain control Date: Tue, 10 Mar 2009 13:59:18 +0100 Message-ID: References: <49B5F8F5.8040100@einfochips.com> <49B62C1D.4080509@ladisch.de> <49B65B96.5080108@einfochips.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx1.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id 4AD711037EB for ; Tue, 10 Mar 2009 13:59:19 +0100 (CET) In-Reply-To: <49B65B96.5080108@einfochips.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Viral Mehta Cc: Clemens Ladisch , alsa-devel@alsa-project.org, Linux audio dev , linux-kernel@vger.kernel.org List-Id: alsa-devel@alsa-project.org At Tue, 10 Mar 2009 17:52:46 +0530, Viral Mehta wrote: > > Takashi Iwai wrote: > > At Tue, 10 Mar 2009 10:00:13 +0100, > > Clemens Ladisch wrote: > > > >> (CC alsa-devel) > >> > >> Viral Mehta wrote: > >> > >>> Hi, > >>> > >>> I am trying to do gain control while RECORDING for my Audio Mic device. > >>> > >>> My application opens /dev/mixer device and calls ioctl(fdmixer, > >>> MIXER_WRITE(SOUND_MIXER_MIC), ...) > >>> > >>> But, the call fails. It traces to sound/core/oss/mixer_oss.c file and > >>> snd_mixer_oss_put_volume1() function. > >>> It never falls in "if (slot->present & SNDRV_MIXER_OSS_PRESENT_CVOLUME)" > >>> as condition "if (slot->present & SNDRV_MIXER_OSS_PRESENT_PVOLUME) " > >>> comes as false. > >>> > >>> I think there is a bug in kernel and I think it should be like as below, > >>> > >>> --- sound/core/oss/mixer_oss.c 2008-12-03 13:24:02.000000000 +0530 > >>> +++ sound/core/oss/mixer_oss.c 2009-03-09 16:22:06.548766896 +0530 > >>> @@ -688,7 +688,7 @@ static int snd_mixer_oss_put_volume1(str > >>> > >>> if (slot->present & SNDRV_MIXER_OSS_PRESENT_PVOLUME) { > >>> snd_mixer_oss_put_volume1_vol(fmixer, pslot, > >>> slot->numid[SNDRV_MIXER_OSS_ITEM_PVOLUME], left, right); > >>> - if (slot->present & SNDRV_MIXER_OSS_PRESENT_CVOLUME) > >>> + } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_CVOLUME) { > >>> snd_mixer_oss_put_volume1_vol(fmixer, pslot, > >>> slot->numid[SNDRV_MIXER_OSS_ITEM_CVOLUME], left, right); > >>> } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GVOLUME) { > >>> snd_mixer_oss_put_volume1_vol(fmixer, pslot, > >>> slot->numid[SNDRV_MIXER_OSS_ITEM_GVOLUME], left, right); > >>> > >> Your mailer mangled the patch; see linux/Documentation/email-clients.txt. > >> > > > > Also, the current code behaves intentionally so (as it's designed for > > mic-loopback volume). > > > > A more feasible fix would be to add another if check for *_CVOLUME > > instead of moving it. > > > > > > > Oh okie. It makes sense. > I just sent out a patch on LAD. Should I resubmit with what you proposed ? LAD is no good place for sending a patch of sound driver. Please post to alsa-devel ML (and add Cc to me). thanks, Takashi