我正在尝试通过加载CMP_GrandPiano.sf2文件播放MIDI音符,但问题是,它听起来是相同的音符(无论Octave音符)每次都意味着它没有产生正确的音符声音。请任何人都可以帮助我把它整理出来?
id connectionToken = [deviceManager connectInput:source
error:error
eventHandler:^(MIKMIDISourceEndpoint *source,
NSArray *command) {
__strong MIKMIDIEndpointSynthesizer *strongSelf = weakSelf;
[strongSelf handleMIDIMessages:commands];
}];
方法:
- (void)handleMIDIMessages:(NSArray *)commands {
for (MIKMIDICommand *command in commands) {
OSStatus err = MusicDeviceMIDIEvent(self.instrumentUnit,
command.statusByte,
command.dataByte1,
command.dataByte2,
0);
}
}