ios - 从播放 MIDI 音符时自动运行的函数更新 UIViewControler 内标签的文本
问题描述
我的序列结构上有一个 callbackInstrument,每次播放 midi 音符时都会运行一个函数。在该函数中,我需要它来更新 PlayerPage UIViewControler 中的 ChordLabel.text。我不知道如何从该函数中访问该标签。谢谢你。
class PlayerPage: UIViewController {
@IBOutlet weak var ChordLabel: UILabel!
...
}
struct sequence{
let callbackInstr = MIDICallbackInstrument(callback: myCallBack(a:noteNumber:velocity:))
...
}
func myCallBack(a:UInt8, noteNumber: MIDINoteNumber, velocity: MIDIVelocity) -> () {
if noteNumber > 0 { // if noteOn
ChordLabel.text = noteNumber
}
}