Skip to content

Instantly share code, notes, and snippets.

@nicnocquee
Last active September 29, 2015 01:43
Show Gist options
  • Save nicnocquee/9fe35da71f4a24c32700 to your computer and use it in GitHub Desktop.
Save nicnocquee/9fe35da71f4a24c32700 to your computer and use it in GitHub Desktop.
Cocos2d-x sound effect while letting user's song playing in iOS
// AppController.mm
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[CDAudioManager sharedManager] setMode:kAMM_FxPlusMusicIfNoOtherAudio];
return YES;
}
// in other file
#include "audio/include/SimpleAudioEngine.h"
void SomeClass::someMethod() {
CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("res/sfx.mp3");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment