From: "Ryan Cassidy" <rcassidy@stanford.edu>
To: 'Jaroslav Kysela' <perex@suse.cz>
Cc: 'Paul Davis' <paul@linuxaudiosystems.com>,
alsa-devel@lists.sourceforge.net
Subject: RE: Interrupt-driven (or callback/handler?), Full-duplex (simultaneous capture/playback) without using JACK
Date: Mon, 10 Nov 2003 02:57:37 -0800 [thread overview]
Message-ID: <000601c3a779$752cfd70$264440ab@roboserv1> (raw)
In-Reply-To: <Pine.LNX.4.53.0311090927040.3073@pnote.perex-int.cz>
Many thanks for the info.!
I guess my follow-up question would be this: I want to implement
non-busy waiting for alsa simultaneous audio playback/capture. If I
call the blocking versions of snd_pcm_read/snd_pcm_write in a separate
process (that I fork off from the main application), will the read/write
process yield to the main application process during the blocking
read/write (i.e. will it got to sleep waiting for i/o?)?
Cheers, rjc.
--
Ryan Cassidy
Electrical Engineering Graduate Student, CCRMA Researcher
Stanford University
E-mail: ryanc@ieee.org
> -----Original Message-----
> From: alsa-devel-admin@lists.sourceforge.net [mailto:alsa-devel-
> admin@lists.sourceforge.net] On Behalf Of Jaroslav Kysela
> Sent: Sunday, November 09, 2003 12:38 AM
> To: Ryan Cassidy
> Cc: 'Paul Davis'; alsa-devel@lists.sourceforge.net
> Subject: RE: [Alsa-devel] Interrupt-driven (or callback/handler?),
Full-
> duplex (simultaneous capture/playback) without using JACK
>
> On Sat, 8 Nov 2003, Ryan Cassidy wrote:
>
> > > the ALSA PCM API doesn't have "handlers". it doesn't provide any
kind
> > > of callback mechanism. what it does do is to provide a poll(2)
> > > interface, allowing callback-like mechanisms to be built around it
> > > (like JACK).
> > >
> >
> > Will snd_async_add_pcm_handler() not do the trick? It says
> > "asynchronous," which doesn't sound like what I want, but the
"handler"
> > part sounds promising :).
> >
> > If that doesn't work, it's sort of a bummer that ALSA doesn't offer
a
> > callback-mechanism for simultaneous audio i/o, non? This means that
to
> > get "what I want" (i.e. allowing my program to do useful work while
> > waiting for new audio samples), I need to use snd_pcm_wait() and
fork
> > off an extra process to do the "useful work," right?
>
> Yes, snd_async_add_pcm_handler() might help you and it works. It's
> originated in the interrupt handler. But please note that the handler
is
> in the unix style signal callback thus there are many restrictions
(you
> should avoid to do most of syscalls in this code etc.).
>
> But for mmaped access and the standard ALSA transfer mechanism (use
only
> snd_pcm_avail_update() to get the right position) it is the fast way
to
> create an interrupt based handlers in the applications.
>
> For the synchronization: You must do it in your application. We work
with
> two diferrent streams and although the streams are hardware
synchronized,
> there might be some buffering issues (FIFOs) so the playback and
capture
> pointers do not match exactly. So the best way is to obtain the
current
> pointer using snd_pcm_avail_update() and compute how many frames you
can
> process for the duplex operation (I mean for both streams).
>
> For a playback example, you might look to alsa-lib/test/pcm.c - see
> the async_callback() function contents.
>
> Jaroslav
>
> -----
> Jaroslav Kysela <perex@suse.cz>
> Linux Kernel Sound Maintainer
> ALSA Project, SuSE Labs
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: ApacheCon 2003,
> 16-19 November in Las Vegas. Learn firsthand the latest
> developments in Apache, PHP, Perl, XML, Java, MySQL,
> WebDAV, and more! http://www.apachecon.com/
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/alsa-devel
-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
next prev parent reply other threads:[~2003-11-10 10:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-09 0:18 Interrupt-driven (or callback/handler?), Full-duplex (simultaneous capture/playback) without using JACK Ryan Cassidy
2003-11-09 3:42 ` Paul Davis
2003-11-09 4:33 ` Ryan Cassidy
2003-11-09 8:37 ` Jaroslav Kysela
2003-11-10 10:57 ` Ryan Cassidy [this message]
2003-11-10 11:05 ` Jaroslav Kysela
2003-11-10 12:26 ` Paul Davis
2003-12-30 1:57 ` Ryan Cassidy
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='000601c3a779$752cfd70$264440ab@roboserv1' \
--to=rcassidy@stanford.edu \
--cc=alsa-devel@lists.sourceforge.net \
--cc=paul@linuxaudiosystems.com \
--cc=perex@suse.cz \
/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.