Home > other >  Cocos2d - x how to add background music
Cocos2d - x how to add background music

Time:09-23


Excuse me, is what is wrong?

CodePudding user response:

The Log write very clear, isn't it, you confirm your music files with the right position?
Relative paths here should be with your engineering Resource to the position

CodePudding user response:

File path to write right ah, brother

CodePudding user response:

//load the background music
 SimpleAudioEngine: : sharedEngine () - & gt; PreloadBackgroundMusic (" BM. Wav "); 


//load the sound file
 SimpleAudioEngine: : getInstance () - & gt; PreloadBackgroundMusic (" YX. Mp3 "); 


You have to load a sound files and then play the background sound so wrong

That the following sentence into
 
SimpleAudioEngine: : sharedEngine () - & gt; PlayEffect (" YX. Mp3 ", false);


Secondly the location of your sound files should be in the resource - sound folder, such ability

CodePudding user response:

Upstairs to write so complicated, on the path to say again first
  • Related