1

我最近一直在为一个新项目使用 AudioKit v3.3,并且正在使用名为 AK3DPanner 的 3D 空间化节点碰壁。有一次我让它运行起来,虽然它看起来非常粗糙,要么在左耳或右耳中播放所有声音。完全不是人们所期望的。

无论如何,现在的问题是它甚至无法启动。据我所知,把它放在操场上应该可以工作,但它会崩溃:

let drip = AKDrip(intensity: 1)
let pan = AK3DPanner(drip)
AudioKit.output = pan

AudioKit.start() // Crashes here

drip.start()

AKPlaygroundLoop(every: 1) {
    drip.trigger()
}

控制台记录了这一点:

2016-09-13 13:52:52.395 FM Oscillator Operation[54225:910643] 13:52:52.395 ERROR:    AVAudioEngineGraph.mm:2510: PerformCommand: error -10875
2016-09-13 13:52:52.398 FM Oscillator Operation[54225:910643] *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'error -10875'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010f22bd85 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010ec9fdeb objc_exception_throw + 48
    2   CoreFoundation                      0x000000010f22bbea +[NSException raise:format:arguments:] + 106
    3   libAVFAudio.dylib                   0x000000011c566ff3 _Z19AVAE_RaiseExceptionP8NSStringz + 176
    4   libAVFAudio.dylib                   0x000000011c5783fb _ZNK18AVAudioEngineGraph14PerformCommandER11AUGraphNodeNS_12ENodeCommandEPvj + 1571
    5   libAVFAudio.dylib                   0x000000011c581bcd _ZNSt3__110__function6__funcIZN13AUGraphParser34InitializeActiveNodesInOutputChainER18AVAudioEngineGraph14ETraversalModeR11AUGraphNodeRbE3$_8NS_9allocatorIS9_EEF16ETraversalStatusS7_P17AUGraphConnectionEEclES7_OSE_ + 231
    6   libAVFAudio.dylib                   0x000000011c582c2f _ZNKSt3__18functionIF16ETraversalStatusR11AUGraphNodeP17AUGraphConnectionEEclES3_S5_ + 31
    7   libAVFAudio.dylib                   0x000000011c575208 _ZN13AUGraphParser18TraverseGraphNodesERK18AVAudioEngineGraph10EDirection10ERecursionR11AUGraphNodeP17AUGraphConnectionRKNSt3__18functionIF16ETraversalStatusS6_S8_EEE + 48
    8   libAVFAudio.dylib                   0x000000011c5762bb _ZN13AUGraphParser34InitializeActiveNodesInOutputChainER18AVAudioEngineGraph14ETraversalModeR11AUGraphNodeRb + 833
    9   libAVFAudio.dylib                   0x000000011c57921f _ZN18AVAudioEngineGraph10InitializeEv + 1031
    10  libAVFAudio.dylib                   0x000000011c5b12b5 _ZN17AVAudioEngineImpl10InitializeEv + 29
    11  libAVFAudio.dylib                   0x000000011c5b0827 -[AVAudioEngine prepare] + 58
    12  AudioKit                            0x000000011d23fb92 _TZFC8AudioKit8AudioKit5startfT_T_ + 258
    13  ???                                 0x000000011a3f86d5 0x0 + 4735338197
    14  FM Oscillator Operation             0x000000010e72fab0 main + 0
    15  FM Oscillator Operation             0x000000010e7329a1 _TTRXFo__dT__XFo_iT__iT__ + 17
    16  FM Oscillator Operation             0x000000010e732401 _TPA__TTRXFo__dT__XFo_iT__iT__ + 81
    17  FM Oscillator Operation             0x000000010e7329d0 _TTRXFo_iT__iT__XFo__dT__ + 32
    18  FM Oscillator Operation             0x000000010e732a07 _TTRXFo__dT__XFdCb__dT__ + 39
    19  CoreFoundation                      0x000000010f1512ec __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    20  CoreFoundation                      0x000000010f146f75 __CFRunLoopDoBlocks + 341
    21  CoreFoundation                      0x000000010f1466d2 __CFRunLoopRun + 850
    22  CoreFoundation                      0x000000010f1460f8 CFRunLoopRunSpecific + 488
    23  GraphicsServices                    0x0000000115d0bad2 GSEventRunModal + 161
    24  UIKit                               0x000000010f5e1f09 UIApplicationMain + 171
    25  FM Oscillator Operation             0x000000010e72ff39 main + 1161
    26  libdyld.dylib                       0x0000000111f7192d start + 1
    27  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

此外,如果我print(AudioKit.engine)在崩溃之前得到这个:

________ GraphDescription ________
AVAudioEngineGraph 0x7f97d9437f40: initialized = 0, running = 0, number of nodes = 3

     ******** output chain ********

     node 0x7f97d9611d90 {'auou' 'rioc' 'appl'}, 'U'
         inputs = 1
             (bus0) <- (bus0) 0x7f97d943c910, {'aumx' '3dem' 'appl'}, [ 2 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]

     node 0x7f97d943c910 {'aumx' '3dem' 'appl'}, 'U'
         inputs = 33
             (bus0) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus1) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus2) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus3) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus4) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus5) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus6) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus7) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus8) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus9) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus10) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus11) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus12) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus13) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus14) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus15) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus16) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus17) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus18) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus19) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus20) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus21) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus22) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus23) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus24) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus25) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus26) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus27) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus28) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus29) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus30) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus31) <- (bus0) 0x0, {}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
             (bus32) <- (bus0) 0x7f97d9437780, {'augn' 'drip' 'AuKt'}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
         outputs = 1
             (bus0) -> (bus0) 0x7f97d9611d90, {'auou' 'rioc' 'appl'}, [ 2 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]

     node 0x7f97d9437780 {'augn' 'drip' 'AuKt'}, 'U'
         outputs = 1
             (bus0) -> (bus32) 0x7f97d943c910, {'aumx' '3dem' 'appl'}, [ 1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
______________________________________

我还应该注意,在运行 AudioKit 游乐场时我总是会遇到这个错误,但事情仍然总是有效的:

2016-09-13 13:52:52.364 FM Oscillator Operation[54225:910777] 13:52:52.363 WARNING:  40: ERROR: couldn't get default input device, ID = 0, err = 0!
2016-09-13 13:52:52.375 FM Oscillator Operation[54225:910777] 13:52:52.375 WARNING:  803: The default input device 0x0 '(null)' has no input channels.

最后,如果我像下面这样删除 panner 节点,它可以正常工作:

let drip = AKDrip(intensity: 1)
AudioKit.output = drip

AudioKit.start()

drip.start()

AKPlaygroundLoop(every: 1) {
    drip.trigger()
}

非常感谢您对此的任何见解。由于双耳音频对项目至关重要,如果我们无法解决这个问题,我们需要切换音频引擎!

4

1 回答 1

1

你能用最新的 AudioKit 再试一次吗?如果还是不行,尝试先将滴水声发送到AKMixer,让mixer = AKMixer(drip),然后再发送到3D Panner。

于 2017-01-20T09:18:43.593 回答