swift – AKMIDIListener没有收到SysEx
发布时间:2020-12-14 05:30:27 所属栏目:百科 来源:网络整理
导读:我在一个类上使用AudioKit的AKMIDIListener协议来监听MIDI消息.这适用于标准消息,例如Note On,但SysEx消息不会通过. func receivedMIDINoteOn(noteNumber: MIDINoteNumber,velocity: MIDIVelocity,channel: MIDIChannel) { NSLog("Note On (noteNumber),(v
我在一个类上使用AudioKit的AKMIDIListener协议来监听MIDI消息.这适用于标准消息,例如Note On,但SysEx消息不会通过.
func receivedMIDINoteOn(noteNumber: MIDINoteNumber,velocity: MIDIVelocity,channel: MIDIChannel) { NSLog("Note On (noteNumber),(velocity),(channel)") // works perfectly } func receivedMIDISystemCommand(_ data: [MIDIByte]) { NSLog("SysEx (data)") // never triggers // More code to handle the messages... } SysEx消息从外部硬件或测试软件发送.我使用MIDI监控应用程序来确保正确发送消息,但在我的应用程序中,它们没有触发receivedMIDISystemCommand. 接收我错过的SysEx消息是否还需要其他步骤? 提前感谢任何线索.
编辑:感谢您引起我们的注意. SysEx接收问题现已在AudioKit:
https://github.com/AudioKit/AudioKit/pull/1017的开发分支中得到修复
– 代替 NSLog("SysEx (data)") 你有没有尝试过? if let sysExCommand = AKMIDISystemCommand(rawValue: data[0]) { print("MIDI System Command: (sysExCommand)") } AKMIDISystemCommand会将您的SysEx数据转换为更有用的东西,定义如下: public enum AKMIDISystemCommand: MIDIByte { /// Trivial Case of None case none = 0 /// System Exclusive case sysex = 240 /// Song Position case songPosition = 242 /// Song Selection case songSelect = 243 /// Request Tune case tuneRequest = 246 /// End System Exclusive case sysexEnd = 247 /// Clock case clock = 248 /// Start case start = 250 /// Continue case `continue` = 251 /// Stop case stop = 252 /// Active Sensing case activeSensing = 254 /// System Reset case sysReset = 255 } – matthew @ audiokit (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |