Xcode 如果触摸屏幕,发动机将停止音乐/声音

Xcode 如果触摸屏幕,发动机将停止音乐/声音,xcode,cocos2d-iphone,simpleaudioengine,Xcode,Cocos2d Iphone,Simpleaudioengine,如果用户触摸屏幕,如何停止播放音乐/声音。目前,声音继续播放到下一个场景 - (void)setup { self.isTouchEnabled = YES; CGSize winSize = [[CCDirector sharedDirector] winSize]; CCSprite *background = [CCSprite spriteWithFile:[AssetHelper getDeviceSpecificFileNameFor:@"StartBackground.png"

如果用户触摸屏幕,如何停止播放音乐/声音。目前,声音继续播放到下一个场景

- (void)setup {

self.isTouchEnabled = YES;
CGSize winSize = [[CCDirector sharedDirector] winSize];

CCSprite *background = [CCSprite spriteWithFile:[AssetHelper getDeviceSpecificFileNameFor:@"StartBackground.png"]];
background.position = CGPointMake(winSize.width / 2, winSize.height / 2);
[self addChild:background];

SimpleAudioEngine *sae = [SimpleAudioEngine sharedEngine];
[sae playEffect:@"airplane_pass.m4a" ];
}

- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:0.5f scene:[MenuScene scene]]];
}

我通过将下面的代码添加到我的CCToucheSStart解决了我的问题

SimpleAudioEngine *sae = [SimpleAudioEngine sharedEngine];
[sae unloadEffect:@"airplane_pass.m4a"];