Skip to contentSkip to conversation

ctl_elems hooks with dmix plugin

DISCUSSION George Kuriakose 2 participants 5 messages Sep 22, 2009 – Sep 28, 2009

lore
Share & tools
lore
#0 lore raw

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? Thanks
George

asoundrc:

pcm.softvol0 {
    type            softvol
    slave {
        pcm         "dmix:1"
    }
    control {
        name        "SoftControl0"
        card        1
    }
}
pcm.softvol1 {
    type            softvol
    slave {
        pcm         "dmix:1"
    }
    control {
        name        "SoftControl1"
        card        1
    }
}

pcm.s0 {
    type plug
    slave.pcm "softvol0"
}

pcm.s1 {
    type plug
    slave.pcm "softvol1"
}

pcm.s1hook {
        type hooks              # PCM with hooks slave.pcm "s1"
        hooks.0 {
                type ctl_elems
                hook_args [
                        {
                                name "SoftControl0" preserve true lock true optional true value [ 0 ] }
            {
                                name "SoftControl1" preserve true lock true optional true value [ 100 ] }
                ]
        }
}

#1 lore raw

At Wed, 23 Sep 2009 00:55:54 +0530,

Quoted 9 lines · George Kuriakose

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.

Takashi

#2 lore raw

At Thu, 24 Sep 2009 10:05:57 +0200,

Quoted 13 lines · I wrote:

At Wed, 23 Sep 2009 00:55:54 +0530,

Quoted 9 lines · George Kuriakose

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?

Quoted 3 lines

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

---

src/pcm/pcm_direct.c +4 -1
index 82cc126..d9e596e 100644
@@ -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;
#3 lore raw
Quoted 3 lines

Could you try the patch below?

It works !!!
Thanks

George

#4 lore raw

At Mon, 28 Sep 2009 11:16:22 +0530,

Quoted 10 lines · George Kuriakose
Quoted 4 lines

Could you try the patch below?

It works !!!
Thanks

George

Good to hear. Now the patch is merged to GIT tree.

thanks,

Takashi