AKMIDIListener没有收到SysEx

时间:2017-07-31 10:28:32

标签: swift midi coremidi audiokit sysex

我在类上使用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消息是否还需要其他步骤?

提前感谢任何线索。

1 个答案:

答案 0 :(得分:0)

编辑:感谢您引起我们的注意。现在,在AudioKit的开发分支中修复了SysEx接收问题: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