OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4SoundModifierReverb Class Reference

#include <C4SoundModifiers.h>

Inheritance diagram for C4SoundModifierReverb:
[legend]
Collaboration diagram for C4SoundModifierReverb:
[legend]

Public Types

enum  Type {
  C4SMT_None = 0x0, C4SMT_Reverb = 0x1, C4SMT_Echo = 0x4, C4SMT_Equalizer = 0xc,
  C4SMT_Max = 0xc
}
 

Public Member Functions

 C4SoundModifierReverb (C4PropList *in_props)
 
void Update () override
 
void Release ()
 
void AddRef ()
 
void DelRef ()
 
int32_t GetRefCount () const
 
const C4PropListGetProps () const
 
void ApplyTo (ALuint source)
 

Protected Member Functions

float GetFloatProp (C4PropertyName key, float ratio, float default_value)
 
bool GetBoolProp (C4PropertyName key, bool default_value)
 

Protected Attributes

ALuint effect
 
ALuint slot
 

Detailed Description

Definition at line 82 of file C4SoundModifiers.h.

Member Enumeration Documentation

enum C4SoundModifier::Type
inherited
Enumerator
C4SMT_None 
C4SMT_Reverb 
C4SMT_Echo 
C4SMT_Equalizer 
C4SMT_Max 

Definition at line 29 of file C4SoundModifiers.h.

Constructor & Destructor Documentation

C4SoundModifierReverb::C4SoundModifierReverb ( C4PropList in_props)

Definition at line 116 of file C4SoundModifiers.cpp.

References C4SoundModifier::effect.

117  : C4SoundModifier(in_props)
118 {
119 #if (AUDIO_TK == AUDIO_TK_OPENAL) && defined(HAVE_ALEXT)
120  alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_REVERB);
121 #endif
122 }
C4SoundModifier(C4PropList *in_props)

Member Function Documentation

void C4SoundModifier::AddRef ( )
inlineinherited

Definition at line 69 of file C4SoundModifiers.h.

Referenced by C4SoundInstance::Create(), C4SoundModifierList::SetGlobalModifier(), and C4SoundInstance::SetModifier().

69 { ++instance_count; }

Here is the caller graph for this function:

void C4SoundModifier::ApplyTo ( ALuint  source)
inherited

Definition at line 93 of file C4SoundModifiers.cpp.

References C4SoundModifier::slot.

Referenced by C4SoundInstance::SetModifier(), and C4SoundInstance::Start().

94 {
95  // apply slot to source if valid
96 #if defined(HAVE_ALEXT)
97  if (slot) alSource3i(source, AL_AUXILIARY_SEND_FILTER, slot, 0, AL_FILTER_NULL);
98 #endif
99 }

Here is the caller graph for this function:

void C4SoundModifier::DelRef ( )
inlineinherited

Definition at line 70 of file C4SoundModifiers.h.

Referenced by C4SoundInstance::Clear(), C4SoundModifierList::SetGlobalModifier(), and C4SoundInstance::SetModifier().

70 { if (!--instance_count && released) delete this; }

Here is the caller graph for this function:

bool C4SoundModifier::GetBoolProp ( C4PropertyName  key,
bool  default_value 
)
protectedinherited

Definition at line 109 of file C4SoundModifiers.cpp.

References C4Value::_getPropList(), and C4PropList::GetPropertyInt().

Referenced by Update().

110 {
111  // get scaled property and fill in default value
112  C4PropList *p = props._getPropList();
113  return (p->GetPropertyInt(key, int32_t(default_value ? 1 : 0)) != 0);
114 }
int32_t GetPropertyInt(C4PropertyName k, int32_t default_val=0) const
Definition: C4PropList.cpp:886
C4PropList * _getPropList() const
Definition: C4Value.h:129

Here is the call graph for this function:

Here is the caller graph for this function:

float C4SoundModifier::GetFloatProp ( C4PropertyName  key,
float  ratio,
float  default_value 
)
protectedinherited

Definition at line 102 of file C4SoundModifiers.cpp.

References C4Value::_getPropList(), and C4PropList::GetPropertyInt().

Referenced by Update(), C4SoundModifierEcho::Update(), and C4SoundModifierEqualizer::Update().

103 {
104  // get scaled property and fill in default value
105  C4PropList *p = props._getPropList();
106  return float(p->GetPropertyInt(key, int32_t(default_value * ratio))) / ratio;
107 }
int32_t GetPropertyInt(C4PropertyName k, int32_t default_val=0) const
Definition: C4PropList.cpp:886
C4PropList * _getPropList() const
Definition: C4Value.h:129

Here is the call graph for this function:

Here is the caller graph for this function:

