#include <sound_manager.h>
Inheritance diagram for sound::OpenALSoundManager:
Collaboration diagram for sound::OpenALSoundManager:Public Member Functions | |
| OpenALSoundManager (SoundManagerSingleton *smg, std::unique_ptr< SoundFallbackPathProvider > fallback_path_provider) | |
| ~OpenALSoundManager () override | |
Public Member Functions inherited from Thread | |
| Thread (const std::string &name="") | |
| virtual | ~Thread () |
| bool | start () |
| bool | stop () |
| bool | wait () |
| bool | isCurrentThread () |
| bool | isRunning () |
| bool | stopRequested () |
| std::thread::id | getThreadId () |
| bool | getReturnValue (void **ret) |
| bool | bindToProcessor (unsigned int proc_number) |
| bool | setPriority (int prio) |
Public Attributes | |
| MutexedQueue< SoundManagerMsgToMgr > | m_queue_to_mgr |
| MutexedQueue< SoundManagerMsgToProxy > | m_queue_to_proxy |
Protected Member Functions | |
| void * | run () override |
Private Member Functions | |
| void | stepStreams (f32 dtime) |
| void | doFades (f32 dtime) |
| std::shared_ptr< ISoundDataOpen > | openSingleSound (const std::string &sound_name) |
| Gives the open sound for a loaded sound. | |
| std::string | getLoadedSoundNameFromGroup (const std::string &group_name) |
| Gets a random sound name from a group. | |
| std::string | getOrLoadLoadedSoundNameFromGroup (const std::string &group_name) |
Same as getLoadedSoundNameFromGroup, but if sound does not exist, try to load from local files. | |
| std::shared_ptr< PlayingSound > | createPlayingSound (const std::string &sound_name, bool loop, f32 volume, f32 pitch, f32 start_time, const std::optional< std::pair< v3f, v3f > > &pos_vel_opt) |
| void | playSoundGeneric (sound_handle_t id, const std::string &group_name, bool loop, f32 volume, f32 fade, f32 pitch, bool use_local_fallback, f32 start_time, const std::optional< std::pair< v3f, v3f > > &pos_vel_opt) |
| int | removeDeadSounds () |
| Deletes sounds that are dead (=finished). | |
| void | step (f32 dtime) |
| void | pauseAll () |
| void | resumeAll () |
| void | updateListener (const v3f &pos_, const v3f &vel_, const v3f &at_, const v3f &up_) |
| void | setListenerGain (f32 gain) |
| bool | loadSoundFile (const std::string &name, const std::string &filepath) |
| bool | loadSoundData (const std::string &name, std::string &&filedata) |
| void | loadSoundFileNoCheck (const std::string &name, const std::string &filepath) |
| void | loadSoundDataNoCheck (const std::string &name, std::string &&filedata) |
| void | addSoundToGroup (const std::string &sound_name, const std::string &group_name) |
| void | playSound (sound_handle_t id, const SoundSpec &spec) |
| void | playSoundAt (sound_handle_t id, const SoundSpec &spec, const v3f &pos_, const v3f &vel_) |
| void | stopSound (sound_handle_t sound) |
| void | fadeSound (sound_handle_t soundid, f32 step, f32 target_gain) |
| void | updateSoundPosVel (sound_handle_t sound, const v3f &pos_, const v3f &vel_) |
| void | send (SoundManagerMsgToProxy msg) |
| void | reportRemovedSound (sound_handle_t id) |
Private Attributes | |
| std::unique_ptr< SoundFallbackPathProvider > | m_fallback_path_provider |
| ALCdevice *const | m_device |
| ALCcontext *const | m_context |
| const ALExtensions | m_exts |
| f32 | m_time_until_dead_removal = REMOVE_DEAD_SOUNDS_INTERVAL |
| std::unordered_map< std::string, std::unique_ptr< ISoundDataUnopen > > | m_sound_datas_unopen |
| std::unordered_map< std::string, std::shared_ptr< ISoundDataOpen > > | m_sound_datas_open |
| std::unordered_map< std::string, std::vector< std::string > > | m_sound_groups |
| std::unordered_map< sound_handle_t, std::shared_ptr< PlayingSound > > | m_sounds_playing |
| std::vector< std::weak_ptr< PlayingSound > > | m_sounds_streaming_current_bigstep |
| std::vector< std::weak_ptr< PlayingSound > > | m_sounds_streaming_next_bigstep |
| f32 | m_stream_timer = STREAM_BIGSTEP_TIME |
| std::vector< std::weak_ptr< PlayingSound > > | m_sounds_fading |
| bool | m_is_paused = false |
| std::unordered_set< std::string > | m_warned_positional_stereo_sounds |
Additional Inherited Members | |
Static Public Member Functions inherited from Thread | |
| static Thread * | getCurrentThread () |
| static void | setName (const std::string &name) |
| static unsigned int | getNumberOfProcessors () |
Protected Attributes inherited from Thread | |
| std::string | m_name |
| sound::OpenALSoundManager::OpenALSoundManager | ( | SoundManagerSingleton * | smg, |
| std::unique_ptr< SoundFallbackPathProvider > | fallback_path_provider ) |
References infostream, m_fallback_path_provider, and SANITY_CHECK.
|
override |
References infostream.
|
private |
References m_sound_groups.
Referenced by getOrLoadLoadedSoundNameFromGroup(), and run().
Here is the caller graph for this function:
|
private |
References errorstream, infostream, m_exts, m_warned_positional_stereo_sounds, openSingleSound(), sound::warn_if_al_error(), and warningstream.
Referenced by playSoundGeneric().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
|
private |
References m_sounds_fading, m_sounds_playing, and step().
Referenced by playSoundGeneric(), and run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Gets a random sound name from a group.
| group_name | The name of the sound group. |
openSingleSound directly afterwards will not fail. References m_sound_groups, myrand(), and openSingleSound().
Referenced by getOrLoadLoadedSoundNameFromGroup(), and playSoundGeneric().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Same as getLoadedSoundNameFromGroup, but if sound does not exist, try to load from local files.
References addSoundToGroup(), getLoadedSoundNameFromGroup(), SoundFallbackPathProvider::getLocalFallbackPathsForSoundname(), loadSoundFile(), and m_fallback_path_provider.
Referenced by playSoundGeneric().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
References loadSoundDataNoCheck(), m_sound_datas_open, and m_sound_datas_unopen.
Here is the call graph for this function:
|
private |
References m_sound_datas_unopen.
Referenced by loadSoundData(), and run().
Here is the caller graph for this function:
|
private |
References fs::IsFile(), loadSoundFileNoCheck(), m_sound_datas_open, and m_sound_datas_unopen.
Referenced by getOrLoadLoadedSoundNameFromGroup().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
References m_sound_datas_unopen.
Referenced by loadSoundFile(), and run().
Here is the caller graph for this function:
|
private |
Gives the open sound for a loaded sound.
Opens the sound if currently unopened.
| sound_name | Name of the sound. |
References m_sound_datas_open, and m_sound_datas_unopen.
Referenced by createPlayingSound(), and getLoadedSoundNameFromGroup().
Here is the caller graph for this function:
|
private |
References m_is_paused, m_sounds_playing, and sound::PlayingSound::pause().
Referenced by run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
References SoundSpec::fade, SoundSpec::gain, SoundSpec::loop, SoundSpec::name, SoundSpec::pitch, playSoundGeneric(), SoundSpec::start_time, and SoundSpec::use_local_fallback.
Referenced by run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
References SoundSpec::fade, SoundSpec::gain, SoundSpec::loop, SoundSpec::name, SoundSpec::pitch, playSoundGeneric(), SoundSpec::start_time, sound::swap_handedness(), and SoundSpec::use_local_fallback.
Referenced by run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
References createPlayingSound(), fadeSound(), getLoadedSoundNameFromGroup(), getOrLoadLoadedSoundNameFromGroup(), infostream, m_sounds_playing, m_sounds_streaming_next_bigstep, reportRemovedSound(), and warningstream.
Referenced by playSound(), and playSoundAt().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Deletes sounds that are dead (=finished).
References m_sounds_playing, and reportRemovedSound().
Referenced by step().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineprivate |
References send().
Referenced by playSoundGeneric(), removeDeadSounds(), and stopSound().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
References m_is_paused, m_sounds_playing, and sound::PlayingSound::resume().
Referenced by run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overrideprotectedvirtual |
Implements Thread.
References addSoundToGroup(), fadeSound(), porting::getTimeMs(), loadSoundDataNoCheck(), loadSoundFileNoCheck(), m_queue_to_mgr, pauseAll(), playSound(), playSoundAt(), MutexedQueue< T >::pop_frontNoEx(), resumeAll(), send(), setListenerGain(), sound::SOUNDTHREAD_DTIME, FrameMarker::started(), step(), stopSound(), updateListener(), and updateSoundPosVel().
Here is the call graph for this function:
|
inlineprivate |
References m_queue_to_proxy, and MutexedQueue< T >::push_back().
Referenced by reportRemovedSound(), and run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
|
private |
References doFades(), m_sound_datas_open, m_sound_datas_unopen, m_sound_groups, m_sounds_playing, m_time_until_dead_removal, sound::REMOVE_DEAD_SOUNDS_INTERVAL, removeDeadSounds(), stepStreams(), and verbosestream.
Referenced by fadeSound(), and run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
References m_sounds_streaming_current_bigstep, m_sounds_streaming_next_bigstep, m_stream_timer, and sound::STREAM_BIGSTEP_TIME.
Referenced by step().
Here is the caller graph for this function:
|
private |
References m_sounds_playing, and reportRemovedSound().
Referenced by run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
References sound::swap_handedness(), and sound::warn_if_al_error().
Referenced by run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
References m_sounds_playing, and sound::swap_handedness().
Referenced by run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
|
private |
|
private |
Referenced by createPlayingSound().
|
private |
Referenced by OpenALSoundManager(), and getOrLoadLoadedSoundNameFromGroup().
|
private |
Referenced by pauseAll(), and resumeAll().
| MutexedQueue<SoundManagerMsgToMgr> sound::OpenALSoundManager::m_queue_to_mgr |
Referenced by run(), and sound::ProxySoundManager::send().
| MutexedQueue<SoundManagerMsgToProxy> sound::OpenALSoundManager::m_queue_to_proxy |
Referenced by sound::ProxySoundManager::~ProxySoundManager(), send(), and sound::ProxySoundManager::step().
|
private |
Referenced by loadSoundData(), loadSoundFile(), openSingleSound(), and step().
|
private |
Referenced by loadSoundData(), loadSoundDataNoCheck(), loadSoundFile(), loadSoundFileNoCheck(), openSingleSound(), and step().
|
private |
Referenced by addSoundToGroup(), getLoadedSoundNameFromGroup(), and step().
|
private |
Referenced by doFades(), and fadeSound().
|
private |
Referenced by fadeSound(), pauseAll(), playSoundGeneric(), removeDeadSounds(), resumeAll(), step(), stopSound(), and updateSoundPosVel().
|
private |
Referenced by stepStreams().
|
private |
Referenced by playSoundGeneric(), and stepStreams().
|
private |
Referenced by stepStreams().
|
private |
Referenced by step().
|
private |
Referenced by createPlayingSound().