iphonecocos2d-iphonesimpleaudioengine

Iphone cocas2d game : Playing sound


i am also facing same problem .. by doing this background music stop but i my case i want to play another sound for a while .. like a blast sound and then again play old sound .. but whn i do this type of code [[SimpleAudioEngine sharedEngine] stopBackgroundMusic]; [[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"blast.wav" loop:TRUE]; [[SimpleAudioEngine sharedEngine] stopBackgroundMusic]; [[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"background.wav" loop:TRUE]; i blast sound not play ...background sound just stop for a sec .. and thn playing again .. need help


Solution

  • [[SimpleAudioEngine sharedEngine] stopBackgroundMusic];
    

    After Stopping background music.you can use playEffect.

     [[SimpleAudioEngine sharedEngine] playEffect:@"blast.wav"];