SimpleAudioEngine
不具有像isBackgroundMusicPlaying
的效果的方法,但你可以存儲BOOL
稱爲IsPlaying模塊,並使用CDSoundSource
CDSoundSource* currentSound = [[CDAudioManager sharedManager] audioSourceForChannel:kASC_Right];
[currentSound load:audioFile];
currentSound.delegate = self;
currentSound.backgroundMusic = NO;
isPlaying = YES;
[currentSound play];
然後實現回調:
- (void) cdAudioSourceDidFinishPlaying:(CDLongAudioSource *) audioSource {
isPlaying = NO;
}
我不因爲我無恥地偷走了this topic的代碼,所以知道這是否是初始化CDSoundSource
的正確方法。也許你應該看一看的CDAudioManager Class Reference
希望這有助於給你指出正確的方向。