Class ccs.ComAudio

Class Summary
Constructor Attributes Constructor Name and Description
 
The audio component for Cocostudio.

Method Summary

Class Detail

ccs.ComAudio()
The audio component for Cocostudio.

Method Detail

  • <static> {ccs.ComAudio} ccs.ComAudio.create()
    allocates and initializes a ComAudio.
    // example
    var com = ccs.ComAudio.create();
    Deprecated:
    since v3.0, please use new construction instead.
    Returns:
    {ccs.ComAudio}
  • ctor()
    Construction of ccs.ComAudio
  • end()
    Stops all audios.
  • {Number} getBackgroundMusicVolume()
    The volume of the music max value is 1.0,the min value is 0.0 .
    Returns:
    {Number}
  • {Number} getEffectsVolume()
    The volume of the effects max value is 1.0,the min value is 0.0 .
    Returns:
    {Number}
  • {string} getFile()
    Returns the file path of audio component.
    Returns:
    {string}
  • {boolean} init()
    Initializes a ccs.ComAudio.
    Returns:
    {boolean}
  • {Boolean} isBackgroundMusicPlaying()
    Whether the music is playing.
    Returns:
    {Boolean}
  • {boolean} isLoop()
    Returns audio component whether plays loop
    Returns:
    {boolean}
  • onExit()
    The callback calls when a audio component enter stage.
  • pauseAllEffects()
    Pause all effects
  • pauseBackgroundMusic()
    Pause background music
  • pauseEffect(soundId)
    Pause playing sound effect.
    Parameters:
    {Number} soundId
  • playBackgroundMusic(pszFilePath, loop)
    Play background music
    Parameters:
    {String} pszFilePath Optional
    {Boolean} loop Optional
  • {Boolean} playEffect(pszFilePath, loop)
    Play sound effect.
    Parameters:
    {String} pszFilePath Optional
    {Boolean} loop Optional
    Returns:
    {Boolean}
  • preloadBackgroundMusic(pszFilePath)
    Preload background music resource
    Parameters:
    {String} pszFilePath
  • preloadEffect(pszFilePath)
    Preload effect
    Parameters:
    {String} pszFilePath
  • resumeAllEffects()
    Resume all effects
  • resumeBackgroundMusic()
    Resume background music
  • resumeEffect(soundId)
    Resume effect
    Parameters:
    {Number} soundId
  • rewindBackgroundMusic()
    Rewind background music
  • setBackgroundMusicVolume(volume)
    Set the volume of music.
    Parameters:
    {Number} volume
    must be in 0.0~1.0 .
  • setEffectsVolume(volume)
    Set the volume of sound effects.
    Parameters:
    {Number} volume
  • setFile(pszFilePath)
    File path setter
    Parameters:
    {String} pszFilePath
  • setLoop(loop)
    Sets audio component whether plays loop
    Parameters:
    {Boolean} loop
  • stopAllEffects()
    stop all effects
  • stopBackgroundMusic(releaseData)
    Stop background music
    Parameters:
    {String} releaseData
  • stopEffect(soundId)
    Stop effect
    Parameters:
    {Number} soundId
  • unloadEffect(pszFilePath)
    Unload effect
    Parameters:
    {String} pszFilePath
  • {boolean} willPlayBackgroundMusic()
    Indicates whether any background music can be played or not.
    Returns:
    {boolean}