RigsofRods
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends
RoR::SoundManager Class Reference

#include <SoundManager.h>

+ Collaboration diagram for RoR::SoundManager:

Public Member Functions

 SoundManager ()
 
 ~SoundManager ()
 
void CleanUp ()
 Cleans up various objects that should be reset when returning from a terrain to the main menu. More...
 
SoundPtr createSound (Ogre::String filename, Ogre::String resource_group_name="")
 
Ogre::Vector3 GetListenerPosition () const
 Returns the position vector of the listener. More...
 
bool ListenerIsUnderwater () const
 
void Update (const float dt)
 Does the per-frame update of sounds and listener environment. More...
 
void UpdateGlobalDopplerFactor () const
 Updates the global Doppler factor based on CVar settings and the state of the physics simulation. More...
 
void UpdateEfxSpecificProperties (const float dt)
 Updates properties of OpenAL facilities that are only available with EFX. More...
 
void 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. More...
 
void SetListener (Ogre::Vector3 position, Ogre::Vector3 direction, Ogre::Vector3 up, Ogre::Vector3 velocity)
 Sets position and speed of the listener. More...
 
void pauseAllSounds ()
 Unlike the name suggests, this sets the listener's gain to 0, essentially muting all sounds. More...
 
void resumeAllSounds ()
 Unlike the name suggests, this sets the listener's gain to the value of the CVar audio_master_volume. More...
 
void setMasterVolume (float v)
 Updates both CVar audio_master_volume and the listener's gain to the provided value. More...
 
bool isDisabled ()
 
float GetSpeedOfSound () const
 
void SetSpeedOfSound (const float speed_of_sound) const
 Updates the speed of sound in OpenAL with the provided value. More...
 
float GetDopplerFactor () const
 
void SetDopplerFactor (const float doppler_factor) const
 Updates the global Doppler factor in OpenAL with the provided value. More...
 
void SetDopplerFactor (const ALuint hardware_source, const float doppler_factor) const
 Updates the Doppler factor of an OpenAL source with the provided value. More...
 
void SetAirAbsorptionFactor (const float air_absorption_factor)
 Sets the air absorptions factor for the direct path of all sounds. More...
 
float GetAirAbsorptionFactor () const
 
int getNumHardwareSources ()
 Returns the number of currently used hardware sources. More...
 
const std::map< std::string, EFXEAXREVERBPROPERTIES > & getEfxPropertiesMap () const
 Returns currently registered EFX presets. More...
 
const EFXEAXREVERBPROPERTIES * GetEfxProperties (const std::string &efx_preset_name) const
 Returns a pointer to properties of an EFX preset stored in the EFX properties map. More...
 
const EFXEAXREVERBPROPERTIES * GetReverbPresetAt (Ogre::Vector3 position) const
 Determines which reverb preset corresponds to the provided position and returns its properties. More...
 

Static Public Attributes

static const float MAX_DISTANCE = 500.0f
 
static const float ROLLOFF_FACTOR = 1.0f
 
static const float REFERENCE_DISTANCE = 7.5f
 
static const unsigned int MAX_HARDWARE_SOURCES = 32
 
static const unsigned int MAX_AUDIO_BUFFERS = 8192
 

Private Member Functions

void UpdateAlListener ()
 Updates the listener's position, orientation and velocity vectors in OpenAL. More...
 
void UpdateListenerEnvironment ()
 Determines several properties of the environment of the listener and updates OpenAL to use them. More...
 
void recomputeAllSources ()
 
void recomputeSource (int source_index, int reason, float vfl, Ogre::Vector3 *vvec)
 Computes audibility of an audio source and retires it if it is inaudible. More...
 
ALuint getHardwareSource (int hardware_index)
 Returns the AL handle for the hardware source with the provided index. More...
 
void assign (int source_index, int hardware_index)
 Adds an audio source to hardware source. More...
 
void retire (int source_index)
 Stops and the removes an audio source from hardware source. More...
 
