(bind-func available_midi_events
(lambda ()
(let ((head (dequeue_midi_event.head:i64))
(tail (enqueue_midi_event.tail:i64)))
(if (< (+ head XTM_MIDI_EVENT_QUEUE_SIZE) tail)
(begin (println "Warning: MIDI overrun - dropping old events")
(dequeue_midi_event.head:i64 tail)
0)
(- tail head)))))