From: "Alfredo" <alfredo@vida-software.com>
To: "alsa-devel@lists.sourceforge.net" <alsa-devel@lists.sourceforge.net>
Subject: RE: Little question about ALSA callbacks
Date: Wed, 27 Jul 2005 13:21:08 +0200 [thread overview]
Message-ID: <e12dfbe9dfb85344939f51e03daf6a04@vida-software.com> (raw)
In-Reply-To: <s5hhdeglgvh.wl%tiwai@suse.de>
Thank you very much for your suggestions Takashi.
-----Original Message-----
From: Takashi Iwai [mailto:tiwai@suse.de]
Sent: miércoles, 27 de julio de 2005 10:48
To: Alfredo
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: [Alsa-devel] Little question about ALSA callbacks
At Wed, 27 Jul 2005 11:28:26 +0200,
Alfredo wrote:
>
> Hello, I have read the article ^[$B!H^[(BIntroduction to Sound
Programming with ALSA from Linux
> Journal. This article explains:
>
> // Starts here:
>
------------------------------------------------------------------------
-------------------------------------------
>
> ^[$B!H^[(BIn the previous examples, the PCM streams were operating in
blocking mode, that is,
> the calls would not return until the data had been transferred. In an
interactive
> event-driven application, this situation could lock up the application
for
> unacceptably long periods of time. ALSA allows opening a stream in
nonblocking mode
> where the read and write functions return immediately. If data
transfers are pending
> and the calls cannot be processed, ALSA returns an error code of
EBUSY.
>
> Many graphical applications use callbacks to handle events. ALSA
supports opening a
> PCM stream in asynchronous mode. This allows registering a callback
function to be
> called when a period of sample data has been transferred.^[$B!H^[(B
>
> // Finishes here:
>
------------------------------------------------------------------------
-------
>
> I^[.F^[N"m developing an event driven Linux server that will use ALSA
library. Please, could
> you point me to some resources in order to learn how to use alsa in
asynchronous mode
> (the event driven mechanism will be based in poll()).
>
> Clemens Ladisch helped me suggesting that I must use poll to wait for
events in
> different file descriptors. I need to be notified when audio buffer
has been recorded.
> I need to learn how to use ALSA in conjunction with poll.
The async mode described above uses a signal instead of poll, so this
is not a recommended way although it seems working on most of
architectures. Using poll is better.
If your app is a graphical one or do a heavy job (e.g. encoding)
together with a sound engine, you'll likely need a dedicated audio
thread for stability. In that case, consdering to use JACK would be a
good idea, too...
Takashi
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id\x16492&op=click
next prev parent reply other threads:[~2005-07-27 11:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-27 9:28 Little question about ALSA callbacks Alfredo
2005-07-27 9:48 ` Takashi Iwai
2005-07-27 11:21 ` Alfredo [this message]
2005-07-27 10:05 ` Joern Seger
2005-07-27 14:30 ` Alfredo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e12dfbe9dfb85344939f51e03daf6a04@vida-software.com \
--to=alfredo@vida-software.com \
--cc=alsa-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.