Namespace cc.audioEngine
- Defined in: CCAudio.js
Method Summary
Method Detail
-
<static> cc.audioEngine.end()End music and effects.
-
<static> {Number} cc.audioEngine.getEffectsVolume()The volume of the effects max value is 1.0,the min value is 0.0 .
//example var effectVolume = cc.audioEngine.getEffectsVolume();
- Returns:
- {Number}
-
<static> {Number} cc.audioEngine.getMusicVolume()The volume of the music max value is 1.0,the min value is 0.0 .
//example var volume = cc.audioEngine.getMusicVolume();
- Returns:
- {Number}
-
<static> {Boolean} cc.audioEngine.isMusicPlaying()Whether the music is playing.
//example if (cc.audioEngine.isMusicPlaying()) { cc.log("music is playing"); } else { cc.log("music is not playing"); }
- Returns:
- {Boolean} If is playing return true,or return false.
-
<static> cc.audioEngine.pauseAllEffects()Pause all playing sound effect.
//example cc.audioEngine.pauseAllEffects();
-
<static> cc.audioEngine.pauseEffect()Pause playing sound effect.
//example cc.audioEngine.pauseEffect(audioID);
- Parameters:
- {Number} cc.Audio
- The return value of function playEffect.
-
<static> cc.audioEngine.pauseMusic()Pause playing music.
//example cc.audioEngine.pauseMusic();
-
<static> {Number|null} cc.audioEngine.playEffect(url, loop)Play sound effect.
//example var soundId = cc.audioEngine.playEffect(path);
- Parameters:
- {String} url
- The path of the sound effect with filename extension.
- {Boolean} loop
- Whether to loop the effect playing, default value is false
- Returns:
- {Number|null} the audio id
-
<static> cc.audioEngine.playMusic(url, loop)Play music.
//example cc.audioEngine.playMusic(path, false);
- Parameters:
- {String} url
- The path of the music file without filename extension.
- {Boolean} loop
- Whether the music loop or not.
-
<static> cc.audioEngine.resumeAllEffects()Resume all playing sound effect
//example cc.audioEngine.resumeAllEffects();
-
<static> cc.audioEngine.resumeEffect()Resume playing sound effect.
- Parameters:
- {Number} cc.Audio
- The return value of function playEffect.
-
<static> cc.audioEngine.resumeMusic()Resume playing music.
//example cc.audioEngine.resumeMusic();
-
<static> cc.audioEngine.rewindMusic()Rewind playing music.
//example cc.audioEngine.rewindMusic();
-
<static> cc.audioEngine.setEffectsVolume(volume)Set the volume of sound effects.
//example cc.audioEngine.setEffectsVolume(0.5);
- Parameters:
- {Number} volume
- Volume must be in 0.0~1.0 .
-
<static> cc.audioEngine.setMusicVolume(volume)Set the volume of music.
//example cc.audioEngine.setMusicVolume(0.5);
- Parameters:
- {Number} volume
- Volume must be in 0.0~1.0 .
-
<static> cc.audioEngine.stopAllEffects()Stop all playing sound effects.
//example cc.audioEngine.stopAllEffects();
-
<static> cc.audioEngine.stopEffect()Stop playing sound effect.
//example cc.audioEngine.stopEffect(audioID);
- Parameters:
- {Number} cc.Audio
- The return value of function playEffect.
-
<static> cc.audioEngine.stopMusic(releaseData)Stop playing music.
//example cc.audioEngine.stopMusic();
- Parameters:
- {Boolean} releaseData Optional
- If release the music data or not.As default value is false.
-
<static> cc.audioEngine.unloadEffect(url)Unload the preloaded effect from internal buffer
//example cc.audioEngine.unloadEffect(EFFECT_FILE);
- Parameters:
- {String} url
-
<static> {boolean} cc.audioEngine.willPlayMusic()Indicates whether any background music can be played or not.
- Returns:
- {boolean} true if the background music is playing, otherwise false