0
私はこのコードで自分のアプリケーションを実行すると、私は時々、エラーコードを持っている:おそらくポインタエラーミディのSysEx
let letstryOtherThing: @convention(c) (UnsafeMutablePointer<MIDISysexSendRequest>) -> Swift.Void =
{ plop in
print("here")
}
let rawPointer = UnsafeRawPointer([0xF0, 0x20, 0x21, 0x22, 0x23, 0xF7])
let pointer = rawPointer.assumingMemoryBound(to: UInt8.self)
let bytesToSend: UInt32 = 60
let complete: DarwinBoolean = false
let completionProc: MIDICompletionProc? = letstryOtherThing
let completionRefCon: UnsafeMutableRawPointer? = nil
let data: UnsafePointer<UInt8> = pointer
let destination: MIDIEndpointRef = dest!
let reserved: (UInt8, UInt8, UInt8) = (0, 0 ,0)
var midiRequest:MIDISysexSendRequest = MIDISysexSendRequest(destination: destination, data: data, bytesToSend: bytesToSend, complete: complete, reserved: reserved, completionProc: completionProc!, completionRefCon: completionRefCon)
DispatchQueue.main.async(execute: {
MIDISendSysex(&midiRequest)
})
コードは次のとおりです。
EXC_BAD_ACCESS(コード= 1、アドレス= 0x800000020) 。
私は、誰かがアイデアを持っている場合は、ライブラリCoreMidiを使用します。