29 #include "common/thread/worker_thread.h" 33 #include "sound/oalsound/check.h" 52 : music(std::move(other.music)),
53 fadeTime(std::move(other.fadeTime)),
54 currentTime(std::move(other.currentTime))
59 music = std::move(other.music);
60 fadeTime = std::move(other.fadeTime);
61 currentTime = std::move(other.currentTime);
65 std::unique_ptr<CChannel> music;
66 float fadeTime = 0.0f;
67 float currentTime = 0.0f;
71 return l.currentTime < r.currentTime;
76 return l.currentTime == r.currentTime;
86 bool Create()
override;
87 bool Cache(
SoundType,
const std::string &)
override;
88 void CacheMusic(
const std::string &)
override;
90 bool IsCachedMusic(
const std::string &)
override;
92 bool GetEnable()
override;
93 void SetAudioVolume(
int volume)
override;
94 int GetAudioVolume()
override;
95 void SetMusicVolume(
int volume)
override;
96 int GetMusicVolume()
override;
99 void FrameMove(
float rTime)
override;
101 int Play(
SoundType sound,
float amplitude=1.0f,
float frequency=1.0f,
bool loop =
false)
override;
102 int Play(
SoundType sound,
const Math::Vector &pos,
float amplitude=1.0f,
float frequency=1.0f,
bool loop =
false)
override;
103 bool FlushEnvelope(
int channel)
override;
104 bool AddEnvelope(
int channel,
float amplitude,
float frequency,
float time,
SoundNext oper)
override;
105 bool Position(
int channel,
const Math::Vector &pos)
override;
106 bool Frequency(
int channel,
float frequency)
override;
107 bool Stop(
int channel)
override;
108 bool StopAll()
override;
109 bool MuteAll(
bool mute)
override;
111 void PlayMusic(
const std::string &filename,
bool repeat,
float fadeTime = 2.0f)
override;
112 void StopMusic(
float fadeTime=2.0f)
override;
113 bool IsPlayingMusic()
override;
114 void PlayPauseMusic(
const std::string &filename,
bool repeat)
override;
115 void StopPauseMusic()
override;
120 bool SearchFreeBuffer(
SoundType sound,
int &channel,
bool &alreadyLoaded);
121 bool CheckChannel(
int &channel);
126 unsigned int m_channelsLimit;
128 ALCcontext* m_context;
129 std::map<SoundType, std::unique_ptr<CBuffer>> m_sounds;
130 std::map<std::string, std::unique_ptr<CBuffer>> m_music;
131 std::map<int, std::unique_ptr<CChannel>> m_channels;
132 std::unique_ptr<CChannel> m_currentMusic;
133 std::list<OldMusic> m_oldMusic;
SoundNext
Enum representing operation that will be performend on a sound at given time.
Definition: sound.h:46
SoundType
Enum representing sound file.
Definition: sound_type.h:34
3D (3x1) vector
Definition: vector.h:53
Sound plugin interface.
Definition: sound.h:60
Thread that runs functions, one at a time.
Definition: worker_thread.h:36