OpenMW
|
00001 #ifndef GAME_SOUND_SOUND_H 00002 #define GAME_SOUND_SOUND_H 00003 00004 #include <OgreVector3.h> 00005 00006 #include "soundmanagerimp.hpp" 00007 00008 namespace MWSound 00009 { 00010 class Sound 00011 { 00012 virtual void update() = 0; 00013 00014 Sound& operator=(const Sound &rhs); 00015 Sound(const Sound &rhs); 00016 00017 protected: 00018 Ogre::Vector3 mPos; 00019 float mVolume; /* NOTE: Real volume = mVolume*mBaseVolume */ 00020 float mBaseVolume; 00021 float mPitch; 00022 float mMinDistance; 00023 float mMaxDistance; 00024 int mFlags; 00025 float mFadeOutTime; 00026 00027 public: 00028 virtual void stop() = 0; 00029 virtual bool isPlaying() = 0; 00030 virtual double getTimeOffset() = 0; 00031 void setPosition(const Ogre::Vector3 &pos) { mPos = pos; } 00032 void setVolume(float volume) { mVolume = volume; } 00033 void setFadeout(float duration) { mFadeOutTime=duration; } 00034 MWBase::SoundManager::PlayType getPlayType() const 00035 { return (MWBase::SoundManager::PlayType)(mFlags&MWBase::SoundManager::Play_TypeMask); } 00036 00037 00038 Sound(const Ogre::Vector3& pos, float vol, float basevol, float pitch, float mindist, float maxdist, int flags) 00039 : mPos(pos) 00040 , mVolume(vol) 00041 , mBaseVolume(basevol) 00042 , mPitch(pitch) 00043 , mMinDistance(mindist) 00044 , mMaxDistance(maxdist) 00045 , mFlags(flags) 00046 , mFadeOutTime(0) 00047 { } 00048 virtual ~Sound() { } 00049 00050 friend class OpenAL_Output; 00051 friend class SoundManager; 00052 }; 00053 } 00054 00055 #endif