gpt4 book ai didi

ios - AudioKit 崩溃 : required condition is false: ! destNodeMixerConns.empty() && !isDestNodeConnectedToIONode

转载 作者:行者123 更新时间:2023-12-04 20:27:07 28 4
gpt4 key购买 nike

我们的项目遇到了一个异常:

2019-08-08 10:18:28.703708-0600 AppName[99385:5069475] *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: !destNodeMixerConns.empty() && !isDestNodeConnectedToIONode'
*** First throw call stack:
(
0 CoreFoundation 0x000000010ee2e8db __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000010e21bac5 objc_exception_throw + 48
2 CoreFoundation 0x000000010ee2e662 +[NSException raise:format:arguments:] + 98
3 AVFAudio 0x0000000111b94dbc _Z19AVAE_RaiseExceptionP8NSStringz + 156
4 AVFAudio 0x0000000111bf3937 _Z11_AVAE_CheckPKciS0_S0_b + 295
5 AVFAudio 0x0000000111b8cb8f _ZN18AVAudioEngineGraph8_ConnectEP19AVAudioNodeImplBaseS1_jjP13AVAudioFormat + 1031
6 AVFAudio 0x0000000111bfb598 _ZN17AVAudioEngineImpl7ConnectEP11AVAudioNodeS1_mmP13AVAudioFormat + 194
7 AVFAudio 0x0000000111bfb5ff -[AVAudioEngine connect:to:format:] + 83
8 AppName 0x000000010a424c10 $s8AudioKitAAC6outputAA6AKNodeCSgvWZTf4dd_n + 2576
9 AppName 0x000000010a4230fd $s8AudioKitAAC6outputAA6AKNodeCSgvsZ + 93
10 AppName 0x000000010a2ba3a3 $s6AppName7MaestroC17setUpTrackPlayers7fileURLy10Foundation0H0V_tF + 1235

检查 common gotchas video我看到一个类似的异常被抛出, required condition is false: !nodeMixerConns.empty() && !hasDirectConnToIONode ,这是由于允许变量超出范围而不是保留在类中引起的。

所以当我们创建 AKPlayer 时会发生这种情况。 ,保留在一个类中,然后我们创建一个 AKTimePitch与同样保留在该类中的该玩家一起,最后将其分配给 AudioKit.output这会触发异常。之后,我们将保存玩家和时间间距的类存储在一个数组中,所以我试图在它创建后将其向上移动,希望这是问题所在,但我看到了同样的异常(exception)。

有趣的是,这段代码最初在我们加载第一首歌曲时运行良好,但在我们点击下一个按钮加载下一首歌曲时崩溃。
final class Maestro : NSObject {
static let shared = Maestro()

var audioPlayers = [TrackPlayer]()

func setUpTrackPlayers(fileURL: URL) {
let playerOne = TrackPlayer(url: fileURL)
audioPlayers.append(playerOne)

AudioKit.output = playerOne.handleMixerChain() //boom

do {
try AudioKit.start()
} catch {
print("Maestro AudioKit.start error: \(error)")
}
}

func next() {
for player in audioPlayers {
player.stop()
}
audioPlayers.removeAll()

setUpTrackPlayers(fileURL: newSong.getFileUrl())
}
}

final class TrackPlayer {
let player : AKPlayer
lazy var timePitch = AKTimePitch()

init(url: URL) {
player = AKPlayer(url: url)!
}

func handleMixerChain(pitch: Double = 0.0, tempo: Double = 1.0) -> AKTimePitch {
timePitch = AKTimePitch(player)
timePitch.pitch = pitch
timePitch.rate = tempo
return timePitch
}
}

有任何想法吗?如果您需要更多信息,请告诉我。可能需要注意的是,我们正在从 AudioKit 4.5.5 更新,我们没有遇到此崩溃。

最佳答案

我已经打开了这个项目,看起来你对信号链的设置/拆卸有点太放松了。您正在使用局部变量设置 AudioKit 的输出,从不拆除此信号链,然后返回重置 AudioKit 输出并告诉 AudioKit 启动而无需调用 AudioKit.stop()。

关于ios - AudioKit 崩溃 : required condition is false: ! destNodeMixerConns.empty() && !isDestNodeConnectedToIONode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57417554/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com