2013-02-08 97 views
0

我正在使用CDLongAudioSource在我的cocos2d遊戲中播放我的音樂。但問題是,當我的音頻文件只加載但沒有播放時,我的遊戲崩潰了一段時間,因爲我從我的場景回到其他場景,如果我再次出現在我的場景中,音頻文件需要播放應用程序崩潰。cocos2d音頻文件問題

功能播放文件:

-(void)playMyEffect:(NSString*)audioFile{ 
    CDLongAudioSource*currentSound = [[CDAudioManager sharedManager] audioSourceForChannel:kASC_Right]; 
    //[currentSound load:@""]; 
    NSLog(@" file path to play %@",audioFile); 
    [currentSound load:audioFile]; 
    currentSound.delegate = self; 
    currentSound.backgroundMusic = NO; 
    self.isSpeechComplete = NO; 
    [currentSound play]; 
} 

Error: screen shot

+0

什麼是故障報告? –

回答

1

確保您停止播放器,然後導航到其他場景之前刪除內存引用。我認爲這應該工作。