All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerald Grabner <gerald.grabner@gmx.net>
To: alsa-devel@lists.sourceforge.net
Subject: quit snd_pcm_readi, retrieve pending frames
Date: Sat, 13 May 2006 13:06:51 +0200	[thread overview]
Message-ID: <4465BDCB.7010900@gmx.net> (raw)

Hi,

I'm experimenting with the ALSA PCM API and was wondering whether
there is a simple way to exit a record loop by stopping the pcm, but
without loosing pending frames.

Initially, I was thinking of something like this, where I would call
snd_pcm_drop(pcm) from some other thread:

   while ( true )
     {
       r = snd_pcm_readi (pcm, data, frames);
       fwrite (data, 2, 2*r, file);
       if ( r != frames )
         break;
     }

However, snd_pcm_drain(pcm) doesn't work here; the loop continues.
snd_pcm_drop(pcm) breaks the loop, but pending frames are lost, and
r=-EBADFD.

Is there an easy way to stop snd_pcm_readi in a way that I can
retrieve the residual frames? Do I need to set any parameters for
that purpose?

Many thanks,
Gerald

BTW: I'm using alsa 1.0.11 on gentoo.


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

             reply	other threads:[~2006-05-13 11:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-13 11:06 Gerald Grabner [this message]
2006-05-14 13:07 ` quit snd_pcm_readi, retrieve pending frames Clemens Ladisch
2006-05-15 10:06 ` Takashi Iwai
2006-05-17 15:08   ` Takashi Iwai
2006-05-19 21:17     ` Gerald Grabner
2006-05-20 13:07       ` Takashi Iwai
2006-05-20 18:46         ` Gerald Grabner
2006-05-22 10:41           ` Takashi Iwai
2006-05-22 16:28             ` Takashi Iwai
2006-06-04 11:51             ` Gerald Grabner

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=4465BDCB.7010900@gmx.net \
    --to=gerald.grabner@gmx.net \
    --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.