mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-10 15:39:02 +00:00
be337ef7cc
Note that each Sound object currently contains "precious" resources even after the sound is stopped. The reference should be reliquished as soon as it's no longer needed (the SoundManager will make sure the sound continues to play until it's finished).
37 lines
860 B
C++
37 lines
860 B
C++
#ifndef GAME_SOUND_SOUND_H
|
|
#define GAME_SOUND_SOUND_H
|
|
|
|
namespace MWSound
|
|
{
|
|
class Sound
|
|
{
|
|
virtual void update(const float *pos) = 0;
|
|
|
|
Sound& operator=(const Sound &rhs);
|
|
Sound(const Sound &rhs);
|
|
|
|
protected:
|
|
float mVolume; /* NOTE: Real volume = mVolume*mBaseVolume */
|
|
float mBaseVolume;
|
|
float mMinDistance;
|
|
float mMaxDistance;
|
|
|
|
public:
|
|
virtual void stop() = 0;
|
|
virtual bool isPlaying() = 0;
|
|
virtual void setVolume(float volume) = 0;
|
|
|
|
Sound() : mVolume(1.0f)
|
|
, mBaseVolume(1.0f)
|
|
, mMinDistance(20.0f) /* 1 * min_range_scale */
|
|
, mMaxDistance(12750.0f) /* 255 * max_range_scale */
|
|
{ }
|
|
virtual ~Sound() { }
|
|
|
|
friend class OpenAL_Output;
|
|
friend class SoundManager;
|
|
};
|
|
}
|
|
|
|
#endif
|