bool loadWAVFile (Ogre::String filename, ALuint buffer, Ogre::String resource_group_name="")
 
ALuint CreateAlEffect (const EFXEAXREVERBPROPERTIES *efx_properties) const
 Creates an OpenAL effect based on the parameters of an efx/eax reverb preset. More...
 
void DeleteAlEffect (const ALuint efx_effect_id) const
 Deletes an OpenAL effect. More...
 
void PrepopulateEfxPropertiesMap ()
 Helper function that fills the m_efx_properties_map with presets provided by OpenAL's efx-presets.h header. More...
 
void UpdateListenerEffectSlot (const float dt)
 Dynamically adjusts some parameters of the currently active reverb preset based on the current environment of the listener. More...
 
void SmoothlyUpdateAlAuxiliaryEffectSlot (const float dt, const ALuint slot_id, const EFXEAXREVERBPROPERTIES *target_efx_properties)
 This performs a smooth update of the efx properties of an OpenAL Auxiliary Effect slot using linear interpolation over several timesteps. More...
 
std::tuple< Ogre::Vector3, float, float > ComputeEarlyReflectionsProperties () const
 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. More...
 
void UpdateSourceFilters (const int hardware_index) const
 Helper function to call several other functions to update source filters. More...
 
bool IsHardwareSourceObstructed (const int hardware_index) const
 Performs various checks against the environment of the listener to determine whether the sound belonging to a hardware source is obstructed or not. More...
 
void UpdateObstructionFilter (const int hardware_index, const bool enable_obstruction_filter) const
 Applies an obstruction filter to the provided hardware source. More...
 
bool UpdateOcclusionFilter (const int hardware_index, const ALuint effect_slot_id, const EFXEAXREVERBPROPERTIES *reference_efx_reverb_properties) const
 Applies an occlusion filter to the provided source if certain conditions apply. More...
 
void UpdateDirectedSounds () const
 Updates AL Cones for sources of directed sound emissions (exhausts, turboprops and turbojets). More...
 
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
 Updates the Cone properties for the hardware source. More...
 

Private Attributes

int hardware_sources_num = 0
 total number of allocated hardware sources (<= MAX_HARDWARE_SOURCES) More...
 
int hardware_sources_in_use_count = 0
 
int hardware_sources_map [MAX_HARDWARE_SOURCES]
 maps from the index of a hardware source to the index of the audio source currently assigned to the corresponding hardware source. -1 = unmapped More...
 
ALuint hardware_sources [MAX_HARDWARE_SOURCES]
 
int m_audio_sources_in_use_count = 0
 
SoundPtr audio_sources [MAX_AUDIO_BUFFERS] = { nullptr }
 
std::pair< int, float > audio_sources_most_audible [MAX_AUDIO_BUFFERS]
 
int audio_buffers_in_use_count = 0
 
ALuint audio_buffers [MAX_AUDIO_BUFFERS]
 
Ogre::String audio_buffer_file_name [MAX_AUDIO_BUFFERS]
 
bool m_listener_is_underwater = false
 
Ogre::Vector3 m_listener_position = Ogre::Vector3::ZERO
 
Ogre::Vector3 m_listener_direction = Ogre::Vector3::ZERO
 
Ogre::Vector3 m_listener_up = Ogre::Vector3::ZERO
 
Ogre::Vector3 m_listener_velocity = Ogre::Vector3::ZERO
 
ALCdevice * audio_device = nullptr
 
ALCcontext * sound_context = nullptr
 
bool m_efx_is_available = false
 
ALuint m_listener_slot = 0
 
ALuint m_efx_outdoor_obstruction_lowpass_filter_id = 0
 
ALuint m_efx_occlusion_wet_path_send_id = 0
 
ALuint m_efx_occlusion_wet_path_lowpass_filter_id = 0
 
float m_air_absorption_factor = 1.0f
 
