2 #include "IParaAudioEngine.h" 3 #include "util/intrusive_ptr.h" 12 CAudioSource2(
const char* sName,
IParaAudioSource* pSource=NULL):m_name(sName), m_pSource(pSource), m_nLoopCount(0), m_status(AUDIO_FLAG_Uninitialized), m_bReleaseOnStop(
false), m_bIsAsyncLoadingWhileLoopPlaying(
false){}
35 void SetName(
const char* sName) {m_name = sName;}
38 const std::string&
GetName()
const {
return m_name;}
46 m_pSource->registerEventHandler(
this);
48 m_pSource->unRegisterAllEventHandlers();
62 bool play2d(
const bool& toLoop =
false,
bool bIgnoreIfPlaying =
true);
69 bool play3d(
const PARAVECTOR3& position,
const float& soundstr = 1.0 ,
const bool& toLoop =
false);
79 void loop(
const bool& toLoop);
82 bool IsAsyncLoadingWhileLoopPlaying();
85 bool IsWaveFileLoopPlaying();
97 virtual void onUpdate();
100 virtual void onRelease();
103 virtual void onPlay();
106 virtual void onStop();
109 virtual void onPause();
115 bool m_bReleaseOnStop;
121 typedef ParaIntrusivePtr<CAudioSource2> CAudioSource2_ptr;
131 typedef std::map<std::string, CAudioSource2_ptr> AudioFileMap_type;
146 void CleanupAudioEngine();
158 void EnableAudioEngine(
bool bEnable);
165 void SetGlobalVolume(
const float& volume);
168 void OnSwitch(
bool bOn);
176 CAudioSource2_ptr Create(
const char* sName,
const char* sWavePath=NULL,
bool bStream=
false);
179 CAudioSource2_ptr Get(
const char* sName);
187 CAudioSource2_ptr CreateGet(
const char* sName,
const char* sWavePath=NULL,
bool bStream=
false);
190 void release(CAudioSource2_ptr& audio_src);
215 HRESULT PlayWaveFile(
const char* sWavePath,
bool bLoop=
false,
bool bStream=
false,
int dwPlayOffset=0);
222 HRESULT PrepareWaveFile(CAudioSource2_ptr& pWave,
const char* sWavePath,
bool bStream =
false);
239 HRESULT ReleaseWaveFile(
const std::string& szWavePath);
244 bool IsWaveFileInQueue(
const std::string& filename);
247 bool IsWaveFileLoopPlaying(
const std::string& filename);
313 bool m_bEnableAudioEngine;
314 AudioFileMap_type m_audio_file_map;
315 std::vector<CAudioSource2_ptr> m_paused_audios;
316 float m_fGlobalVolume;
317 float m_fGlobalVolumeBeforeSwitch;
318 bool m_bAutoMoveListener;
bool IsValidAndEnabled()
return true if the audio is both valid and enabled.
Definition: AudioEngine2.h:152
void SetSource(IParaAudioSource *pSource)
reset the source.
Definition: AudioEngine2.h:25
different physics engine has different winding order.
Definition: EventBinding.h:32
bool m_bIsAsyncLoadingWhileLoopPlaying
this is true, if an audio resource is being loop played but without being downloaded yet...
Definition: AudioEngine2.h:119
CAudioEngine2 is based on the cAudioEngine plugin dll.
Definition: AudioEngine2.h:128
float GetGlobalVolume()
Returns the global volume modifier for all sources.
Definition: AudioEngine2.h:161
it represent an audio engine source
Definition: AudioEngine2.h:9
bool IsAudioEngineEnabled()
get is audio engine enabled
Definition: AudioEngine2.h:155
ParaAudioFlagsEnum
Audio flags.
Definition: IParaAudioEngine.h:16
an audio source
Definition: IParaAudioEngine.h:55
const std::string & GetName() const
get the name
Definition: AudioEngine2.h:38
void EnableCallback(bool bEnable=true)
this function must be called before the music is played.
Definition: AudioEngine2.h:41
ParaAudioEngine core interface.
Definition: IParaAudioEngine.h:278
Definition: PEtypes.h:298
single-threaded reference counted base class for boost::intrusive_ptr all boost::intrusive_ptr<T>, should derive from this class.
Definition: intrusive_ptr.h:75
void SetName(const char *sName)
set the name
Definition: AudioEngine2.h:35
Interface for event handlers on Audio Sources.
Definition: IParaAudioEngine.h:35
void SetAutoMoveListener(bool bAuto)
whether to automatically move the listener according to current camera position.
Definition: AudioEngine2.h:197
bool GetAutoMoveListener()
whether to automatically move the listener according to current camera position.
Definition: AudioEngine2.h:200
ParaAudioDistanceModelEnum
Audio flags.
Definition: IParaAudioEngine.h:23