const C4PropList* C4SoundModifier::GetProps ( ) const
inlineinherited

Definition at line 73 of file C4SoundModifiers.h.

References C4Value::_getPropList().

73 { return props._getPropList(); }
C4PropList * _getPropList() const
Definition: C4Value.h:129

Here is the call graph for this function:

int32_t C4SoundModifier::GetRefCount ( ) const
inlineinherited

Definition at line 71 of file C4SoundModifiers.h.

Referenced by C4SoundModifierList::Clear().

71 { return instance_count; }

Here is the caller graph for this function:

void C4SoundModifier::Release ( )
inlineinherited

Definition at line 66 of file C4SoundModifiers.h.

References C4Value::Set0().

Referenced by C4SoundModifierList::Clear().

66  {
67  if (!instance_count) delete this; else { released = true; props.Set0(); }
68  }
void Set0()
Definition: C4Value.h:336

Here is the call graph for this function:

Here is the caller graph for this function:

void C4SoundModifierReverb::Update ( )
overridevirtual

Reimplemented from C4SoundModifier.

Definition at line 124 of file C4SoundModifiers.cpp.

References Application, C4SoundModifier::effect, C4SoundModifier::GetBoolProp(), C4SoundModifier::GetFloatProp(), C4Application::MusicSystem, P_Reverb_Air_Absorption_GainHF, P_Reverb_Decay_HFLimit, P_Reverb_Decay_HFRatio, P_Reverb_Decay_Time, P_Reverb_Density, P_Reverb_Diffusion, P_Reverb_Gain, P_Reverb_GainHF, P_Reverb_Late_Reverb_Delay, P_Reverb_Late_Reverb_Gain, P_Reverb_Reflections_Delay, P_Reverb_Reflections_Gain, P_Reverb_Room_Rolloff_Factor, C4MusicSystem::SelectContext(), and C4SoundModifier::Update().

125 {
126 #if (AUDIO_TK == AUDIO_TK_OPENAL) && defined(HAVE_ALEXT)
127  // use the cave preset as default for the reverb modifier
129  alEffectf(effect, AL_REVERB_DENSITY, GetFloatProp(P_Reverb_Density, 1000, 1.0f));
130  alEffectf(effect, AL_REVERB_DIFFUSION, GetFloatProp(P_Reverb_Diffusion, 1000, 1.0f));
131  alEffectf(effect, AL_REVERB_GAIN, GetFloatProp(P_Reverb_Gain, 1000, 0.316f));
132  alEffectf(effect, AL_REVERB_GAINHF, GetFloatProp(P_Reverb_GainHF, 1000, 1.0f));
133  alEffectf(effect, AL_REVERB_DECAY_TIME, GetFloatProp(P_Reverb_Decay_Time, 1000, 2.91f));
134  alEffectf(effect, AL_REVERB_DECAY_HFRATIO, GetFloatProp(P_Reverb_Decay_HFRatio, 1000, 1.3f));
135  alEffectf(effect, AL_REVERB_REFLECTIONS_GAIN, GetFloatProp(P_Reverb_Reflections_Gain, 1000, 0.5f));
136  alEffectf(effect, AL_REVERB_REFLECTIONS_DELAY, GetFloatProp(P_Reverb_Reflections_Delay, 1000, 0.015f));
137  alEffectf(effect, AL_REVERB_LATE_REVERB_GAIN, GetFloatProp(P_Reverb_Late_Reverb_Gain, 1000, 0.706f));
138  alEffectf(effect, AL_REVERB_LATE_REVERB_DELAY, GetFloatProp(P_Reverb_Late_Reverb_Delay, 1000, 0.022f));
139  alEffectf(effect, AL_REVERB_AIR_ABSORPTION_GAINHF, GetFloatProp(P_Reverb_Air_Absorption_GainHF, 1000, 0.994f));
140  alEffectf(effect, AL_REVERB_ROOM_ROLLOFF_FACTOR, GetFloatProp(P_Reverb_Room_Rolloff_Factor, 1000, 0.0f));
141  alEffecti(effect, AL_REVERB_DECAY_HFLIMIT, GetBoolProp(P_Reverb_Decay_HFLimit, true) ? 1 : 0);
142 #endif
144 }
float GetFloatProp(C4PropertyName key, float ratio, float default_value)
void SelectContext()
bool GetBoolProp(C4PropertyName key, bool default_value)
virtual void Update()
C4Application Application
Definition: C4Globals.cpp:44
C4MusicSystem MusicSystem
Definition: C4Application.h:41

Here is the call graph for this function:

Member Data Documentation

ALuint C4SoundModifier::slot
protectedinherited

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