Hello! I am trying to schedule a MIDI event from a render callback and I would like to use @_noLocks
. I understand that it can't work out of the box, but I thought _unsafePerformance
would help, but it doesn't seem so.
Am I missing something? Here is a simplified code snippet:
@_noLocks
func test(schedule: AUScheduleMIDIEventBlock) {
var x: UInt8 = 0
_unsafePerformance {
schedule(0, 0, 3, &x)
}
}
func callTest() {
let sampler = AVAudioUnitSampler()
test(schedule: sampler.auAudioUnit.scheduleMIDIEventBlock!) ❌ // Called function is not known at compile time and can have unpredictable performance
}