From: Takashi Iwai Subject: Re: ctl_elems hooks with dmix plugin Date: Thu, 24 Sep 2009 11:31:34 +0200 Message-ID: References: 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 (cantor.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id 8988710387C for ; Thu, 24 Sep 2009 11:31:34 +0200 (CEST) In-Reply-To: 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: George Kuriakose Cc: alsa-user@lists.sourceforge.net, alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Thu, 24 Sep 2009 10:05:57 +0200, I wrote: > > At Wed, 23 Sep 2009 00:55:54 +0530, > George Kuriakose wrote: > > > > Hi > > I was trying to use ctl_elems hooks with dmix plugin but figured that > > this combination doesn't work. Is there any workaround for this. > > I am trying the following. > > There are two softvol devices s0 and s1 going through dmix plugins. > > I wan't to mute s0 when any app opens s1 and unmute s0 when s1 is closed. > > I am using the below asoundrc file which results in "No card for this PCM" . > > Any workarounds or any minor change in libasound which will make this work? > > Currently hook plugin doesn't work with dmix/dsnoop. The problem is > that it doesn't inherit the result of snd_pcm_info() from the slave > PCM. It'd be not too difficult to make it working, though, I guess. Could you try the patch below? Takashi --- diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c index 82cc126..d9e596e 100644 --- a/src/pcm/pcm_direct.c +++ b/src/pcm/pcm_direct.c @@ -591,7 +591,10 @@ int snd_pcm_direct_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned in int snd_pcm_direct_info(snd_pcm_t *pcm, snd_pcm_info_t * info) { - // snd_pcm_direct_t *dmix = pcm->private_data; + snd_pcm_direct_t *dmix = pcm->private_data; + + if (dmix->spcm && !dmix->shmptr->use_server) + return snd_pcm_info(dmix->spcm, info); memset(info, 0, sizeof(*info)); info->stream = pcm->stream;