2011-05-06 15 views

回答

1

在嘗試播放聲音之前您是否撥打prepareToPlay?由於該方法建議這做所有的準備工作,這意味着後續調用play應該很快。

如果您需要更低的延遲,您可能需要使用AVAudioQueues。

+0

是的,我有加,但thax @湯姆 – 2011-05-06 09:37:23

1

嘗試就像這個...

在.H

AVAudioPlayer *playerBG 

在.M

AVAudioPlayer *pp = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Ting" ofType:@"wav"]] error:nil]; 
self.playerBG = pp; 
[pp prepareToPlay]; 
[pp release]; 
+0

是的,我有加,但thax阿尼什 – 2011-05-06 09:36:47