Quantcast
Channel: Active questions tagged crash - Stack Overflow
Viewing all articles
Browse latest Browse all 7191

setting AVAudioFormat to connect function has crash

$
0
0

I have been trying play with AVAudioEngine for singed 16 bit stream data.

But pass to AVAudioFormat connect function always make crash.

codes like below:

let AUDIO_OUTPUT_SAMPLE_RATE    = 44100let AUDIO_OUTPUT_CHANNELS       = 2let AUDIO_OUTPUT_BITS           = 16var audioEngine: AVAudioEngine?var audioPlayer: AVAudioPlayerNode?...    audioEngine = AVAudioEngine()    audioPlayer = AVAudioPlayerNode()    audioEngine?.attach(audioPlayer!)    let mixer = audioEngine?.mainMixerNode    mixer!.outputVolume = 1.0    let stereoFormat = AVAudioFormat(commonFormat: .pcmFormatInt16, sampleRate: Double(AUDIO_OUTPUT_SAMPLE_RATE), channels: 2, interleaved: false)    audioEngine!.connect(audioPlayer!, to: mixer!, format: stereoFormat)...

audioEngine!.connect(...) is crashing line

I'm using Xcode 8 beta 6, OS X El Capitan, And, this happening arise from both of simulator and devices.

This is part of crash message:

ERROR:    >avae> AVAudioNode.mm:751: AUSetFormat: error -10868*** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'error -10868'...3   AVFAudio  0x000000011e0a5630 _Z19AVAE_RaiseExceptionP8NSStringz + 1764   AVFAudio  0x000000011e0f270d _ZN19AVAudioNodeImplBase11AUSetFormatEP28OpaqueAudioComponentInstancejjP13AVAudioFormat + 2135   AVFAudio  0x000000011e0f2630 _ZN19AVAudioNodeImplBase15SetOutputFormatEmP13AVAudioFormat + 466   AVFAudio  0x000000011e0f9663 _ZN21AVAudioPlayerNodeImpl15SetOutputFormatEmP13AVAudioFormat + 257   AVFAudio  0x000000011e099cfd _ZN18AVAudioEngineGraph8_ConnectEP19AVAudioNodeImplBaseS1_jjP13AVAudioFormat + 23778   AVFAudio  0x000000011e09d15f _ZN18AVAudioEngineGraph7ConnectEP11AVAudioNodeS1_mmP13AVAudioFormat + 3559   AVFAudio  0x000000011e0fc80e _ZN17AVAudioEngineImpl7ConnectEP11AVAudioNodeS1_mmP13AVAudioFormat + 348

It's no problem playing with buffer and format from audio file.

What is mistake(s) I do?

Thanks.


Viewing all articles
Browse latest Browse all 7191

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>