All of lore.kernel.org
 help / color / mirror / Atom feed
* volume PCM plugin
  2005-01-17 15:11 Problem closing device handle igor
@ 2005-01-17  9:17 ` Petr Gladkikh
  2005-01-17 10:43   ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Gladkikh @ 2005-01-17  9:17 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 855 bytes --]

Hello.

Here is the patch (for alsa-lib-1.0.7) which is another attempt 
(compare to coftvol plugin) to emulate volume control in alsa-lib (see 
my previous post). The volume plugin is based on copy PCM plugin.

IMO the approach which is used here would allow more flexible 
configurations than softvol. E.g. it allows bind to master volume 
control in addition to emulated volume control. If necessary the 
volume plugin allows to easily extend number of hooks which can be 
attached to it (for now only one is supported).

Sample configuration
pcm.vol {
     type volume
     slave {
	pcm some_plug
     }
     coeff 1.0
     hook {
         card default
         control Master
         index 0
     }
}

Note that
	1. 'hook' is optional.
	2. volume plugin does not convert PCM formats thus it is best used 
with 'plug' PCM plugin for example.

/Petr.

[-- Attachment #2: alsa-lib-1.0.7-softvol-pg.patch.bz2 --]
[-- Type: application/octet-stream, Size: 6436 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: volume PCM plugin
  2005-01-17  9:17 ` volume PCM plugin Petr Gladkikh
@ 2005-01-17 10:43   ` Takashi Iwai
  2005-01-17 11:16     ` Petr Gladkikh
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2005-01-17 10:43 UTC (permalink / raw)
  To: batyi; +Cc: alsa-devel

At Mon, 17 Jan 2005 15:17:36 +0600,
Petr Gladkikh wrote:
> 
> Hello.
> 
> Here is the patch (for alsa-lib-1.0.7) which is another attempt 
> (compare to coftvol plugin) to emulate volume control in alsa-lib (see 
> my previous post). The volume plugin is based on copy PCM plugin.

Thanks for the patch.

> IMO the approach which is used here would allow more flexible 
> configurations than softvol. E.g. it allows bind to master volume 
> control in addition to emulated volume control. If necessary the 
> volume plugin allows to easily extend number of hooks which can be 
> attached to it (for now only one is supported).

Handling with pthread looks nice.  The only concern is that I'm not
100% sure whether pthread works in every application.

As in my last reply, the other features can be easiply implemented in
softvol (the patch was attached there).  The multiple hooks are easy
to add as well.

So, for my eyes, only missing feature is the optimization of volume
control change via pthread and poll().  Although ioctl is relative
fast, it's of course better to eliminate to call at each time.
Maybe we can the behavior selectable via config option.
(The best optimization for this would be (read-only) mmap of
 contorls, but it's not implemented :)

IMO, adding multiple plugins which work almost identically is just
confusing.  Let's integrate them, instead.


Takashi


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: volume PCM plugin
  2005-01-17 10:43   ` Takashi Iwai
@ 2005-01-17 11:16     ` Petr Gladkikh
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Gladkikh @ 2005-01-17 11:16 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Takashi Iwai wrote:
> At Mon, 17 Jan 2005 15:17:36 +0600,

> Handling with pthread looks nice.  The only concern is that I'm not
> 100% sure whether pthread works in every application.
> As in my last reply, the other features can be easiply implemented in
> softvol (the patch was attached there).  The multiple hooks are easy
> to add as well.

Of course I do not suggest to make many such plugins. But I need some 
time to inspect your code (my day work is Windows/C++ :).

Thanks for response.
/Petr



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Problem closing device handle
@ 2005-01-17 15:11 igor
  2005-01-17  9:17 ` volume PCM plugin Petr Gladkikh
  0 siblings, 1 reply; 4+ messages in thread
From: igor @ 2005-01-17 15:11 UTC (permalink / raw)
  To: alsa-devel

Hello
I'm developing software which captures audio and plays it from multiple 
sources in parallel.
I'm using plughw:1,0 device to capture and plug:'dmix:SLAVE="hw:1,0"', 
everything works fine (i mean play and capture), but when i try to close 
capture handle -
snd_pcm_close(dev_handle)
i get following output:
ALSA lib pcm_hw.c:370:(snd_pcm_hw_hw_free) SNDRV_PCM_IOCTL_HW_FREE failed: 
File descriptor in bad state
ALSA lib pcm_plug.c:69:(snd_pcm_plug_close) plug slaves mismatch

(second error about slaves mismatch appears not in all situation). 
After some debugging i found out following - 
- this error occures only if i use playback (yes, playback, and error while 
trying to close capture handle). If i don't open playback device - it doesn't 
happens
- after this handle remains open, and i cannot open it again - if i close 
snd_pcm_close again, it finally closes, but it doesn't seems a nice solution
- it happens only when i use dmix plugin, when i use just plug plugin - 
everything is OK

Has anyone comments to this, is it some misconfiguration or something else?
Thanks


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-01-17 15:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-17 15:11 Problem closing device handle igor
2005-01-17  9:17 ` volume PCM plugin Petr Gladkikh
2005-01-17 10:43   ` Takashi Iwai
2005-01-17 11:16     ` Petr Gladkikh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.