EfxReverbEngine m_efx_reverb_engine = EfxReverbEngine::NONE
 
const EFXEAXREVERBPROPERTIES * m_listener_efx_reverb_properties = nullptr
 
std::map< std::string, EFXEAXREVERBPROPERTIES > m_efx_properties_map
 
std::map< ALuint, ALuint > m_efx_effect_id_map
 
LPALGENEFFECTS alGenEffects = nullptr
 
LPALDELETEEFFECTS alDeleteEffects = nullptr
 
LPALISEFFECT alIsEffect = nullptr
 
LPALEFFECTI alEffecti = nullptr
 
LPALEFFECTF alEffectf = nullptr
 
LPALEFFECTFV alEffectfv = nullptr
 
LPALGENFILTERS alGenFilters = nullptr
 
LPALDELETEFILTERS alDeleteFilters = nullptr
 
LPALISFILTER alIsFilter = nullptr
 
LPALFILTERI alFilteri = nullptr
 
LPALFILTERF alFilterf = nullptr
 
LPALGENAUXILIARYEFFECTSLOTS alGenAuxiliaryEffectSlots = nullptr
 
LPALDELETEAUXILIARYEFFECTSLOTS alDeleteAuxiliaryEffectSlots = nullptr
 
LPALISAUXILIARYEFFECTSLOT alIsAuxiliaryEffectSlot = nullptr
 
LPALAUXILIARYEFFECTSLOTI alAuxiliaryEffectSloti = nullptr
 
LPALAUXILIARYEFFECTSLOTF alAuxiliaryEffectSlotf = nullptr
 
LPALAUXILIARYEFFECTSLOTFV alAuxiliaryEffectSlotfv = nullptr
 

Friends

class Sound
 

Detailed Description

Definition at line 53 of file SoundManager.h.

Constructor & Destructor Documentation

◆ SoundManager()

SoundManager::SoundManager ( )

Definition at line 58 of file SoundManager.cpp.

+ Here is the call graph for this function:

◆ ~SoundManager()

SoundManager::~SoundManager ( )

Definition at line 253 of file SoundManager.cpp.

Member Function Documentation

◆ assign()

void SoundManager::assign ( int  source_index,
int  hardware_index 
)
private

Adds an audio source to hardware source.

Parameters
source_indexIndex of the audio source.
hardware_indexIndex of the hardware source to which the audio source will be assigned.

Definition at line 1412 of file SoundManager.cpp.

+ Here is the call graph for this function:

◆ 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.

+ Here is the caller graph for this function:

◆ 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.

+ Here is the call graph for this function:

◆ 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_propertiesEFXEAXREVERBPROPERTIES 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
filenameWAV file.
resource_group_nameLeave empty to auto-search all groups (classic behavior).

Definition at line 1476 of file SoundManager.cpp.

+ Here is the caller graph for this function:

◆ DeleteAlEffect()

void SoundManager::DeleteAlEffect ( const ALuint  efx_effect_id) const
private

Deletes an OpenAL effect.

Parameters
effect_idID 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_nameThe 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_indexIndex of the hardware source.
Returns
The AL handle for the requested hardware source.

Definition at line 239 of file SoundManager.h.

+ Here is the caller graph for this function:

◆ 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.

+ Here is the caller graph for this function:

◆ GetReverbPresetAt()

const EFXEAXREVERBPROPERTIES * SoundManager::GetReverbPresetAt ( Ogre::Vector3  position) const

Determines which reverb preset corresponds to the provided position and returns its properties.

Parameters
positionPosition 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.

+ Here is the call graph for this function:

◆ 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.

+ Here is the caller graph for this function:

◆ isDisabled()

bool RoR::SoundManager::isDisabled ( )
inline

Definition at line 132 of file SoundManager.h.

+ Here is the caller graph for this function:

◆ 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_indexThe 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.

+ Here is the call graph for this function:

◆ 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

Definition at line 1520 of file SoundManager.cpp.

