cocos2d-x  3.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
FmodAudioPlayer Class Reference

#include <FmodAudioPlayer.h>

Inheritance diagram for FmodAudioPlayer:
AudioPlayer

Public Member Functions

 FmodAudioPlayer ()
virtual ~FmodAudioPlayer ()
virtual void close ()
virtual void preloadBackgroundMusic (const char *pszFilePath)
 Preload background music. More...
 
virtual void playBackgroundMusic (const char *pszFilePath, bool bLoop)
 Play background music. More...
 
virtual void stopBackgroundMusic (bool bReleaseData)
 Stop playing background music. More...
 
virtual void pauseBackgroundMusic ()
 Pause playing background music. More...
 
virtual void resumeBackgroundMusic ()
 Resume playing background music. More...
 
virtual void rewindBackgroundMusic ()
 Rewind playing background music. More...
 
virtual bool willPlayBackgroundMusic ()
virtual bool isBackgroundMusicPlaying ()
 Whether the background music is playing. More...
 
virtual float getBackgroundMusicVolume ()
 The volume of the background music max value is 1.0,the min value is 0.0. More...
 
virtual void setBackgroundMusicVolume (float volume)
 set the volume of background music More...
 
virtual float getEffectsVolume ()
 The volume of the effects max value is 1.0,the min value is 0.0. More...
 
virtual void setEffectsVolume (float volume)
 set the volume of sound effecs More...
 
virtual unsigned int playEffect (const char *pszFilePath, bool bLoop, float pitch, float pan, float gain)
 Play sound effect. More...
 
virtual void stopEffect (unsigned int nSoundId)
 Stop playing sound effect. More...
 
virtual void preloadEffect (const char *pszFilePath)
 preload a compressed audio file More...
 
virtual void unloadEffect (const char *pszFilePath)
 unload the preloaded effect from internal buffer More...
 
virtual void pauseEffect (unsigned int uSoundId)
 pause an effect identified by sound id More...
 
virtual void pauseAllEffects ()
 pause all playing effects More...
 
virtual void resumeEffect (unsigned int uSoundId)
 resume an effect identified by sound id More...
 
virtual void resumeAllEffects ()
 resume a effect identified by sound id More...
 
virtual void stopAllEffects ()
 stop all playing effects More...
 

Static Public Member Functions

static FmodAudioPlayersharedPlayer ()

Constructor & Destructor Documentation

virtual ~FmodAudioPlayer ( )
virtual

Member Function Documentation

virtual void close ( )
virtual

Implements AudioPlayer.

virtual float
getBackgroundMusicVolume
( )
virtual

The volume of the background music max value is 1.0,the min value is 0.0.

Implements AudioPlayer.

virtual float getEffectsVolume ( )
virtual

The volume of the effects max value is 1.0,the min value is 0.0.

Implements AudioPlayer.

virtual bool
isBackgroundMusicPlaying
( )
virtual

Whether the background music is playing.

Returns
If is playing return true,or return false

Implements AudioPlayer.

virtual void pauseAllEffects ( )
virtual

pause all playing effects

Implements AudioPlayer.

virtual void pauseBackgroundMusic ( )
virtual

Pause playing background music.

Implements AudioPlayer.

virtual void pauseEffect ( unsigned int  uSoundId)
virtual

pause an effect identified by sound id

Parameters
[in]uSoundIdsound id

Implements AudioPlayer.

virtual void playBackgroundMusic ( const char *  pszFilePath,
bool  bLoop 
)
virtual

Play background music.

Parameters
pszFilePathThe path of the background music file,or the FileName of T_SoundResInfo
bLoopWhether the background music loop or not

Implements AudioPlayer.

virtual unsigned int playEffect ( const char *  pszFilePath,
bool  bLoop,
float  pitch,
float  pan,
float  gain 
)
virtual

Play sound effect.

Parameters
pszFilePathThe path of the effect file,or the FileName of T_SoundResInfo Whether to loop the effect playing, default value is false

Implements AudioPlayer.

virtual void preloadBackgroundMusic ( const char *  pszFilePath)
virtual

Preload background music.

Parameters
pszFilePathThe path of the background music file,or the FileName of T_SoundResInfo

Implements AudioPlayer.

virtual void preloadEffect ( const char *  pszFilePath)
virtual

preload a compressed audio file

the compressed audio will be decode to wave, then write into an internal buffer in SimpleaudioEngine

Implements AudioPlayer.

virtual void resumeAllEffects ( )
virtual

resume a effect identified by sound id

Implements AudioPlayer.

virtual void resumeBackgroundMusic ( )
virtual

Resume playing background music.

Implements AudioPlayer.

virtual void resumeEffect ( unsigned int  uSoundId)
virtual

resume an effect identified by sound id

Parameters
[in]uSoundIdsound id

Implements AudioPlayer.

virtual void rewindBackgroundMusic ( )
virtual

Rewind playing background music.

Implements AudioPlayer.

virtual void
setBackgroundMusicVolume
( float  volume)
virtual

set the volume of background music

Parameters
volumemust be in 0.0~1.0

Implements AudioPlayer.

virtual void setEffectsVolume ( float  volume)
virtual

set the volume of sound effecs

Parameters
volumemust be in 0.0~1.0

Implements AudioPlayer.

static FmodAudioPlayer*
sharedPlayer
( )
static
virtual void stopAllEffects ( )
virtual

stop all playing effects

Implements AudioPlayer.

virtual void stopBackgroundMusic ( bool  bReleaseData)
virtual

Stop playing background music.

Parameters
bReleaseDataIf release the background music data or not.As default value is false

Implements AudioPlayer.

virtual void stopEffect ( unsigned int  nSoundId)
virtual

Stop playing sound effect.

Parameters
nSoundIdThe return value of function playEffect

Implements AudioPlayer.

virtual void unloadEffect ( const char *  pszFilePath)
virtual

unload the preloaded effect from internal buffer

Parameters
[in]pszFilePathThe path of the effect file,or the FileName of T_SoundResInfo

Implements AudioPlayer.

virtual bool
willPlayBackgroundMusic
( )
virtual

Implements AudioPlayer.


The documentation for this class was generated from the following file: