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

Henning Thielemann alsa at henning-thielemann.de
Sat Mar 10 19:20:30 CET 2012

Unfortunately the ALSA doc does not say, what happens if I send an event 
to a queue that is not running. I expected that the event is being 
delivered once the queue is started. But it seems that instead the event 
is dropped. What is the reason for that behaviour?

  What I want to do is the following: I have a program that computes a 
sequence of events in real-time. Since computation of an event requires 
varying amount of time, I want to add a latency in order to get a 
correctly timed output. To this end I set up two queues: One queue 
triggers computation of events via Echo messages and the other queue 
delivers the computed events. I want to use the same time stamps for both 
queues and just start the queues with a delay between them.
  Why is it not possible to use one queue and add latency manually to the 
timestamps? Because the user of the program shall be able to halt the 
computation. Thus the computation must be halted first and the delivery of 
events must be halted later. I cannot achieve this with one queue and a 
queue_stop command.
  Now the problem is: When my program starts it computes the first event 
and sends it to the second (delayed) queue. But since this queue is 
started only after a delay, it is not yet running and thus my event is not 
delayed, but lost. :-( How to solve that problem? Is there a proposed way 
to manage latency in ALSA sequencing?


More information about the Alsa-devel mailing list