Reputation: 85
Has anyone gotten SceneKit positional audio to work in Swift using Xcode 7 and iOS 9?
This is my code to add audio to a node:
let spaceAudio = SCNAudioSource(fileNamed: "Arrp1.mp3")
spaceAudio.positional = true
spaceAudio.loops = true
spaceAudio.reverbBlend = 0.5
spaceAudio.shouldStream = true
let spaceAudioPlayer = SCNAudioPlayer(source: spaceAudio)
spaceBall.addAudioPlayer(spaceAudioPlayer)
I am getting this error:
[0x1a1950000] AVAudioNodeImpl.h:39: AVAE_CheckNodeHasEngine: required condition is false: _engine != nil 2015-08-20 17:37:19.077 MusiScape[660:53070] *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: _engine != nil'
Upvotes: 2
Views: 464
Reputation: 1589
I had the same problem and I have discoverd that if you first add spaceBall node to the scene graph and then you add the audio player to spaceBall the error will disappear.
Upvotes: 3