I am trying to play midi notes with help of sf2 files using AUSampler audio unit. I was able to start and stop note fine using MusicDeviceMIDIEvent function as below.
noteCommand = kMIDIMessage_NoteOn << 4 | 0;
MusicDeviceMIDIEvent (samplerUnit, noteCommand, note, velocity, 0);
The note stops after sometime even if I don't call MusicDeviceMIDIEvent function with NoteOff message.
Is there any way to get this note play on until I call the MusicDeviceMIDIEvent with NoteOff? or should the sf2 file be created in a different way so that it contains different sound files for note attack, note sustain etc and the AUSampler unit automatically takes care of playing the sustain sound till NoteOff is called?
Thanks.