On 5/3/05, Garett Shulman <shulmang(a)colorado.edu> wrote:
Hello, About 5 years ago I hacked together a nice midi
looper app. The
only problem is that it was for Windows. Anyway... I'm working towards
reimplamenting the app in linux. Basically, I have a circular linked
list of midi events. Each node has the event and the time to the next
event. In Windows there was a timeSetEvent function. I pass this
function the time_to_next_event,
function_to_call_after_time_to_next_event, and
data_to_pass_to_function. The function_to_call_after_time_to_next_event
just outputs the event and then calls timeSetEvent with the next nodes
data. I'm curious as to how others would implament something similar in
linux. Perhaps as a thread with sleep call? Is there a high resolution
sleep function? Any ideas? Thanks. -Garett
Are you using the ALSA sequencer API? If so, I believe it handles
timing for you. Each event contains a timestamp, so I assume that
when you send an event, the sequencer core dispatches it at the proper
time. I never tried it though; my apps only receive events. If
you're not using ALSA, may I ask why?
Can anybody confirm my understanding of the sequencer API?