+ Here is the call graph for this function:

◆ 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.

+ Here is the caller graph for this function:

◆ 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

Definition at line 947 of file SoundManager.cpp.

+ Here is the call graph for this function:

◆ 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.

+ Here is the caller graph for this function:

◆ 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.

+ Here is the caller graph for this function:

◆ retire()

void SoundManager::retire ( int  source_index)
private

Stops and the removes an audio source from hardware source.

Parameters
source_indexThe 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_factorAir 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_sourceIndex of the hardware source.
doppler_factorDoppler factor within the range of AL_DOPPLER_FACTOR.

Definition at line 500 of file SoundManager.cpp.

+ Here is the call graph for this function:

◆ 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_factorDoppler 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
positionThe position of the listener.
directionThis direction vector specifies where the front of the listener is pointing to.
upThis direction vector specifies where the top of the head of the listener is pointing to.
velocityThe movement speed of the listener in each dimension.

Definition at line 492 of file SoundManager.cpp.

+ Here is the caller graph for this function:

◆ setMasterVolume()

void SoundManager::setMasterVolume ( float  v)

Updates both CVar audio_master_volume and the listener's gain to the provided value.

Parameters
vVolume within the range of AL_GAIN.

Definition at line 1467 of file SoundManager.cpp.

+ Here is the call graph for this function:

◆ 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_soundSpeed 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
dtTime since last frame in seconds
slot_idID of the AuxiliaryEffectSlot which should be updated
target_efx_propertiesEFX 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
dtTime since last frame in seconds

Definition at line 403 of file SoundManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateAlListener()

void SoundManager::UpdateAlListener ( )
private

Updates the listener's position, orientation and velocity vectors in OpenAL.

See also
SetListener()

Definition at line 534 of file SoundManager.cpp.

◆ 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
sourceThe AL source of which the cone properties will be modified.
cone_directionThe direction the cone will face.
cone_inner_angleAngle for the inner zone.
cone_outer_angleAngle that marks the border between transitional and outside zone of the cone
cone_outer_gainGain for the outside zone.
cone_outer_gain_hfHigh-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.

+ Here is the call graph for this function:

◆ UpdateEfxSpecificProperties()

void SoundManager::UpdateEfxSpecificProperties ( const float  dt)

Updates properties of OpenAL facilities that are only available with EFX.

Parameters
dtTime 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.

+ Here is the call graph for this function:

◆ 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
dtTime 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_indexThe index of the hardware source.
enable_obstruction_filterWhether 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_indexThe index of the hardware source.
effect_slot_idThe id of the AL effect slot that will be used as a send target
reference_efx_reverb_propertiesThe 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.

+ Here is the call graph for this function:

◆ UpdateSourceFilters()

void SoundManager::UpdateSourceFilters ( const int  hardware_index) const
private

Helper function to call several other functions to update source filters.

Parameters
hardware_indexThe 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_indexIndex of the hardware source.

Definition at line 458 of file SoundManager.cpp.

+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ Sound

friend class Sound
friend

Definition at line 55 of file SoundManager.h.

Field Documentation

◆ alAuxiliaryEffectSlotf

LPALAUXILIARYEFFECTSLOTF RoR::SoundManager::alAuxiliaryEffectSlotf = nullptr
private

Definition at line 308 of file SoundManager.h.

◆ alAuxiliaryEffectSlotfv

LPALAUXILIARYEFFECTSLOTFV RoR::SoundManager::alAuxiliaryEffectSlotfv = nullptr
private

Definition at line 309 of file SoundManager.h.

◆ alAuxiliaryEffectSloti

LPALAUXILIARYEFFECTSLOTI RoR::SoundManager::alAuxiliaryEffectSloti = nullptr
private

Definition at line 307 of file SoundManager.h.

◆ alDeleteAuxiliaryEffectSlots

