* opening a device multiple times?
@ 2011-06-29 11:47 Ákos Maróy
2011-06-29 12:13 ` James Courtier-Dutton
0 siblings, 1 reply; 2+ messages in thread
From: Ákos Maróy @ 2011-06-29 11:47 UTC (permalink / raw)
To: alsa-devel
Hi,
I'm writing a piece of code that uses ALSA audio devices, where I open
the same output device multiple times, as a simple way to have parallel
audio channels, where I can send audio data to each 'channel' (PCM
handle) simultaneously, and the ALSA layer will mix the audio together.
My experience is that this works with some audio devices (for example,
with a pulse audio - ALSA gateway), but not on some other devices (for
example, on a USB sound device, driven by ALSA). In the latter case,
snd_pcm_open() will refuse to open the audio device multiple times.
I wonder what the generic concept here is - is it generally 'OK' to open
an audio device multiple times? If not, why not? :)
Akos
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: opening a device multiple times?
2011-06-29 11:47 opening a device multiple times? Ákos Maróy
@ 2011-06-29 12:13 ` James Courtier-Dutton
0 siblings, 0 replies; 2+ messages in thread
From: James Courtier-Dutton @ 2011-06-29 12:13 UTC (permalink / raw)
To: Ákos Maróy; +Cc: alsa-devel
On 29 June 2011 12:47, Ákos Maróy <akos@maroy.hu> wrote:
> Hi,
>
> I'm writing a piece of code that uses ALSA audio devices, where I open
> the same output device multiple times, as a simple way to have parallel
> audio channels, where I can send audio data to each 'channel' (PCM
> handle) simultaneously, and the ALSA layer will mix the audio together.
>
> My experience is that this works with some audio devices (for example,
> with a pulse audio - ALSA gateway), but not on some other devices (for
> example, on a USB sound device, driven by ALSA). In the latter case,
> snd_pcm_open() will refuse to open the audio device multiple times.
>
> I wonder what the generic concept here is - is it generally 'OK' to open
> an audio device multiple times? If not, why not? :)
>
It depends on the hardware.
The pulse audio is software, and supports multi open.
Some sound cards can only handle one PCM stream, others can handle
more. e.g. 32 opens before it fails.
If you are writing an application now, it is probably better to write
to the pulse audio API as this is present on most Linux desktops now,
and it has some extra features.
Pulse Audio then talks to ALSA and the hardware.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-06-29 12:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-29 11:47 opening a device multiple times? Ákos Maróy
2011-06-29 12:13 ` James Courtier-Dutton
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.