Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get MusicSequence callback from MIDI Playback

I currently have a MusicPlayer which contains a MusicSequence with a set of MusicTracks that hold MIDI information. What I want is to know when a MIDI Note starts reproducing and when it ends, something like a listener of the playback of the MIDI.

I was looking and think of maybe using MusicSequenceSetUserCallback but I don't really know how would that work. Anybody has an idea on how to accomplish this?

like image 220
fdiaz Avatar asked Mar 14 '26 20:03

fdiaz


1 Answers

There's a tutorial on how to capture midi events from a MusicSequence here (such as note on/off): http://www.deluge.co/?q=midi-driven-animation-core-audio-objective-c

In brief, the method is to call MIDIDestinationCreate to create your own MIDI endpoint to handle the MIDI messages, and then point your MusicSequence at it with MusicSequenceSetMIDIEndpoint.

like image 181
Rich Avatar answered Mar 17 '26 04:03

Rich