[alsa-devel] Why does snd_seq_drain_output() need lots of time to execute?

Fons Adriaensen fons at linuxaudio.org
Fri Jan 27 14:56:38 CET 2012

On Fri, Jan 27, 2012 at 02:28:42PM +0100, Rafał Cieślak wrote:
> > If you manage to fill a 500-event buffer, could that mean that
> > you are sending events a long time ahead of their due time ?
> No, I'm not buffering a whole song, events are send at most a second
> or two ahead (for each bar). The reason why there may be so many of
> them, is that I emulate smooth movement of control parameters (just as
> if one was slowly moving a slider/knob on an external MIDI
> controller), which requires lots of events, and the problem starts
> when I try to do the same for many different controllers/channels
> independently.

I see. MIDI isn't really up to this sort of thing... The receiver
can be expected to smooth the controller values, but since this is
unspecified you don't know how many are needed.
> Also, it turned out that actually snd_seq_set_client_pool_output()
> does work, unless I try to set it to anything greater then 2000. Is
> this a hard-coded limit, or can I somehow increase it even more?

Don't know...

2000 events/s would be close to what a hardware MIDI interface can
handle anyway - that could be your next problem.

OTOH, you could reduce the update period to 1/4 second or so. That
should be no problem if you use a RT thread to do it - we're using
much shorter periods for audio. 



Vor uns liegt ein weites Tal, die Sonne scheint - ein Glitzerstrahl.

More information about the Alsa-devel mailing list