11#include <unordered_map>
12#include <unordered_set>
16#error Do not include in server builds
27 virtual void addThePaths(
const std::string &name, std::vector<std::string> &paths);
63 virtual void step(f32 dtime) = 0;
90 virtual bool loadSoundFile(
const std::string &name,
const std::string &filepath) = 0;
94 virtual bool loadSoundData(
const std::string &name, std::string &&filedata) = 0;
102 const std::string &group_name) = 0;
135 std::vector<sound_handle_t> ret;
159 void step(f32 dtime)
override {}
166 bool loadSoundFile(
const std::string &name,
const std::string &filepath)
override {
return true; }
167 bool loadSoundData(
const std::string &name, std::string &&filedata)
override {
return true; }
168 void addSoundToGroup(
const std::string &sound_name,
const std::string &group_name)
override {};
void playSound(sound_handle_t id, const SoundSpec &spec) override
Plays a random sound from a sound group (position-less).
Definition sound.h:170
void addSoundToGroup(const std::string &sound_name, const std::string &group_name) override
Adds sound with name sound_name to group group_name.
Definition sound.h:168
void pauseAll() override
Pause all sound playback.
Definition sound.h:160
void stopSound(sound_handle_t sound) override
Request the sound to be stopped.
Definition sound.h:173
void step(f32 dtime) override
Removes finished sounds, steps streamed sounds, and does similar tasks.
Definition sound.h:159
void fadeSound(sound_handle_t sound, f32 step, f32 target_gain) override
Definition sound.h:174
bool loadSoundData(const std::string &name, std::string &&filedata) override
Same as loadSoundFile, but reads the OggVorbis file from memory.
Definition sound.h:167
void resumeAll() override
Resume sound playback after pause.
Definition sound.h:161
bool loadSoundFile(const std::string &name, const std::string &filepath) override
Adds a sound to load from a file (only OggVorbis).
Definition sound.h:166
void updateSoundPosVel(sound_handle_t sound, const v3f &pos, const v3f &vel) override
Update position and velocity of positional sound.
Definition sound.h:175
void updateListener(const v3f &pos, const v3f &vel, const v3f &at, const v3f &up) override
Definition sound.h:163
void playSoundAt(sound_handle_t id, const SoundSpec &spec, const v3f &pos, const v3f &vel) override
Same as playSound, but at a position.
Definition sound.h:171
void setListenerGain(f32 gain) override
Definition sound.h:164
virtual void pauseAll()=0
Pause all sound playback.
virtual void playSound(sound_handle_t id, const SoundSpec &spec)=0
Plays a random sound from a sound group (position-less).
virtual void addSoundToGroup(const std::string &sound_name, const std::string &group_name)=0
Adds sound with name sound_name to group group_name.
std::unordered_map< sound_handle_t, u32 > m_occupied_ids
Definition sound.h:48
virtual ~ISoundManager()=default
virtual void step(f32 dtime)=0
Removes finished sounds, steps streamed sounds, and does similar tasks.
std::vector< sound_handle_t > pollRemovedSounds()
Get and reset the list of sounds that were stopped.
Definition sound.h:133
virtual void updateListener(const v3f &pos, const v3f &vel, const v3f &at, const v3f &up)=0
virtual void resumeAll()=0
Resume sound playback after pause.
std::vector< sound_handle_t > m_removed_sounds
Definition sound.h:50
sound_handle_t m_next_id
Definition sound.h:49
virtual void setListenerGain(f32 gain)=0
virtual void stopSound(sound_handle_t sound)=0
Request the sound to be stopped.
virtual void updateSoundPosVel(sound_handle_t sound, const v3f &pos, const v3f &vel)=0
Update position and velocity of positional sound.
void reportRemovedSound(sound_handle_t id)
Definition sound.cpp:53
void freeId(sound_handle_t id, u32 num_owners=1)
Free an id allocated via allocateId.
Definition sound.cpp:74
virtual bool loadSoundData(const std::string &name, std::string &&filedata)=0
Same as loadSoundFile, but reads the OggVorbis file from memory.
sound_handle_t allocateId(u32 num_owners)
Returns a positive id.
Definition sound.cpp:62
virtual void playSoundAt(sound_handle_t id, const SoundSpec &spec, const v3f &pos, const v3f &vel)=0
Same as playSound, but at a position.
virtual bool loadSoundFile(const std::string &name, const std::string &filepath)=0
Adds a sound to load from a file (only OggVorbis).
virtual void fadeSound(sound_handle_t sound, f32 step, f32 target_gain)=0
std::vector< std::string > getLocalFallbackPathsForSoundname(const std::string &name)
Definition sound.cpp:17
virtual ~SoundFallbackPathProvider()=default
std::unordered_set< std::string > m_done_names
Definition sound.h:31
virtual void addThePaths(const std::string &name, std::vector< std::string > &paths)
Definition sound.cpp:46
void addAllAlternatives(const std::string &common, std::vector< std::string > &paths)
Definition sound.cpp:36
constexpr sound_handle_t SOUND_HANDLE_T_MAX
Definition sound.h:43
void sound_volume_control(ISoundManager *sound_mgr, bool is_window_active)
A helper function to control sound volume based on some values: sound volume settings,...
Definition sound.cpp:85
int sound_handle_t
IDs for playing sounds.
Definition sound.h:41
int sound_handle_t
Definition client.h:62
core::vector3df v3f
Definition irr_v3d.h:11
Definition al_extensions.cpp:11
Describes the sound information for playback.
Definition sound.h:20