[alsa-devel] sending a sequencer event to a delayed queue

Clemens Ladisch clemens at ladisch.de
Sun Mar 11 21:40:37 CET 2012

Henning Thielemann wrote:
> Clemens Ladisch schrieb:
>> Henning Thielemann wrote:
>>> Unfortunately the ALSA doc does not say, what happens if I send an event
>>> to a queue that is not running.
>> Exactly the same as with a running queue: the event stays in the client's
>> output buffer if its scheduled time has not yet been reached.
> I have attached a C program that demonstrates the effect: I start the
> "player" queue with one second delay and immediately send a message with
> a timestamp 0 that is meant to be the local time of the "player" queue.
> I expected that this event is delivered when the player queue starts,
> that is, one second after program start. But actually it is played
> immediately.

Yes; whether an event is delivered depends only on its scheduled time,
not whether the queue is running.

> If I choose a time larger than 0, say 1ns or 1s, then the
> event is not delivered at all.

Starting a queue also clears it.  (This is done explicitly in the code,
so I guess this is a feature.)

I'd suggest to use one queue for both kinds of events, and to add the
delay to the scheduled time.  To remove certain events, use


More information about the Alsa-devel mailing list