The ALSA MIDI sequencer API defines snd_seq_queue_status_get_tick_time
, which allows to get a current tempo based time of a running MIDI queue.
I could periodically poll this information, but feel it would be cleaner to receive time events from the queue, either tempo based or not, callback based would be as much fine.
Is there a way to be notified of time events of a MIDI queue with ALSA sequencer, periodically and without polling?
— Edit —
When I said “polling”, I meant using a SIGALRM
signal handler and a timer of a small enough resolution (1/50 seconds).
If you want to be notified at a specific time, schedule an event to be sent to yourself at that time.
For example, arecordmidi does this to synchronize the playback of its metronome pattern.