GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::audio Namespace Reference

Classes

struct  Error
 Exception type for domain-specific errors originating from the grem::audio module. More...
struct  BiquadResonantFilterOptions
 Configuration options for a BiquadResonantFilter. More...
class  BiquadResonantFilter
 Biquadratic resonant filter for filtering out frequencies above/below a threshold. More...
struct  EchoFilterOptions
 Configuration options for an EchoFilter. More...
class  EchoFilter
 Echo filter that repeats the sound at lower and lower volumes until it fades out. More...
struct  LoFiFilterOptions
 Configuration options for a LoFiFilter. More...
class  LoFiFilter
 Signal degrading lo-fi filter for reducing the sound's bit depth and sample rate. More...
struct  FlangerFilterOptions
 Configuration options for a FlangerFilter. More...
class  FlangerFilter
 Flanger effect filter. More...
struct  DCRemovalFilterOptions
 Configuration options for a DCRemovalFilter. More...
class  DCRemovalFilter
 Filter for removing DC signal from the sound, i.e. centering the sound waveform around 0. More...
struct  FreeverbFilterOptions
 Configuration options for a FreeverbFilter. More...
class  FreeverbFilter
 Reverb filter based on Freeverb (high quality, but relatively heavy). More...
struct  EqualizationFilterOptions
 Configuration options for an EqualizationFilter. More...
class  EqualizationFilter
 Equalization (EQ) filter for adjusting the volume levels of 8 different frequency bands in the sound. More...
struct  DuckingFilterOptions
 Configuration options for a DuckingFilter. More...
class  DuckingFilter
 Ducking filter for reducing the volume of a sound when another sound is active. More...
struct  Listener
 Current state of the sound listener, i.e. the user perceiving the audio, within a SoundStage. More...
struct  SoundOptions
 Configuration options for a Sound. More...
class  Sound
 Container for a particular sound wave that can be played in a SoundStage. More...
struct  SoundInstanceID
 Opaque handle to a specific instance of a sound or sound mix playing in a sound stage or sound mix. More...
struct  SoundMixOptions
 Configuration options for a SoundMix. More...
class  SoundMix
 Container for a mix of sound waves that can be played in a SoundStage. More...
struct  Panning
 Panning parameters for a listener-relative sound. More...
struct  SoundStageOptions
 Configuration options for a SoundStage. More...
class  SoundStage
 Persistent system for playing sound in a simulated 3D arena to the default audio device. More...

Concepts

concept  filter
 Concept that checks if a type is a valid sound filter type.

Enumerations

enum class  BiquadResonantFilterType : int { LOWPASS = 0 , HIGHPASS = 1 , BANDPASS = 2 }
 Filter type of a BiquadResonantFilter. More...
enum class  SoundAttenuationModel : uint8_t { NO_ATTENUATION = 0 , INVERSE_DISTANCE = 1 , LINEAR_DISTANCE = 2 , EXPONENTIAL_DISTANCE = 3 }
 Distance attenuation/falloff model for 3D positional audio. More...

Enumeration Type Documentation

◆ BiquadResonantFilterType

enum class grem::audio::BiquadResonantFilterType : int
strong

Filter type of a BiquadResonantFilter.

Enumerator
LOWPASS 

Preserve the sound frequencies below the cutoff frequency, filter those above.

HIGHPASS 

Preserve the sound frequencies above the cutoff frequency, filter those below.

BANDPASS 

Preserve the sound frequencies near the cutoff frequency, filter those above and below.

◆ SoundAttenuationModel

enum class grem::audio::SoundAttenuationModel : uint8_t
strong

Distance attenuation/falloff model for 3D positional audio.

Enumerator
NO_ATTENUATION 

No distance attenuation; sound has the same volume regardless of distance between the sound instance and the listener.

INVERSE_DISTANCE 

Attenuate the amplitude of the sound by the inverse distance between the sound instance and the listener according to the formula:

gain = dmin / (dmin + r * (clamp(d, dmin, dmax) - dmin))
GREM_ALWAYS_INLINE constexpr decltype(auto) clamp(T &&value, Low &&minValue, High &&maxValue)
Clamp a value to a specific interval.
Definition fundamentals.hpp:630

where:

  • d is the linear distance between the sound instance and the listener,
  • dmin = minDistance,
  • dmax = maxDistance,
  • r = rolloffFactor.
Warning
When using this attenuation model:
  • minDistance must be less than or equal to maxDistance.
  • minDistance must be greater than 0.
  • rolloffFactor must be greater than 0.
LINEAR_DISTANCE 

Attenuate the amplitude of the sound by the linear distance between the sound instance and the listener according to the formula:

gain = 1 - r * (clamp(d, dmin, dmax) - dmin) / (dmax - dmin)

where:

  • d is the linear distance between the sound instance and the listener,
  • dmin = minDistance,
  • dmax = maxDistance,
  • r = rolloffFactor.
Warning
When using this attenuation model:
  • minDistance must be less than or equal to maxDistance.
  • rolloffFactor must be between 0 and 1 (inclusive).
EXPONENTIAL_DISTANCE 

Attenuate the amplitude of the sound by the exponential distance between the sound instance and the listener according to the formula:

gain = pow(clamp(d, dmin, dmax) / dmin, -r)
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL pow(T a, T b) noexcept
Calculate the result of raising a given value to a given power.
Definition math.hpp:1179

where:

  • d is the linear distance between the sound instance and the listener,
  • dmin = minDistance,
  • dmax = maxDistance,
  • r = rolloffFactor.
Warning
When using this attenuation model:
  • minDistance must be less than or equal to maxDistance.
  • minDistance must be greater than 0.
  • rolloffFactor must be greater than 0.