2011-09-16 5 views
6

[SimpleAudioEngine sharedEngine]이 현재 어떤 효과를 재생하는지 감지하고 싶습니다. 배경 음악의 경우 배경 음악 재생 여부에 대한 정보를 제공하는 방법이 있습니다.SimpleAudioEngine에서 사운드 효과가 현재 재생 중인지 검색

[[SimpleAudioEngine sharedEngine] isBackgroundMusicPlaying]; 

음향 효과에 대해 비슷한 것이 있습니까? 그렇지 않다면 이미 효과를 발휘하고 있는지 여부를 어떻게 감지 할 수 있습니까?

답변

3

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

이것이 당신을 바른 방향으로 당신을 가리키는 데 도움이되기를 바란다.