AudioKit 4.0.1 - 'AKSequencer' 类型的值没有成员 'avTracks'
AudioKit 4.0.1 - Value of type 'AKSequencer' has no member 'avTracks'
最近将 AudioKit
从 3.7.1 升级到 4.0.1 后,我的应用停止工作。
这是我的代码:
sequencer = AKSequencer(filename: myMidi)
for i in 0..<popCount {
//start Audio
sequencer!.avTracks[i].destinationAudioUnit = gPOPs[i].samplePlayer.samplerUnit
}
这是我收到的错误消息:
Value of type 'AKSequencer
' has no member 'avTracks
'
只是想知道是否有人可以帮助我了解发生了什么变化以及如何修复它。
编辑
还试过:
sequencer!.tracks[i].destinationAudioUnit = gPOPs[i].samplePlayer.samplerUnit
现在收到此错误消息:
Value of type 'AKMusicTrack
' has no member 'destinationAudioUnit
'
并试过:
sequencer!.tracks[i].internalMusicTrack = gPOPs[i].samplePlayer.samplerUnit
出现以下错误:
Cannot assign value of type 'AVAudioUnitSampler
' to type 'MusicTrack?
' (aka 'Optional<OpaquePointer>
')
抱歉,这从未在 AudioKit 核心团队的关注范围内结束。看起来你确实用 audiokit 哈希标签正确地问了这个问题。无论如何,从 3.7->4.0 开始,我们简化了音序器,并将您使用的功能移到了 AKMIDIPlayer 中:
https://github.com/AudioKit/AudioKit/blob/master/AudioKit/Common/MIDI/AKMIDIPlayer.swift
如果您使用它并参考 "tracks" 而不是 avTracks,您应该一切顺利。
感谢 Aure 的输入,这帮助我找到了解决这个问题的方法。和 this post on Google Groups 一样。特别是 Michael Hill 的最后评论。
这是对我的方法的更新(经过编辑和简化以仅显示必要的部分):
var MIDISamplePlayer = AKMIDISampler()
var sequencer: AKSequencer?
var mixer: AKMixer!
// initialise the mixer
mixer = AKMixer()
do {
audiofile = try AKAudioFile(readFileName: SoundFilename as! String,
baseDir: .resources)
} catch let error as NSError {
print("There's an error: \(error)")
}
do {
try sprite.MIDISamplePlayer.loadAudioFile(audiofile)
} catch let error as NSError {
print("There's an error: \(error)")
}
sprite.tracker = AKAmplitudeTracker(sprite.MIDISamplePlayer)
mixer.connect(to:sprite.tracker, bus: mixer.nextInput.bus)
sequencer = AKSequencer(filename: POPmidi)
sequencer?.enableLooping()
let midi = AKMIDI()
for i in 0..<popCount {
gPOPs[i].MIDISamplePlayer.enableMIDI(midi.client, name: "MIDISample_\(i)")
mixer.connect(gPOPs[i].MIDISamplePlayer)
sequencer!.tracks[i].setMIDIOutput(gPOPs[i].MIDISamplePlayer.midiIn)
}
AudioKit.start()
sequencer!.play()
现在一切正常,但我一直在播放神秘的正弦波音调。我找不到它的来源?任何有关调试的帮助都将是救命稻草!谢谢
最近将 AudioKit
从 3.7.1 升级到 4.0.1 后,我的应用停止工作。
这是我的代码:
sequencer = AKSequencer(filename: myMidi)
for i in 0..<popCount {
//start Audio
sequencer!.avTracks[i].destinationAudioUnit = gPOPs[i].samplePlayer.samplerUnit
}
这是我收到的错误消息:
Value of type '
AKSequencer
' has no member 'avTracks
'
只是想知道是否有人可以帮助我了解发生了什么变化以及如何修复它。
编辑
还试过:
sequencer!.tracks[i].destinationAudioUnit = gPOPs[i].samplePlayer.samplerUnit
现在收到此错误消息:
Value of type '
AKMusicTrack
' has no member 'destinationAudioUnit
'
并试过:
sequencer!.tracks[i].internalMusicTrack = gPOPs[i].samplePlayer.samplerUnit
出现以下错误:
Cannot assign value of type '
AVAudioUnitSampler
' to type 'MusicTrack?
' (aka 'Optional<OpaquePointer>
')
抱歉,这从未在 AudioKit 核心团队的关注范围内结束。看起来你确实用 audiokit 哈希标签正确地问了这个问题。无论如何,从 3.7->4.0 开始,我们简化了音序器,并将您使用的功能移到了 AKMIDIPlayer 中:
https://github.com/AudioKit/AudioKit/blob/master/AudioKit/Common/MIDI/AKMIDIPlayer.swift
如果您使用它并参考 "tracks" 而不是 avTracks,您应该一切顺利。
感谢 Aure 的输入,这帮助我找到了解决这个问题的方法。和 this post on Google Groups 一样。特别是 Michael Hill 的最后评论。
这是对我的方法的更新(经过编辑和简化以仅显示必要的部分):
var MIDISamplePlayer = AKMIDISampler()
var sequencer: AKSequencer?
var mixer: AKMixer!
// initialise the mixer
mixer = AKMixer()
do {
audiofile = try AKAudioFile(readFileName: SoundFilename as! String,
baseDir: .resources)
} catch let error as NSError {
print("There's an error: \(error)")
}
do {
try sprite.MIDISamplePlayer.loadAudioFile(audiofile)
} catch let error as NSError {
print("There's an error: \(error)")
}
sprite.tracker = AKAmplitudeTracker(sprite.MIDISamplePlayer)
mixer.connect(to:sprite.tracker, bus: mixer.nextInput.bus)
sequencer = AKSequencer(filename: POPmidi)
sequencer?.enableLooping()
let midi = AKMIDI()
for i in 0..<popCount {
gPOPs[i].MIDISamplePlayer.enableMIDI(midi.client, name: "MIDISample_\(i)")
mixer.connect(gPOPs[i].MIDISamplePlayer)
sequencer!.tracks[i].setMIDIOutput(gPOPs[i].MIDISamplePlayer.midiIn)
}
AudioKit.start()
sequencer!.play()
现在一切正常,但我一直在播放神秘的正弦波音调。我找不到它的来源?任何有关调试的帮助都将是救命稻草!谢谢