#include <sound.h>
Inheritance diagram for ISoundManager:
Collaboration diagram for ISoundManager:Public Member Functions | |
| virtual | ~ISoundManager ()=default |
| virtual void | step (f32 dtime)=0 |
| Removes finished sounds, steps streamed sounds, and does similar tasks. | |
| virtual void | pauseAll ()=0 |
| Pause all sound playback. | |
| virtual void | resumeAll ()=0 |
| Resume sound playback after pause. | |
| virtual void | updateListener (const v3f &pos, const v3f &vel, const v3f &at, const v3f &up)=0 |
| virtual void | setListenerGain (f32 gain)=0 |
| virtual bool | loadSoundFile (const std::string &name, const std::string &filepath)=0 |
| Adds a sound to load from a file (only OggVorbis). | |
| virtual bool | loadSoundData (const std::string &name, std::string &&filedata)=0 |
Same as loadSoundFile, but reads the OggVorbis file from memory. | |
| virtual void | addSoundToGroup (const std::string &sound_name, const std::string &group_name)=0 |
Adds sound with name sound_name to group group_name. | |
| virtual void | playSound (sound_handle_t id, const SoundSpec &spec)=0 |
| Plays a random sound from a sound group (position-less). | |
| 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 void | stopSound (sound_handle_t sound)=0 |
| Request the sound to be stopped. | |
| virtual void | fadeSound (sound_handle_t sound, f32 step, f32 target_gain)=0 |
| virtual void | updateSoundPosVel (sound_handle_t sound, const v3f &pos, const v3f &vel)=0 |
| Update position and velocity of positional sound. | |
| std::vector< sound_handle_t > | pollRemovedSounds () |
| Get and reset the list of sounds that were stopped. | |
| sound_handle_t | allocateId (u32 num_owners) |
| Returns a positive id. | |
| void | freeId (sound_handle_t id, u32 num_owners=1) |
| Free an id allocated via allocateId. | |
Protected Member Functions | |
| void | reportRemovedSound (sound_handle_t id) |
Private Attributes | |
| std::unordered_map< sound_handle_t, u32 > | m_occupied_ids |
| sound_handle_t | m_next_id = 1 |
| std::vector< sound_handle_t > | m_removed_sounds |
|
virtualdefault |
|
pure virtual |
Adds sound with name sound_name to group group_name.
Creates the group if non-existent.
| sound_name | The name of the sound, as used in loadSoundData. |
| group_name | The name of the sound group. |
Implemented in DummySoundManager, and sound::ProxySoundManager.
Referenced by Client::loadMedia().
Here is the caller graph for this function:| sound_handle_t ISoundManager::allocateId | ( | u32 | num_owners | ) |
Returns a positive id.
The id will be returned again until freeId is called.
| num_owners | Owner-counter for id. Set this to 2, if you want to play a sound and store the id also otherwhere. |
References m_next_id, m_occupied_ids, myrand(), and SOUND_HANDLE_T_MAX.
Referenced by Client::handleCommand_PlaySound(), ModApiClientSound::l_sound_play(), ModApiMainMenuSound::l_sound_play(), sound::ProxySoundManager::playSound(), and sound::ProxySoundManager::playSoundAt().
Here is the call graph for this function:
Here is the caller graph for this function:
|
pure virtual |
Implemented in DummySoundManager, and sound::ProxySoundManager.
Referenced by Client::handleCommand_FadeSound().
Here is the caller graph for this function:| void ISoundManager::freeId | ( | sound_handle_t | id, |
| u32 | num_owners = 1 ) |
Free an id allocated via allocateId.
| num_owners | How much the owner-counter should be decreased. Id can be reused when counter reaches 0. |
References m_occupied_ids.
Referenced by Client::~Client(), Client::handleCommand_PlaySound(), reportRemovedSound(), and Client::step().
Here is the caller graph for this function:
|
pure virtual |
Same as loadSoundFile, but reads the OggVorbis file from memory.
Implemented in DummySoundManager, and sound::ProxySoundManager.
Referenced by Client::loadMedia().
Here is the caller graph for this function:
|
pure virtual |
Adds a sound to load from a file (only OggVorbis).
| name | The name of the sound. Must be unique, otherwise call fails. |
| filepath | The path for |
Implemented in DummySoundManager, and sound::ProxySoundManager.
|
pure virtual |
Pause all sound playback.
Implemented in DummySoundManager, and sound::ProxySoundManager.
Referenced by Game::updatePauseState().
Here is the caller graph for this function:
|
pure virtual |
Plays a random sound from a sound group (position-less).
| id | Id for new sound. Move semantics apply if id > 0. |
Implemented in DummySoundManager, and sound::ProxySoundManager.
Referenced by SoundMaker::cameraPunchLeft(), SoundMaker::cameraPunchRight(), Client::handleCommand_PlaySound(), ModApiClientSound::l_sound_play(), ModApiMainMenuSound::l_sound_play(), SoundMaker::nodeDug(), GUIFormSpecMenu::OnEvent(), SoundMaker::playerDamage(), SoundMaker::playerFallingDamage(), SoundMaker::playPlayerJump(), and SoundMaker::playPlayerStep().
Here is the caller graph for this function:
|
pure virtual |
Same as playSound, but at a position.
| pos | In node-space. |
| vel | In node-space. |
Implemented in DummySoundManager, and sound::ProxySoundManager.
Referenced by Client::handleCommand_PlaySound(), ModApiClientSound::l_sound_play(), and GenericCAO::step().
Here is the caller graph for this function:
|
inline |
Get and reset the list of sounds that were stopped.
References m_removed_sounds.
Referenced by Client::step().
Here is the caller graph for this function:
|
protected |
References freeId(), and m_removed_sounds.
Referenced by sound::ProxySoundManager::handleMsg(), DummySoundManager::playSound(), and DummySoundManager::playSoundAt().
Here is the call graph for this function:
Here is the caller graph for this function:
|
pure virtual |
Resume sound playback after pause.
Implemented in DummySoundManager, and sound::ProxySoundManager.
Referenced by Game::updatePauseState().
Here is the caller graph for this function:
|
pure virtual |
Implemented in DummySoundManager, and sound::ProxySoundManager.
Referenced by sound_volume_control().
Here is the caller graph for this function:
|
pure virtual |
Removes finished sounds, steps streamed sounds, and does similar tasks.
Should not be called while paused.
| dtime | In seconds. |
Implemented in DummySoundManager, and sound::ProxySoundManager.
Referenced by GUIEngine::run(), and Client::step().
Here is the caller graph for this function:
|
pure virtual |
Request the sound to be stopped.
The id should be freed afterwards.
Implemented in DummySoundManager, and sound::ProxySoundManager.
Referenced by Client::handleCommand_StopSound().
Here is the caller graph for this function:
|
pure virtual |
| pos | In node-space. |
| vel | In node-space. |
| at | Vector in node-space pointing forwards. |
| up | Vector in node-space pointing upwards, orthogonal to at. |
Implemented in DummySoundManager, and sound::ProxySoundManager.
Referenced by Game::updateSound().
Here is the caller graph for this function:
|
pure virtual |
Update position and velocity of positional sound.
| pos | In node-space. |
| vel | In node-space. |
Implemented in DummySoundManager, and sound::ProxySoundManager.
Referenced by Client::step().
Here is the caller graph for this function:
|
private |
Referenced by allocateId().
|
private |
Referenced by allocateId(), and freeId().
|
private |
Referenced by pollRemovedSounds(), and reportRemovedSound().