【发布时间】:2018-07-13 23:04:59
【问题描述】:
我正在 Swift 和 AudioKit 中迈出第一步。我在操场上玩了一点。现在我正在尝试在 UIView 中绘制样本的波形。
我的代码不起作用。 UIView 保持空白。
@IBOutlet weak var audioOutputPlot: EZAudioPlot!
override func viewDidLoad() {
super.viewDidLoad()
let file = try! AKAudioFile(readFileName: "Sounds/drumloop_1.wav")
let player = try! AKAudioPlayer(file: file)
let plot = AKNodeOutputPlot(player, frame: audioOutputPlot.bounds)
plot.plotType = .buffer
plot.shouldFill = true
plot.shouldMirror = true
plot.color = UIColor.blue
audioOutputPlot.addSubview(plot)
}
我已将 @IBOutlet audioOutputPlot 与 UIView 与 Interface Builder 连接起来,并在其自定义类中编写了“EZAudioPlot”。
感谢您的帮助!
【问题讨论】:
标签: ios swift waveform audiokit