LPALDELETEAUXILIARYEFFECTSLOTS RoR::SoundManager::alDeleteAuxiliaryEffectSlots = nullptr
private

Definition at line 305 of file SoundManager.h.

◆ alDeleteEffects

LPALDELETEEFFECTS RoR::SoundManager::alDeleteEffects = nullptr
private

Definition at line 294 of file SoundManager.h.

◆ alDeleteFilters

LPALDELETEFILTERS RoR::SoundManager::alDeleteFilters = nullptr
private

Definition at line 300 of file SoundManager.h.

◆ alEffectf

LPALEFFECTF RoR::SoundManager::alEffectf = nullptr
private

Definition at line 297 of file SoundManager.h.

◆ alEffectfv

LPALEFFECTFV RoR::SoundManager::alEffectfv = nullptr
private

Definition at line 298 of file SoundManager.h.

◆ alEffecti

LPALEFFECTI RoR::SoundManager::alEffecti = nullptr
private

Definition at line 296 of file SoundManager.h.

◆ alFilterf

LPALFILTERF RoR::SoundManager::alFilterf = nullptr
private

Definition at line 303 of file SoundManager.h.

◆ alFilteri

LPALFILTERI RoR::SoundManager::alFilteri = nullptr
private

Definition at line 302 of file SoundManager.h.

◆ alGenAuxiliaryEffectSlots

LPALGENAUXILIARYEFFECTSLOTS RoR::SoundManager::alGenAuxiliaryEffectSlots = nullptr
private

Definition at line 304 of file SoundManager.h.

◆ alGenEffects

LPALGENEFFECTS RoR::SoundManager::alGenEffects = nullptr
private

Definition at line 293 of file SoundManager.h.

◆ alGenFilters

LPALGENFILTERS RoR::SoundManager::alGenFilters = nullptr
private

Definition at line 299 of file SoundManager.h.

◆ alIsAuxiliaryEffectSlot

LPALISAUXILIARYEFFECTSLOT RoR::SoundManager::alIsAuxiliaryEffectSlot = nullptr
private

Definition at line 306 of file SoundManager.h.

◆ alIsEffect

LPALISEFFECT RoR::SoundManager::alIsEffect = nullptr
private

Definition at line 295 of file SoundManager.h.

◆ alIsFilter

LPALISFILTER RoR::SoundManager::alIsFilter = nullptr
private

Definition at line 301 of file SoundManager.h.

◆ audio_buffer_file_name

Ogre::String RoR::SoundManager::audio_buffer_file_name[MAX_AUDIO_BUFFERS]
private

Definition at line 271 of file SoundManager.h.

◆ audio_buffers

ALuint RoR::SoundManager::audio_buffers[MAX_AUDIO_BUFFERS]
private

Definition at line 270 of file SoundManager.h.

◆ audio_buffers_in_use_count

int RoR::SoundManager::audio_buffers_in_use_count = 0
private

Definition at line 269 of file SoundManager.h.

◆ audio_device

ALCdevice* RoR::SoundManager::audio_device = nullptr
private

Definition at line 279 of file SoundManager.h.

◆ audio_sources

SoundPtr RoR::SoundManager::audio_sources[MAX_AUDIO_BUFFERS] = { nullptr }
private

Definition at line 264 of file SoundManager.h.

◆ audio_sources_most_audible

std::pair<int, float> RoR::SoundManager::audio_sources_most_audible[MAX_AUDIO_BUFFERS]
private

Definition at line 266 of file SoundManager.h.

◆ hardware_sources

ALuint RoR::SoundManager::hardware_sources[MAX_HARDWARE_SOURCES]
private

Definition at line 260 of file SoundManager.h.

◆ hardware_sources_in_use_count

int RoR::SoundManager::hardware_sources_in_use_count = 0
private

Definition at line 258 of file SoundManager.h.

◆ hardware_sources_map

int RoR::SoundManager::hardware_sources_map[MAX_HARDWARE_SOURCES]
private

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

