2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
|
|
|
-- @module SimpleAudioEngine
|
2014-07-02 10:15:26 +08:00
|
|
|
-- @parent_module cc
|
2014-03-18 15:55:30 +08:00
|
|
|
|
2014-03-10 14:04:58 +08:00
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Preload background music.<br>
|
|
|
|
-- param filePath The path of the background music file.<br>
|
2014-09-02 13:45:07 +08:00
|
|
|
-- js preloadMusic<br>
|
|
|
|
-- lua preloadMusic
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] preloadBackgroundMusic
|
|
|
|
-- @param self
|
2015-03-19 11:55:42 +08:00
|
|
|
-- @param #char filePath
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Stop playing background music.<br>
|
|
|
|
-- param releaseData If release the background music data or not.As default value is false.<br>
|
2014-09-02 13:45:07 +08:00
|
|
|
-- js stopMusic<br>
|
|
|
|
-- lua stopMusic
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] stopBackgroundMusic
|
|
|
|
-- @param self
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Stop all playing sound effects.
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] stopAllEffects
|
|
|
|
-- @param self
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- The volume of the background music within the range of 0.0 as the minimum and 1.0 as the maximum.<br>
|
2014-09-02 13:45:07 +08:00
|
|
|
-- js getMusicVolume<br>
|
|
|
|
-- lua getMusicVolume
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] getBackgroundMusicVolume
|
|
|
|
-- @param self
|
|
|
|
-- @return float#float ret (return value: float)
|
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Resume playing background music.<br>
|
2014-09-02 13:45:07 +08:00
|
|
|
-- js resumeMusic<br>
|
|
|
|
-- lua resumeMusic
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] resumeBackgroundMusic
|
|
|
|
-- @param self
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Set the volume of background music.<br>
|
2014-09-02 13:45:07 +08:00
|
|
|
-- param volume must be within the range of 0.0 as the minimum and 1.0 as the maximum.<br>
|
|
|
|
-- js setMusicVolume<br>
|
|
|
|
-- lua setMusicVolume
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] setBackgroundMusicVolume
|
|
|
|
-- @param self
|
2014-09-02 13:45:07 +08:00
|
|
|
-- @param #float volume
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Preload a compressed audio file.<br>
|
|
|
|
-- The compressed audio will be decoded to wave, then written into an internal buffer in SimpleAudioEngine.<br>
|
|
|
|
-- param filePath The path of the effect file.
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] preloadEffect
|
|
|
|
-- @param self
|
2015-03-19 11:55:42 +08:00
|
|
|
-- @param #char filePath
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Indicates whether the background music is playing.<br>
|
|
|
|
-- return <i>true</i> if the background music is playing, otherwise <i>false</i>.<br>
|
2014-09-02 13:45:07 +08:00
|
|
|
-- js isMusicPlaying<br>
|
|
|
|
-- lua isMusicPlaying
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] isBackgroundMusicPlaying
|
|
|
|
-- @param self
|
|
|
|
-- @return bool#bool ret (return value: bool)
|
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- The volume of the effects within the range of 0.0 as the minimum and 1.0 as the maximum.
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] getEffectsVolume
|
|
|
|
-- @param self
|
|
|
|
-- @return float#float ret (return value: float)
|
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Indicates whether any background music can be played or not.<br>
|
2014-09-02 13:45:07 +08:00
|
|
|
-- return <i>true</i> if background music can be played, otherwise <i>false</i>.<br>
|
|
|
|
-- js willPlayMusic<br>
|
|
|
|
-- lua willPlayMusic
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] willPlayBackgroundMusic
|
|
|
|
-- @param self
|
|
|
|
-- @return bool#bool ret (return value: bool)
|
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Pause playing sound effect.<br>
|
|
|
|
-- param soundId The return value of function playEffect.
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] pauseEffect
|
|
|
|
-- @param self
|
2015-03-19 11:55:42 +08:00
|
|
|
-- @param #unsigned int soundId
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Play sound effect with a file path, pitch, pan and gain.<br>
|
|
|
|
-- param filePath The path of the effect file.<br>
|
|
|
|
-- param loop Determines whether to loop the effect playing or not. The default value is false.<br>
|
2014-09-02 13:45:07 +08:00
|
|
|
-- param pitch Frequency, normal value is 1.0. Will also change effect play time.<br>
|
|
|
|
-- param pan Stereo effect, in the range of [-1..1] where -1 enables only left channel.<br>
|
|
|
|
-- param gain Volume, in the range of [0..1]. The normal value is 1.<br>
|
2015-03-19 11:55:42 +08:00
|
|
|
-- return The sound id.<br>
|
2014-09-02 13:45:07 +08:00
|
|
|
-- note Full support is under development, now there are limitations:<br>
|
|
|
|
-- - no pitch effect on Samsung Galaxy S2 with OpenSL backend enabled;<br>
|
2015-03-19 11:55:42 +08:00
|
|
|
-- - no pitch/pan/gain on win32.
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] playEffect
|
|
|
|
-- @param self
|
2015-03-19 11:55:42 +08:00
|
|
|
-- @param #char filePath
|
|
|
|
-- @param #bool loop
|
2014-09-02 13:45:07 +08:00
|
|
|
-- @param #float pitch
|
|
|
|
-- @param #float pan
|
|
|
|
-- @param #float gain
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @return unsigned int#unsigned int ret (return value: unsigned int)
|
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Rewind playing background music.<br>
|
2014-09-02 13:45:07 +08:00
|
|
|
-- js rewindMusic<br>
|
|
|
|
-- lua rewindMusic
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] rewindBackgroundMusic
|
|
|
|
-- @param self
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Play background music.<br>
|
|
|
|
-- param filePath The path of the background music file,or the FileName of T_SoundResInfo.<br>
|
|
|
|
-- param loop Whether the background music loop or not.<br>
|
2014-09-02 13:45:07 +08:00
|
|
|
-- js playMusic<br>
|
|
|
|
-- lua playMusic
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] playBackgroundMusic
|
|
|
|
-- @param self
|
2015-03-19 11:55:42 +08:00
|
|
|
-- @param #char filePath
|
|
|
|
-- @param #bool loop
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Resume all playing sound effect.
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] resumeAllEffects
|
|
|
|
-- @param self
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Set the volume of sound effects.<br>
|
2014-09-02 13:45:07 +08:00
|
|
|
-- param volume must be within the range of 0.0 as the minimum and 1.0 as the maximum.
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] setEffectsVolume
|
|
|
|
-- @param self
|
2014-09-02 13:45:07 +08:00
|
|
|
-- @param #float volume
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Stop playing sound effect.<br>
|
|
|
|
-- param soundId The return value of function playEffect.
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] stopEffect
|
|
|
|
-- @param self
|
2015-03-19 11:55:42 +08:00
|
|
|
-- @param #unsigned int soundId
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Pause playing background music.<br>
|
2014-09-02 13:45:07 +08:00
|
|
|
-- js pauseMusic<br>
|
|
|
|
-- lua pauseMusic
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] pauseBackgroundMusic
|
|
|
|
-- @param self
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Pause all playing sound effect.
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] pauseAllEffects
|
|
|
|
-- @param self
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Unload the preloaded effect from internal buffer.<br>
|
|
|
|
-- param filePath The path of the effect file.
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] unloadEffect
|
|
|
|
-- @param self
|
2015-03-19 11:55:42 +08:00
|
|
|
-- @param #char filePath
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Resume playing sound effect.<br>
|
|
|
|
-- param soundId The return value of function playEffect.
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] resumeEffect
|
|
|
|
-- @param self
|
2015-03-19 11:55:42 +08:00
|
|
|
-- @param #unsigned int soundId
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Release the shared Engine object.<br>
|
|
|
|
-- warning It must be called before the application exit, or it will lead to memory leaks.
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] end
|
|
|
|
-- @param self
|
2015-01-21 17:33:26 +08:00
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine)
|
2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
--------------------------------
|
2015-03-19 11:55:42 +08:00
|
|
|
-- Returns a shared instance of the SimpleAudioEngine.
|
2014-03-10 14:04:58 +08:00
|
|
|
-- @function [parent=#SimpleAudioEngine] getInstance
|
|
|
|
-- @param self
|
|
|
|
-- @return SimpleAudioEngine#SimpleAudioEngine ret (return value: cc.SimpleAudioEngine)
|
|
|
|
|
|
|
|
return nil
|