Play background music
@param {String} URL sound path
@param {Boolean} loop is played back
Cc.audioEngine.playMusic (URL, loop);
Stop background music
@param {Boolean} releasedata whether to release sound data, default to False
Cc.audioEngine.stopMusic (Releasedata);
Pause background music
Cc.audioEngine.pauseMusic ();
Restore background music
Cc.audioEngine.resumeMusic ();
Re-play background music
Cc.audioEngine.rewindMusic ();
Get background music Volume
The value of @return {number} is between 0 and 1.0
Cc.audioEngine.getMusicVolume ();
Set background music volume
@param {Number} volume range 0.0~1.0.
Cc.audioEngine.setMusicVolume (volume);
Gets whether the background music is in play
@return {Boolean} is playing back true, otherwise returns false
Cc.audioEngine.isMusicPlaying ();
Play sound (basically similar to music)
@param {String} URL sound file path
@param {Boolean} loop plays, default value is False
@return {Number|null} returns the sound ID
Audioid cc.audioEngine.playEffect (URL, loop);
Get Sound Volume
Cc.audioEngine.getEffectsVolume ();
Set Sound volume
Cc.audioEngine.setEffectsVolume (volume);
Pause the corresponding sound
Cc.audioEngine.pauseEffect (audioid);
Pause all sound effects
Cc.audioEngine.pauseAllEffects ();
Restore the corresponding sound effects
Cc.audioEngine.resumeEffect (audioid);
Restore all sound effects
Cc.audioEngine.resumeAllEffects ();
Stop the corresponding sound
Cc.audioEngine.stopEffect (audioid);
Unload sound data in a memory buffer
Cc.audioEngine.unloadEffect (URL);
The difference between game sound and game music:
Game sound generally refers to a particular action in the game or play a specific operation of the music, such as gunfire, the game of bullets in the launch of the sound, or the role-playing game monster killed when the scream.
There are three categories of game sounds, namely:
Mono sound, most of the sound in the game is mono sound;
Composite sound generally refers to a plurality of sound elements, in the course of the game by the program in real time to synthesize the sound effects of these reasons;
Musical sound generally refers to a piece of music, usually the player enters the map at that moment of music, this music is generally belong to the music production extend.
So what's the difference between game sound and game music? Game music generally refers to the game in the continuous play of background music, usually with the game operation and the state of the game is irrelevant, while the game sound is generally the game in particular scenes and behavior triggered by the music, if not triggered does not play
Cocos2d-Sound API