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

_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to