Re: [linux-audio-dev] Sequencers & scheduling

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] Sequencers & scheduling
From: David Slomin (david.slomin_AT_av.com)
Date: ma tammi  10 2000 - 13:25:34 EST


Paul Winkler wrote:
>
> How do you handle the timing of events in the output?
> I can think of only two general approaches...

I've only thought about it, not implemented it, so take this with a
grain of salt: What about a combination of the two?

I assume the existence of an alarm() style system, although this is
probably not accurate enough for the MuCoS folks. :-)

Use the sorted queue, but don't poll it. The queue lists time in
beats, not absolute. Set the alarm for the first event in the queue
by computing the absolute time for it based on current tempo. When
you reach it, do the same for the next event in the queue.

On every note/event insert, if the new one would be inserted at the
head of the queue, abort the current alarm (you can do this
automatically with the conventional signal-based system, or with a
little more effort if you're rolling your own with threads and sleep)
and set a new alarm for the newly inserted note/event.

Tempo changes are treated as events like in MIDI, so you can either
schedule them ahead, or use them in realtime by setting their
scheduled timestamp to the current time. As described in the
preceding paragraph, this aborts the current alarm, the tempo event
executes immediately, and the previous first-in-queue gets its time
recomputed according to the new tempo.

Sound good?
Div.


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:23:26 EST