0

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).

Hibou57
  • 6,870
  • 6
  • 52
  • 56

1 Answers1

2

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.

CL.
  • 173,858
  • 17
  • 217
  • 259
  • I did think of it later, but was afraid of flooding the queue, as one use case is for displaying the current playback position (another is for playing a metronome, and this one is less likely to end into a flooded queue). I like your answer, but will wait before selecting it as my favorite answer. – Hibou57 Jun 06 '15 at 08:02
  • There does not seems to be another way, finally. – Hibou57 Jun 08 '15 at 04:38