Definition at line 288 of file SoundManager.h.

◆ m_audio_sources_in_use_count

int RoR::SoundManager::m_audio_sources_in_use_count = 0
private

Definition at line 263 of file SoundManager.h.

◆ m_efx_effect_id_map

std::map<ALuint, ALuint> RoR::SoundManager::m_efx_effect_id_map
private

Definition at line 292 of file SoundManager.h.

◆ m_efx_is_available

bool RoR::SoundManager::m_efx_is_available = false
private

Definition at line 283 of file SoundManager.h.

◆ m_efx_occlusion_wet_path_lowpass_filter_id

ALuint RoR::SoundManager::m_efx_occlusion_wet_path_lowpass_filter_id = 0
private

Definition at line 287 of file SoundManager.h.

◆ m_efx_occlusion_wet_path_send_id

ALuint RoR::SoundManager::m_efx_occlusion_wet_path_send_id = 0
private

Definition at line 286 of file SoundManager.h.

◆ m_efx_outdoor_obstruction_lowpass_filter_id

ALuint RoR::SoundManager::m_efx_outdoor_obstruction_lowpass_filter_id = 0
private

Definition at line 285 of file SoundManager.h.

◆ m_efx_properties_map

std::map<std::string, EFXEAXREVERBPROPERTIES> RoR::SoundManager::m_efx_properties_map
private

Definition at line 291 of file SoundManager.h.

◆ m_efx_reverb_engine

EfxReverbEngine RoR::SoundManager::m_efx_reverb_engine = EfxReverbEngine::NONE
private

Definition at line 289 of file SoundManager.h.

◆ m_listener_direction

Ogre::Vector3 RoR::SoundManager::m_listener_direction = Ogre::Vector3::ZERO
private

Definition at line 275 of file SoundManager.h.

◆ m_listener_efx_reverb_properties

const EFXEAXREVERBPROPERTIES* RoR::SoundManager::m_listener_efx_reverb_properties = nullptr
private

Definition at line 290 of file SoundManager.h.

◆ m_listener_is_underwater

bool RoR::SoundManager::m_listener_is_underwater = false
private

Definition at line 273 of file SoundManager.h.

◆ m_listener_position

Ogre::Vector3 RoR::SoundManager::m_listener_position = Ogre::Vector3::ZERO
private

Definition at line 274 of file SoundManager.h.

◆ m_listener_slot

ALuint RoR::SoundManager::m_listener_slot = 0
private

Definition at line 284 of file SoundManager.h.

◆ m_listener_up

Ogre::Vector3 RoR::SoundManager::m_listener_up = Ogre::Vector3::ZERO
private

Definition at line 276 of file SoundManager.h.

◆ m_listener_velocity

Ogre::Vector3 RoR::SoundManager::m_listener_velocity = Ogre::Vector3::ZERO
private

Definition at line 277 of file SoundManager.h.

◆ MAX_AUDIO_BUFFERS

const unsigned int RoR::SoundManager::MAX_AUDIO_BUFFERS = 8192
static

Definition at line 208 of file SoundManager.h.

◆ MAX_DISTANCE

const float SoundManager::MAX_DISTANCE = 500.0f
static

Definition at line 204 of file SoundManager.h.

◆ MAX_HARDWARE_SOURCES

const unsigned int RoR::SoundManager::MAX_HARDWARE_SOURCES = 32
static

Definition at line 207 of file SoundManager.h.

◆ REFERENCE_DISTANCE

const float SoundManager::REFERENCE_DISTANCE = 7.5f
static

Definition at line 206 of file SoundManager.h.

◆ ROLLOFF_FACTOR

const float SoundManager::ROLLOFF_FACTOR = 1.0f
static

Definition at line 205 of file SoundManager.h.

◆ sound_context

ALCcontext* RoR::SoundManager::sound_context = nullptr
private

Definition at line 280 of file SoundManager.h.


The documentation for this class was generated from the following files: