Skip to content

Attenuation

Amplitude attenuation asset.

Inherits the following classes: SparkyStudios::Audio::Amplitude::Asset

Detailed Description

An Attenuation materializes how the sound volume and other distance-based parameters are calculated following the distance of the sound source to the listener.

The Attenuation is a shared object between sound sources. They are used only when the sound needs to adjust its volume due to the distance from the listener, and many other parameters.

Public Functions

Type Name
virtual AmReal32 EvaluateAirAbsorption (const AmVector3 & soundLocation, const AmVector3 & listenerLocation, AmUInt32 band) const = 0
Evaluates the air absorption effect for a specific frequency band.
virtual AmReal32 GetGain (const AmVector3 & soundLocation, const Listener & listener) const = 0
Returns the gain of the sound from the given distance to the listener.
virtual AmReal32 GetGain (const Entity & entity, const Listener & listener) const = 0
Returns the gain of the sound from the given distance to the listener.
virtual const Curve & GetGainCurve () const = 0
Returns the gain curve attached to this Attenuation .
virtual AmReal64 GetMaxDistance () const = 0
Returns the maximum distance for a fully attenuated sound.
virtual AttenuationZone * GetShape () const = 0
Returns the shape object of this Attenuation .
virtual bool IsAirAbsorptionEnabled () const = 0
Returns whether air absorption is enabled for this Attenuation .

Public Functions inherited from SparkyStudios::Audio::Amplitude::Asset

See SparkyStudios::Audio::Amplitude::Asset

Type Name
virtual Id GetId () const = 0
Returns the unique ID of this asset.
virtual const AmString & GetName () const = 0
Gets the name of this asset.
virtual ~Asset () = default
Destroys the asset and all related resources.

Public Functions Documentation

EvaluateAirAbsorption

Evaluates the air absorption effect for a specific frequency band.

virtual AmReal32 Amplitude::Attenuation::EvaluateAirAbsorption (
    const AmVector3 & soundLocation,
    const AmVector3 & listenerLocation,
    AmUInt32 band
) const = 0

This method calculates the attenuation factor due to air absorption at a given frequency band for a sound source located at a specific position and a listener located at another specific position.

Parameters:

  • soundLocation The location of the sound source.
  • listenerLocation The location of the listener who is hearing the sound.
  • band The frequency band for which the air absorption effect is evaluated.

Returns:

The air absorption attenuation factor in decibels (dB) for the given frequency band.

GetGain[1/2]

Returns the gain of the sound from the given distance to the listener.

virtual AmReal32 Amplitude::Attenuation::GetGain (
    const AmVector3 & soundLocation,
    const Listener & listener
) const = 0

Parameters:

  • soundLocation The location of the sound source.
  • listener The listener which is hearing the sound.

Returns:

The computed gain value from the curve.

GetGain[2/2]

Returns the gain of the sound from the given distance to the listener.

virtual AmReal32 Amplitude::Attenuation::GetGain (
    const Entity & entity,
    const Listener & listener
) const = 0

Parameters:

  • entity The entity which emits the sound.
  • listener The listener which is hearing the sound.

Returns:

The computed gain value from the curve.

GetGainCurve

Returns the gain curve attached to this Attenuation .

virtual const Curve & Amplitude::Attenuation::GetGainCurve () const = 0

Returns:

The attenuation's gain curve.

GetMaxDistance

Returns the maximum distance for a fully attenuated sound.

virtual AmReal64 Amplitude::Attenuation::GetMaxDistance () const = 0

Returns:

The maximum sound attenuation distance.

GetShape

Returns the shape object of this Attenuation .

virtual AttenuationZone * Amplitude::Attenuation::GetShape () const = 0

Returns:

The Attenuation shape.

IsAirAbsorptionEnabled

Returns whether air absorption is enabled for this Attenuation .

virtual bool Amplitude::Attenuation::IsAirAbsorptionEnabled () const = 0

Returns:

true if air absorption is enabled, false otherwise.


The documentation for this class was generated from the following file: include/SparkyStudios/Audio/Amplitude/Sound/Attenuation.h