Definition at line 53 of file SoundManager.h.
|
| void | UpdateAlListener () |
| |
| void | UpdateListenerEnvironment () |
| |
| void | recomputeAllSources () |
| |
| void | recomputeSource (int source_index, int reason, float vfl, Ogre::Vector3 *vvec) |
| |
| ALuint | getHardwareSource (int hardware_index) |
| |
| void | assign (int source_index, int hardware_index) |
| |
| void | retire (int source_index) |
| |
| bool | loadWAVFile (Ogre::String filename, ALuint buffer, Ogre::String resource_group_name="") |
| |
| ALuint | CreateAlEffect (const EFXEAXREVERBPROPERTIES *efx_properties) const |
| |
| void | DeleteAlEffect (const ALuint efx_effect_id) const |
| |
| void | PrepopulateEfxPropertiesMap () |
| |
| void | UpdateListenerEffectSlot (const float dt) |
| |
| void | SmoothlyUpdateAlAuxiliaryEffectSlot (const float dt, const ALuint slot_id, const EFXEAXREVERBPROPERTIES *target_efx_properties) |
| |
| std::tuple< Ogre::Vector3, float, float > | ComputeEarlyReflectionsProperties () const |
| |
| void | UpdateSourceFilters (const int hardware_index) const |
| |
| bool | IsHardwareSourceObstructed (const int hardware_index) const |
| |
| void | UpdateObstructionFilter (const int hardware_index, const bool enable_obstruction_filter) const |
| |
| bool | UpdateOcclusionFilter (const int hardware_index, const ALuint effect_slot_id, const EFXEAXREVERBPROPERTIES *reference_efx_reverb_properties) const |
| |
| void | UpdateDirectedSounds () const |
| |
| void | UpdateConeProperties (const ALuint source, const Ogre::Vector3 &cone_direction, const float cone_inner_angle, const float cone_outer_angle, const float cone_outer_gain, const float cone_outer_gain_hf) const |
| |
◆ SoundManager()
| SoundManager::SoundManager |
( |
| ) |
|
◆ ~SoundManager()
| SoundManager::~SoundManager |
( |
| ) |
|
◆ assign()
| void SoundManager::assign |
( |
int |
source_index, |
|
|
int |
hardware_index |
|
) |
| |
|
private |
Adds an audio source to hardware source.
- Parameters
-
| source_index | Index of the audio source. |
| hardware_index | Index of the hardware source to which the audio source will be assigned. |
Definition at line 1412 of file SoundManager.cpp.
◆ CleanUp()
| void SoundManager::CleanUp |
( |
| ) |
|
Cleans up various objects that should be reset when returning from a terrain to the main menu.
Definition at line 293 of file SoundManager.cpp.
◆ ComputeEarlyReflectionsProperties()
| std::tuple< Ogre::Vector3, float, float > SoundManager::ComputeEarlyReflectionsProperties |
( |
| ) |
const |
|
private |
Detects surfaces close to the listener and calculates a user-relative (as opposed to listener-relative) panning vector for early reflections as well as gain and delay values for early reflections based on surface distance.
- Returns
- A tuple of user-relative panning vector, gain and delay for early reflections
Definition at line 738 of file SoundManager.cpp.
◆ CreateAlEffect()
| ALuint SoundManager::CreateAlEffect |
( |
const EFXEAXREVERBPROPERTIES * |
efx_properties | ) |
const |
|
private |
Creates an OpenAL effect based on the parameters of an efx/eax reverb preset.
- Parameters
-
| efx_properties | EFXEAXREVERBPROPERTIES object holding the parameters of the reverb preset. |
- See also
AL/efx-presets.h from OpenAL
Definition at line 854 of file SoundManager.cpp.
◆ createSound()
| SoundPtr SoundManager::createSound |
( |
Ogre::String |
filename, |
|
|
Ogre::String |
resource_group_name = "" |
|
) |
| |
- Parameters
-
| filename | WAV file. |
| resource_group_name | Leave empty to auto-search all groups (classic behavior). |
Definition at line 1476 of file SoundManager.cpp.
◆ DeleteAlEffect()
| void SoundManager::DeleteAlEffect |
( |
const ALuint |
efx_effect_id | ) |
const |
|
private |
Deletes an OpenAL effect.
- Parameters
-
| effect_id | ID of the effect targeted for removal. |
Definition at line 927 of file SoundManager.cpp.
◆ GetAirAbsorptionFactor()
| float RoR::SoundManager::GetAirAbsorptionFactor |
( |
| ) |
const |
|
inline |
- Returns
- current value set for the air absorption factor for the direct path of sounds
Definition at line 174 of file SoundManager.h.
◆ GetDopplerFactor()
| float RoR::SoundManager::GetDopplerFactor |
( |
| ) |
const |
|
inline |
- Returns
- The value of AL_DOPPLER_FACTOR as currently set in OpenAL.
Definition at line 149 of file SoundManager.h.
◆ GetEfxProperties()
| const EFXEAXREVERBPROPERTIES * SoundManager::GetEfxProperties |
( |
const std::string & |
efx_preset_name | ) |
const |
Returns a pointer to properties of an EFX preset stored in the EFX properties map.
The presets should not be modified directly so they can serve as a reference.
- Parameters
-
| efx_preset_name | The name of the preset for which the properties shall be returned. |
- Returns
- Pointer to properties of a reverb preset if the lookup for the name in the EFX Properties map was positive, nullptr otherwise.
Definition at line 313 of file SoundManager.cpp.
◆ getEfxPropertiesMap()
| const std::map< std::string, EFXEAXREVERBPROPERTIES > & RoR::SoundManager::getEfxPropertiesMap |
( |
| ) |
const |
|
inline |
Returns currently registered EFX presets.
- Returns
- Map of EFX Preset names to their EFXEAXREVERBPROPERTIES object.
Definition at line 187 of file SoundManager.h.
◆ getHardwareSource()
| ALuint RoR::SoundManager::getHardwareSource |
( |
int |
hardware_index | ) |
|
|
inlineprivate |
Returns the AL handle for the hardware source with the provided index.
- Parameters
-
| hardware_index | Index of the hardware source. |
- Returns
- The AL handle for the requested hardware source.
Definition at line 239 of file SoundManager.h.
◆ GetListenerPosition()
| Ogre::Vector3 RoR::SoundManager::GetListenerPosition |
( |
| ) |
const |
|
inline |
Returns the position vector of the listener.
- Returns
- listener position vector
Definition at line 75 of file SoundManager.h.
◆ getNumHardwareSources()
| int RoR::SoundManager::getNumHardwareSources |
( |
| ) |
|
|
inline |
Returns the number of currently used hardware sources.
In a typical scenario, this value changes dynamically.
- Returns
- The number of hardware sources currently in use.
Definition at line 181 of file SoundManager.h.
◆ GetReverbPresetAt()
| const EFXEAXREVERBPROPERTIES * SoundManager::GetReverbPresetAt |
( |
Ogre::Vector3 |
position | ) |
const |
Determines which reverb preset corresponds to the provided position and returns its properties.
- Parameters
-
| position | Position for which the reverb preset of the encompassing environment will be returned. |
- Returns
- Reverb properties for the provided position.
Definition at line 551 of file SoundManager.cpp.
◆ GetSpeedOfSound()
| float RoR::SoundManager::GetSpeedOfSound |
( |
| ) |
const |
|
inline |
- Returns
- The value of AL_SPEED_OF_SOUND as currently set in OpenAL.
Definition at line 137 of file SoundManager.h.
◆ isDisabled()
| bool RoR::SoundManager::isDisabled |
( |
| ) |
|
|
inline |
◆ IsHardwareSourceObstructed()
| bool SoundManager::IsHardwareSourceObstructed |
( |
const int |
hardware_index | ) |
const |
|
private |
Performs various checks against the environment of the listener to determine whether the sound belonging to a hardware source is obstructed or not.
- Parameters
-
| hardware_index | The index of the hardware source. |
- Returns
- True if the sound is obstructed from the listener's point of view, false otherwise.
Definition at line 1012 of file SoundManager.cpp.
◆ ListenerIsUnderwater()
| bool RoR::SoundManager::ListenerIsUnderwater |
( |
| ) |
const |
|
inline |
- Returns
- True if the listener position is below water level. False otherwise.
Definition at line 80 of file SoundManager.h.
◆ loadWAVFile()
| bool SoundManager::loadWAVFile |
( |
Ogre::String |
filename, |
|
|
ALuint |
buffer, |
|
|
Ogre::String |
resource_group_name = "" |
|
) |
| |
|
private |
◆ pauseAllSounds()
| void SoundManager::pauseAllSounds |
( |
| ) |
|
Unlike the name suggests, this sets the listener's gain to 0, essentially muting all sounds.
Definition at line 1451 of file SoundManager.cpp.
◆ PrepopulateEfxPropertiesMap()
| void SoundManager::PrepopulateEfxPropertiesMap |
( |
| ) |
|
|
private |
Helper function that fills the m_efx_properties_map with presets provided by OpenAL's efx-presets.h header.
Definition at line 327 of file SoundManager.cpp.
◆ recomputeAllSources()
| void SoundManager::recomputeAllSources |
( |
| ) |
|
|
private |
◆ recomputeSource()
| void SoundManager::recomputeSource |
( |
int |
source_index, |
|
|
int |
reason, |
|
|
float |
vfl, |
|
|
Ogre::Vector3 * |
vvec |
|
) |
| |
|
private |
Computes audibility of an audio source and retires it if it is inaudible.
Otherwise, it updates its parameters (e.g. play/stop) if it is already assigned to a hardware source. If it was not assigned to a hardware source yet, it will either be assigned to a free slot or replace a less audible source if one exists.
- See also
- assign()
-
retire()
Definition at line 1327 of file SoundManager.cpp.
◆ resumeAllSounds()
| void SoundManager::resumeAllSounds |
( |
| ) |
|
Unlike the name suggests, this sets the listener's gain to the value of the CVar audio_master_volume.
Definition at line 1459 of file SoundManager.cpp.
◆ retire()
| void SoundManager::retire |
( |
int |
source_index | ) |
|
|
private |
Stops and the removes an audio source from hardware source.
- Parameters
-
| source_index | The index of the audio source. |
Definition at line 1439 of file SoundManager.cpp.
◆ SetAirAbsorptionFactor()
| void RoR::SoundManager::SetAirAbsorptionFactor |
( |
const float |
air_absorption_factor | ) |
|
|
inline |
Sets the air absorptions factor for the direct path of all sounds.
- Parameters
-
| air_absorption_factor | Air absorption factor within the range of AL_AIR_ABSORPTION_FACTOR. |
Definition at line 169 of file SoundManager.h.
◆ SetDopplerFactor() [1/2]
| void SoundManager::SetDopplerFactor |
( |
const ALuint |
hardware_source, |
|
|
const float |
doppler_factor |
|
) |
| const |
Updates the Doppler factor of an OpenAL source with the provided value.
EFX has to be supported and enabled, otherwise this is a no-op.
- Parameters
-
| hardware_source | Index of the hardware source. |
| doppler_factor | Doppler factor within the range of AL_DOPPLER_FACTOR. |
Definition at line 500 of file SoundManager.cpp.
◆ SetDopplerFactor() [2/2]
| void RoR::SoundManager::SetDopplerFactor |
( |
const float |
doppler_factor | ) |
const |
|
inline |
Updates the global Doppler factor in OpenAL with the provided value.
- Parameters
-
| doppler_factor | Doppler factor within the range of AL_DOPPLER_FACTOR. |
Definition at line 155 of file SoundManager.h.
◆ SetListener()
| void SoundManager::SetListener |
( |
Ogre::Vector3 |
position, |
|
|
Ogre::Vector3 |
direction, |
|
|
Ogre::Vector3 |
up, |
|
|
Ogre::Vector3 |
velocity |
|
) |
| |
Sets position and speed of the listener.
- Parameters
-
| position | The position of the listener. |
| direction | This direction vector specifies where the front of the listener is pointing to. |
| up | This direction vector specifies where the top of the head of the listener is pointing to. |
| velocity | The movement speed of the listener in each dimension. |
Definition at line 492 of file SoundManager.cpp.
◆ setMasterVolume()
| void SoundManager::setMasterVolume |
( |
float |
v | ) |
|
Updates both CVar audio_master_volume and the listener's gain to the provided value.
- Parameters
-
| v | Volume within the range of AL_GAIN. |
Definition at line 1467 of file SoundManager.cpp.
◆ SetSpeedOfSound()
| void RoR::SoundManager::SetSpeedOfSound |
( |
const float |
speed_of_sound | ) |
const |
|
inline |
Updates the speed of sound in OpenAL with the provided value.
This value should based on RoR units for correct results.
- Parameters
-
| speed_of_sound | Speed of sound within the range of AL_SPEED_OF_SOUND. |
Definition at line 144 of file SoundManager.h.
◆ SmoothlyUpdateAlAuxiliaryEffectSlot()
| void SoundManager::SmoothlyUpdateAlAuxiliaryEffectSlot |
( |
const float |
dt, |
|
|
const ALuint |
slot_id, |
|
|
const EFXEAXREVERBPROPERTIES * |
target_efx_properties |
|
) |
| |
|
private |
This performs a smooth update of the efx properties of an OpenAL Auxiliary Effect slot using linear interpolation over several timesteps.
- Parameters
-
| dt | Time since last frame in seconds |
| slot_id | ID of the AuxiliaryEffectSlot which should be updated |
| target_efx_properties | EFX Reverb properties to update to |
Definition at line 620 of file SoundManager.cpp.
◆ Update()
| void SoundManager::Update |
( |
const float |
dt | ) |
|
Does the per-frame update of sounds and listener environment.
With the help of other functions it determines and then submits the current state of the audio world to OpenAL.
- Parameters
-
| dt | Time since last frame in seconds |
Definition at line 403 of file SoundManager.cpp.
◆ UpdateAlListener()
| void SoundManager::UpdateAlListener |
( |
| ) |
|
|
private |
◆ UpdateConeProperties()
| void SoundManager::UpdateConeProperties |
( |
const ALuint |
source, |
|
|
const Ogre::Vector3 & |
cone_direction, |
|
|
const float |
cone_inner_angle, |
|
|
const float |
cone_outer_angle, |
|
|
const float |
cone_outer_gain, |
|
|
const float |
cone_outer_gain_hf |
|
) |
| const |
|
private |
Updates the Cone properties for the hardware source.
- Parameters
-
| source | The AL source of which the cone properties will be modified. |
| cone_direction | The direction the cone will face. |
| cone_inner_angle | Angle for the inner zone. |
| cone_outer_angle | Angle that marks the border between transitional and outside zone of the cone |
| cone_outer_gain | Gain for the outside zone. |
| cone_outer_gain_hf | High-frequency gain for the outside zone. |
Definition at line 1306 of file SoundManager.cpp.
◆ UpdateDirectedSounds()
| void SoundManager::UpdateDirectedSounds |
( |
| ) |
const |
|
private |
Updates AL Cones for sources of directed sound emissions (exhausts, turboprops and turbojets).
Definition at line 1160 of file SoundManager.cpp.
◆ UpdateEfxSpecificProperties()
| void SoundManager::UpdateEfxSpecificProperties |
( |
const float |
dt | ) |
|
Updates properties of OpenAL facilities that are only available with EFX.
- Parameters
-
| dt | Time since last frame in seconds |
Definition at line 436 of file SoundManager.cpp.
◆ UpdateGlobalDopplerFactor()
| void SoundManager::UpdateGlobalDopplerFactor |
( |
| ) |
const |
Updates the global Doppler factor based on CVar settings and the state of the physics simulation.
Definition at line 418 of file SoundManager.cpp.
◆ UpdateListenerEffectSlot()
| void SoundManager::UpdateListenerEffectSlot |
( |
const float |
dt | ) |
|
|
private |
Dynamically adjusts some parameters of the currently active reverb preset based on the current environment of the listener.
It works on the AL effect correspondig to a reverb preset, i.e. the original preset in m_efx_properties_map remains unchanged. Finally, it updates the AL listener's effect slot with the adjusted preset.
- Parameters
-
| dt | Time since last frame in seconds |
Definition at line 593 of file SoundManager.cpp.
◆ UpdateListenerEnvironment()
| void SoundManager::UpdateListenerEnvironment |
( |
| ) |
|
|
private |
Determines several properties of the environment of the listener and updates OpenAL to use them.
Definition at line 505 of file SoundManager.cpp.
◆ UpdateObstructionFilter()
| void SoundManager::UpdateObstructionFilter |
( |
const int |
hardware_index, |
|
|
const bool |
enable_obstruction_filter |
|
) |
| const |
|
private |
Applies an obstruction filter to the provided hardware source.
- Parameters
-
| hardware_index | The index of the hardware source. |
| enable_obstruction_filter | Whether the obstruction filter should be enabled for the hardware source or not. |
Definition at line 1121 of file SoundManager.cpp.
◆ UpdateOcclusionFilter()
| bool SoundManager::UpdateOcclusionFilter |
( |
const int |
hardware_index, |
|
|
const ALuint |
effect_slot_id, |
|
|
const EFXEAXREVERBPROPERTIES * |
reference_efx_reverb_properties |
|
) |
| const |
|
private |
Applies an occlusion filter to the provided source if certain conditions apply.
To decide whether the filter should be applied or not, the function checks whether the reverb preset of the sound differs from that provided as a parameter.
- Parameters
-
| hardware_index | The index of the hardware source. |
| effect_slot_id | The id of the AL effect slot that will be used as a send target |
| reference_efx_reverb_properties | The reverb preset that the reverb preset of the sound location is compared against |
- Returns
- True if occlusion was detected, false otherwise.
Definition at line 1134 of file SoundManager.cpp.
◆ UpdateSourceFilters()
| void SoundManager::UpdateSourceFilters |
( |
const int |
hardware_index | ) |
const |
|
private |
Helper function to call several other functions to update source filters.
- Parameters
-
| hardware_index | The index of the hardware source. |
Definition at line 989 of file SoundManager.cpp.
◆ UpdateSourceSpecificDopplerFactor()
| void SoundManager::UpdateSourceSpecificDopplerFactor |
( |
const int |
hardware_index | ) |
const |
Identifies the actor to which the sound corresponding to a hardware source belongs and updates the Doppler factor based on CVar settings and the actor's physics sim state.
- Parameters
-
| hardware_index | Index of the hardware source. |
Definition at line 458 of file SoundManager.cpp.
◆ Sound
◆ alAuxiliaryEffectSlotf
| LPALAUXILIARYEFFECTSLOTF RoR::SoundManager::alAuxiliaryEffectSlotf = nullptr |
|
private |
◆ alAuxiliaryEffectSlotfv
| LPALAUXILIARYEFFECTSLOTFV RoR::SoundManager::alAuxiliaryEffectSlotfv = nullptr |
|
private |
◆ alAuxiliaryEffectSloti
| LPALAUXILIARYEFFECTSLOTI RoR::SoundManager::alAuxiliaryEffectSloti = nullptr |
|
private |
◆ alDeleteAuxiliaryEffectSlots
| LPALDELETEAUXILIARYEFFECTSLOTS RoR::SoundManager::alDeleteAuxiliaryEffectSlots = nullptr |
|
private |
◆ alDeleteEffects
| LPALDELETEEFFECTS RoR::SoundManager::alDeleteEffects = nullptr |
|
private |
◆ alDeleteFilters
| LPALDELETEFILTERS RoR::SoundManager::alDeleteFilters = nullptr |
|
private |
◆ alEffectf
| LPALEFFECTF RoR::SoundManager::alEffectf = nullptr |
|
private |
◆ alEffectfv
| LPALEFFECTFV RoR::SoundManager::alEffectfv = nullptr |
|
private |
◆ alEffecti
| LPALEFFECTI RoR::SoundManager::alEffecti = nullptr |
|
private |
◆ alFilterf
| LPALFILTERF RoR::SoundManager::alFilterf = nullptr |
|
private |
◆ alFilteri
| LPALFILTERI RoR::SoundManager::alFilteri = nullptr |
|
private |
◆ alGenAuxiliaryEffectSlots
| LPALGENAUXILIARYEFFECTSLOTS RoR::SoundManager::alGenAuxiliaryEffectSlots = nullptr |
|
private |
◆ alGenEffects
| LPALGENEFFECTS RoR::SoundManager::alGenEffects = nullptr |
|
private |
◆ alGenFilters
| LPALGENFILTERS RoR::SoundManager::alGenFilters = nullptr |
|
private |
◆ alIsAuxiliaryEffectSlot
| LPALISAUXILIARYEFFECTSLOT RoR::SoundManager::alIsAuxiliaryEffectSlot = nullptr |
|
private |
◆ alIsEffect
| LPALISEFFECT RoR::SoundManager::alIsEffect = nullptr |
|
private |
◆ alIsFilter
| LPALISFILTER RoR::SoundManager::alIsFilter = nullptr |
|
private |
◆ audio_buffer_file_name
◆ audio_buffers
◆ audio_buffers_in_use_count
| int RoR::SoundManager::audio_buffers_in_use_count = 0 |
|
private |
◆ audio_device
| ALCdevice* RoR::SoundManager::audio_device = nullptr |
|
private |
◆ audio_sources
◆ audio_sources_most_audible
| std::pair<int, float> RoR::SoundManager::audio_sources_most_audible[MAX_AUDIO_BUFFERS] |
|
private |
◆ hardware_sources
◆ hardware_sources_in_use_count
| int RoR::SoundManager::hardware_sources_in_use_count = 0 |
|
private |
◆ hardware_sources_map
maps from the index of a hardware source to the index of the audio source currently assigned to the corresponding hardware source. -1 = unmapped
Definition at line 259 of file SoundManager.h.
◆ hardware_sources_num
| int RoR::SoundManager::hardware_sources_num = 0 |
|
private |
total number of allocated hardware sources (<= MAX_HARDWARE_SOURCES)
Definition at line 257 of file SoundManager.h.
◆ m_air_absorption_factor
| float RoR::SoundManager::m_air_absorption_factor = 1.0f |
|
private |
◆ m_audio_sources_in_use_count
| int RoR::SoundManager::m_audio_sources_in_use_count = 0 |
|
private |
◆ m_efx_effect_id_map
| std::map<ALuint, ALuint> RoR::SoundManager::m_efx_effect_id_map |
|
private |
◆ m_efx_is_available
| bool RoR::SoundManager::m_efx_is_available = false |
|
private |
◆ m_efx_occlusion_wet_path_lowpass_filter_id
| ALuint RoR::SoundManager::m_efx_occlusion_wet_path_lowpass_filter_id = 0 |
|
private |
◆ m_efx_occlusion_wet_path_send_id
| ALuint RoR::SoundManager::m_efx_occlusion_wet_path_send_id = 0 |
|
private |
◆ m_efx_outdoor_obstruction_lowpass_filter_id
| ALuint RoR::SoundManager::m_efx_outdoor_obstruction_lowpass_filter_id = 0 |
|
private |
◆ m_efx_properties_map
| std::map<std::string, EFXEAXREVERBPROPERTIES> RoR::SoundManager::m_efx_properties_map |
|
private |
◆ m_efx_reverb_engine
◆ m_listener_direction
| Ogre::Vector3 RoR::SoundManager::m_listener_direction = Ogre::Vector3::ZERO |
|
private |
◆ m_listener_efx_reverb_properties
| const EFXEAXREVERBPROPERTIES* RoR::SoundManager::m_listener_efx_reverb_properties = nullptr |
|
private |
◆ m_listener_is_underwater
| bool RoR::SoundManager::m_listener_is_underwater = false |
|
private |
◆ m_listener_position
| Ogre::Vector3 RoR::SoundManager::m_listener_position = Ogre::Vector3::ZERO |
|
private |
◆ m_listener_slot
| ALuint RoR::SoundManager::m_listener_slot = 0 |
|
private |
◆ m_listener_up
| Ogre::Vector3 RoR::SoundManager::m_listener_up = Ogre::Vector3::ZERO |
|
private |
◆ m_listener_velocity
| Ogre::Vector3 RoR::SoundManager::m_listener_velocity = Ogre::Vector3::ZERO |
|
private |
◆ MAX_AUDIO_BUFFERS
| const unsigned int RoR::SoundManager::MAX_AUDIO_BUFFERS = 8192 |
|
static |
◆ MAX_DISTANCE
| const float SoundManager::MAX_DISTANCE = 500.0f |
|
static |
◆ MAX_HARDWARE_SOURCES
| const unsigned int RoR::SoundManager::MAX_HARDWARE_SOURCES = 32 |
|
static |
◆ REFERENCE_DISTANCE
| const float SoundManager::REFERENCE_DISTANCE = 7.5f |
|
static |
◆ ROLLOFF_FACTOR
| const float SoundManager::ROLLOFF_FACTOR = 1.0f |
|
static |
◆ sound_context
| ALCcontext* RoR::SoundManager::sound_context = nullptr |
|
private |
The documentation for this class was generated from the following files: