2

Cocos2d 2.0 and below works with this:

  [[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"SaveInMe.mp3"];

Which class plays music in Cocos2d 3.0 ?

James Webster
  • 31,873
  • 11
  • 70
  • 114
iPhoneChip
  • 658
  • 1
  • 7
  • 15

2 Answers2

6

SimpleAudioEngine is not available in Cocos2d v3.0, use OALSimpleAudio

[[OALSimpleAudio sharedInstance] playEffect:@"Effect.caf"];
[[OALSimpleAudio sharedInstance] playBg:@"Game_BG_Music.mp3" loop:true];
Guru
  • 21,652
  • 10
  • 63
  • 102
-2

Imprt the audio engins and #import "SimpleAudioEngine.h" then play audio

[[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"themesound.wav"];
 //for stop audio
 [[SimpleAudioEngine sharedEngine] stopBackgroundMusic];
Vamshi
  • 1
  • 6