From: Takashi Iwai <tiwai@suse.de>
To: bownie@bownie.com
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: ALSA sequencer input buffer
Date: Thu, 25 Apr 2002 14:34:24 +0200 [thread overview]
Message-ID: <s5hbsc8are7.wl@alsa2.suse.de> (raw)
In-Reply-To: <200204251211.AFT92055@msgdirector2.onetel.net.uk>
Hi Richard,
At Thu, 25 Apr 2002 13:08:15 +0100,
Richard Bown wrote:
>
> Hi,
>
> Is it correct that an app should have to snd_seq_drop_input_buffer() every
> so often when reading events in via snd_seq_event_input()?
>
> If I don't drop the input buffer periodically then the input buffer appears
> eventually to clog up - only allowing a few events through at a time. Whilst
> the number of events received by the app becomes severely limited it still
> just about continues to work. Is there an easy explanation for this behaviour?
no, you shouldn't drop input events. otherwise the input events will
be really lost.
if the events are on input buffer (this can be checked by
snd_seq_event_input_pending), then process all these events in a
loop. (i guess you call snd_seq_event_input only once in poll
handler.)
on blocking mode, a typical code would be like this.
while (snd_seq_event_input_pending(handle, 1) > 0) {
if (snd_seq_event_input(handle, &ev) < 0)
error;
do_something;
}
this will feed events from the sequencer core to the buffer when the
buffer becomes empty. please note that snd_seq_event_input_pending()
won't block even if no events exist but returns immediately.
on non-blocking mode, you can use simply snd_seq_event_input() loop.
while (snd_seq_event_input(handle, &ev) >= 0) {
do_something;
}
Takashi
next prev parent reply other threads:[~2002-04-25 12:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-24 18:35 [PATCH] configure prob with MDK82 kernel Tom Prado
2002-04-24 18:54 ` Thierry Vignaud
2002-04-24 20:47 ` Tom Prado
2002-04-25 8:05 ` BrookTree Bill Merrill
2002-05-04 22:08 ` BrookTree Ville Syrjälä
2002-04-25 12:08 ` ALSA sequencer input buffer Richard Bown
2002-04-25 12:34 ` Takashi Iwai [this message]
2002-04-25 12:45 ` Richard Bown
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=s5hbsc8are7.wl@alsa2.suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@lists.sourceforge.net \
--cc=bownie@bownie.com \
/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.