2012-03-17 09:45:18 +00:00
|
|
|
#ifndef GAME_SOUND_SOUND_H
|
|
|
|
#define GAME_SOUND_SOUND_H
|
|
|
|
|
2012-03-30 13:41:06 +00:00
|
|
|
#include <OgreVector3.h>
|
|
|
|
|
2012-08-09 12:33:21 +00:00
|
|
|
#include "soundmanagerimp.hpp"
|
2012-07-16 19:54:04 +00:00
|
|
|
|
2012-03-17 09:45:18 +00:00
|
|
|
namespace MWSound
|
|
|
|
{
|
|
|
|
class Sound
|
|
|
|
{
|
2012-03-30 14:01:37 +00:00
|
|
|
virtual void update() = 0;
|
2012-03-17 09:45:18 +00:00
|
|
|
|
2012-03-24 10:49:03 +00:00
|
|
|
Sound& operator=(const Sound &rhs);
|
|
|
|
Sound(const Sound &rhs);
|
|
|
|
|
2012-03-28 11:58:47 +00:00
|
|
|
protected:
|
2012-03-30 13:41:06 +00:00
|
|
|
Ogre::Vector3 mPos;
|
2012-03-28 11:58:47 +00:00
|
|
|
float mVolume; /* NOTE: Real volume = mVolume*mBaseVolume */
|
|
|
|
float mBaseVolume;
|
2012-03-31 17:41:12 +00:00
|
|
|
float mPitch;
|
2012-03-28 11:58:47 +00:00
|
|
|
float mMinDistance;
|
|
|
|
float mMaxDistance;
|
2012-03-31 15:14:39 +00:00
|
|
|
int mFlags;
|
2013-07-26 16:43:06 +00:00
|
|
|
float mFadeOutTime;
|
2012-03-28 11:58:47 +00:00
|
|
|
|
2014-07-28 22:26:26 +00:00
|
|
|
std::vector<float> mLoudnessVector;
|
|
|
|
float mLoudnessFPS;
|
|
|
|
|
2012-03-17 09:45:18 +00:00
|
|
|
public:
|
2012-03-28 13:08:25 +00:00
|
|
|
virtual void stop() = 0;
|
|
|
|
virtual bool isPlaying() = 0;
|
2012-12-13 00:50:35 +00:00
|
|
|
virtual double getTimeOffset() = 0;
|
2012-03-31 08:34:26 +00:00
|
|
|
void setPosition(const Ogre::Vector3 &pos) { mPos = pos; }
|
2012-03-30 14:10:34 +00:00
|
|
|
void setVolume(float volume) { mVolume = volume; }
|
2013-07-26 16:43:06 +00:00
|
|
|
void setFadeout(float duration) { mFadeOutTime=duration; }
|
2014-07-28 22:26:26 +00:00
|
|
|
void setLoudnessVector(const std::vector<float>& loudnessVector, float loudnessFPS);
|
|
|
|
|
|
|
|
/// Get loudness at the current time position on a [0,1] scale.
|
|
|
|
/// Requires that loudnessVector was filled in by the user.
|
|
|
|
float getCurrentLoudness();
|
|
|
|
|
2012-12-18 10:01:04 +00:00
|
|
|
MWBase::SoundManager::PlayType getPlayType() const
|
|
|
|
{ return (MWBase::SoundManager::PlayType)(mFlags&MWBase::SoundManager::Play_TypeMask); }
|
|
|
|
|
|
|
|
|
2012-12-18 07:35:20 +00:00
|
|
|
Sound(const Ogre::Vector3& pos, float vol, float basevol, float pitch, float mindist, float maxdist, int flags)
|
|
|
|
: mPos(pos)
|
|
|
|
, mVolume(vol)
|
|
|
|
, mBaseVolume(basevol)
|
|
|
|
, mPitch(pitch)
|
|
|
|
, mMinDistance(mindist)
|
|
|
|
, mMaxDistance(maxdist)
|
|
|
|
, mFlags(flags)
|
2013-07-26 16:43:06 +00:00
|
|
|
, mFadeOutTime(0)
|
2014-07-28 22:26:26 +00:00
|
|
|
, mLoudnessFPS(20)
|
2012-03-28 11:58:47 +00:00
|
|
|
{ }
|
2012-03-17 09:45:18 +00:00
|
|
|
virtual ~Sound() { }
|
|
|
|
|
|
|
|
friend class OpenAL_Output;
|
|
|
|
friend class SoundManager;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|