1

Hello I am making a cocos2d side scroller. I am trying to add a background audio file. I am using SimpleAudioEngine. This is the code:

[[SimpleAudioEngine sharedEngine]playBackgroundMusic:@"Soundtrack.mp3" loop:YES];

But when I run it it gives me a error. The line that it says is giving me the error is:

[audioSourcePlayer prepareToPlay];

Is there a different way to add a sound file that won't give me this error?

4

1 回答 1

3

AVAudio和OpenAL会抛出一些异常,Xcode异常断点触发是正常的,不用担心。

我强烈建议不要删除异常断点,而是“编辑”断点,并从微小的编辑对话框中确保选择仅捕获 Objective-C 异常。这样,所有音频异常都不会打扰您(它们是 C++ 异常),但您仍然可以看到在断言​​触发时发生崩溃的地方。

于 2013-09-02T21:19:04.943 回答