2013-03-27 7 views
0

내가 방법을 구현 한 모든 시간 루핑 : 여기소리가 나에게 소리의 배열을로드

-(void) soundSuper 
{ 
    [soundEngine stopAllSounds]; 

    [soundEngine playSound:(1000+tag) sourceGroupId:1 pitch:1 pan:1 gain:1.0f loop:NO]; 
    NSLog(@"sound1 activated"); 

    [self schedule:@selector(playSecondSound) interval:2]; 
} 

-(void) playSecondSound { 
    [self unschedule:@selector(playSecondSound)]; 
    [soundEngine playSound:(1008+tag) sourceGroupId:1 pitch:1 pan:1 gain:1.0f loop:NO]; 
    NSLog(@"sound2 activated"); 
} 

, 그것은 소리를로드하고 다음 버튼을 터치하면 재생됩니다. 같은 순간에 2 개의 소리. 이제 initScene에 사운드를로드하고 싶습니다. 이 방법으로 이것을 얻고 있습니다 :

[self schedule:@selector(soundSuper) interval:2]; 

그러나 내가 입력 할 때 소리가 재생되지만 항상 반복됩니다. 나는 무효 한 두 번째 소리 방법으로 그것을 예약하지 않았기 때문에 무엇을해야할지 모른다. 뭔가 잘못이다?

답변

1

그나마 당신이

-(void) soundSuper 
{ 
    //HERE : you unschedule this selector too. 
    [self unschedule:@selector(soundSuper)]; 

    [soundEngine stopAllSounds]; 

    [soundEngine playSound:(1000+tag) sourceGroupId:1 pitch:1 pan:1 gain:1.0f loop:NO]; 
    NSLog(@"sound1 activated"); 

    [self schedule:@selector(playSecondSound) interval:2]; 
} 
처럼, 또한 "soundSuper"선택기를 스케줄 해제해야한다고 생각
관련 문제