cocos2d-x  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AudioPlayer Class Referenceabstract

#include <AudioPlayer.h>

Inheritance diagram for AudioPlayer:
FmodAudioPlayer

Public Member Functions

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

Member Function Documentation

virtual void close ( )
pure virtual

Implemented in FmodAudioPlayer.

virtual float getBackgroundMusicVolume ( )
pure virtual

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

Implemented in FmodAudioPlayer.

virtual float getEffectsVolume ( )
pure virtual

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

Implemented in FmodAudioPlayer.

virtual bool isBackgroundMusicPlaying ( )
pure virtual

Whether the background music is playing.

Returns
If is playing return true,or return false

Implemented in FmodAudioPlayer.

virtual void pauseAllEffects ( )
pure virtual

pause all playing effects

Implemented in FmodAudioPlayer.

virtual void pauseBackgroundMusic ( )
pure virtual

Pause playing background music.

Implemented in FmodAudioPlayer.

virtual void pauseEffect ( unsigned int  uSoundId)
pure virtual

pause an effect identified by sound id

Parameters
[in]uSoundIdsound id

Implemented in FmodAudioPlayer.

virtual void playBackgroundMusic ( const char *  pszFilePath,
bool  bLoop = false 
)
pure 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

Implemented in FmodAudioPlayer.

virtual unsigned int playEffect ( const char *  pszFilePath,
bool  bLoop,
float  pitch,
float  pan,
float  gain 
)
pure 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

Implemented in FmodAudioPlayer.

virtual void preloadBackgroundMusic ( const char *  pszFilePath)
pure virtual

Preload background music.

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

Implemented in FmodAudioPlayer.

virtual void preloadEffect ( const char *  pszFilePath)
pure virtual

preload a compressed audio file

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

Implemented in FmodAudioPlayer.

virtual void resumeAllEffects ( )
pure virtual

resume a effect identified by sound id

Implemented in FmodAudioPlayer.

virtual void resumeBackgroundMusic ( )
pure virtual

Resume playing background music.

Implemented in FmodAudioPlayer.

virtual void resumeEffect ( unsigned int  uSoundId)
pure virtual

resume an effect identified by sound id

Parameters
[in]uSoundIdsound id

Implemented in FmodAudioPlayer.

virtual void rewindBackgroundMusic ( )
pure virtual

Rewind playing background music.

Implemented in FmodAudioPlayer.

virtual void setBackgroundMusicVolume ( float  volume)
pure virtual

set the volume of background music

Parameters
volumemust be in 0.0~1.0

Implemented in FmodAudioPlayer.

virtual void setEffectsVolume ( float  volume)
pure virtual

set the volume of sound effecs

Parameters
volumemust be in 0.0~1.0

Implemented in FmodAudioPlayer.

virtual void stopAllEffects ( )
pure virtual

stop all playing effects

Implemented in FmodAudioPlayer.

virtual void stopBackgroundMusic ( bool  bReleaseData = false)
pure virtual

Stop playing background music.

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

Implemented in FmodAudioPlayer.

virtual void stopEffect ( unsigned int  nSoundId)
pure virtual

Stop playing sound effect.

Parameters
nSoundIdThe return value of function playEffect

Implemented in FmodAudioPlayer.

virtual void unloadEffect ( const char *  pszFilePath)
pure virtual

unload the preloaded effect from internal buffer

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

Implemented in FmodAudioPlayer.

virtual bool willPlayBackgroundMusic ( )
pure virtual

Implemented in FmodAudioPlayer.


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