00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _XAUDIO2SOUNDEFFECT_
00019 #define _XAUDIO2SOUNDEFFECT_
00020
00021 #include <xaudio2.h>
00022
00023 #include "sound/AbstractSoundEffect.h"
00024
00025 class XAudio2AudioSystem;
00026
00027 class XAudio2SoundEffect : public AbstractSoundEffect
00028 {
00029 private:
00030 XAUDIO2_BUFFER m_audioBuffer;
00031 SoundResourceHandlePtr m_pSoundResource;
00032 IXAudio2SourceVoice* m_pSourceVoice;
00033 XAudio2AudioSystem* m_pSoundSystem;
00034
00035 bool m_bPlaying;
00036 bool m_bPaused;
00037 bool m_bLooping;
00038 public:
00039 XAudio2SoundEffect()
00040 :m_bPlaying(false), m_bPaused(false), m_bLooping(false), m_pSourceVoice(0), m_pSoundSystem(0)
00041 {
00042 }
00043
00044 bool Initialize(XAudio2AudioSystem* pAudioSystem, SoundResourceHandlePtr pSoundResource);
00045
00046 virtual void Play(const int nVolume, bool bLoop);
00047 virtual void Stop();
00048 virtual void Pause();
00049 virtual void Resume();
00050
00051 virtual void SetVolume(const int nVolume);
00052 virtual bool IsPlaying();
00053 virtual SoundResourceHandlePtr GetResource() { return m_pSoundResource; }
00054 };
00055
00056 #endif