diff options
author | Chris Robinson <[email protected]> | 2014-05-17 07:54:25 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-05-17 07:54:25 -0700 |
commit | 82dd2d875e9b7549eaa63f9d1a3e08635aafa524 (patch) | |
tree | 7991685c891870e54f4dff7629f7e609bb23d7cd /OpenAL32 | |
parent | 3a26ebef0bbe62f3143c5cb3de0e108f0bcb8b91 (diff) |
Apply high-pass source filters as needed
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alSource.h | 4 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 4 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 12 |
3 files changed, 20 insertions, 0 deletions
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index 43e5bdf6..c3513525 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -109,12 +109,16 @@ typedef struct ALsource { ALfloat Gain; ALfloat GainHF; ALfloat HFReference; + ALfloat GainLF; + ALfloat LFReference; } Direct; struct { struct ALeffectslot *Slot; ALfloat Gain; ALfloat GainHF; ALfloat HFReference; + ALfloat GainLF; + ALfloat LFReference; } Send[MAX_SENDS]; /** Source needs to update its mixing parameters. */ diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index dd13a293..a3749ea1 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -42,6 +42,8 @@ extern "C" { enum ActiveFilters { AF_None = 0, AF_LowPass = 1, + AF_HighPass = 2, + AF_BandPass = AF_LowPass | AF_HighPass }; typedef struct HrtfState { @@ -61,6 +63,7 @@ typedef struct DirectParams { enum ActiveFilters Filters[MAX_INPUT_CHANNELS]; ALfilterState LpFilter[MAX_INPUT_CHANNELS]; + ALfilterState HpFilter[MAX_INPUT_CHANNELS]; /* If not 'moving', gain/coefficients are set directly without fading. */ ALboolean Moving; @@ -94,6 +97,7 @@ typedef struct SendParams { enum ActiveFilters Filters[MAX_INPUT_CHANNELS]; ALfilterState LpFilter[MAX_INPUT_CHANNELS]; + ALfilterState HpFilter[MAX_INPUT_CHANNELS]; ALboolean Moving; ALuint Counter; diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 16e3a930..7f8944a8 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -666,12 +666,16 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SrcIntProp p Source->Direct.Gain = 1.0f; Source->Direct.GainHF = 1.0f; Source->Direct.HFReference = LOWPASSFREQREF; + Source->Direct.GainLF = 1.0f; + Source->Direct.LFReference = HIGHPASSFREQREF; } else { Source->Direct.Gain = filter->Gain; Source->Direct.GainHF = filter->GainHF; Source->Direct.HFReference = filter->HFReference; + Source->Direct.GainLF = filter->GainLF; + Source->Direct.LFReference = filter->LFReference; } UnlockContext(Context); Source->NeedsUpdate = AL_TRUE; @@ -741,12 +745,16 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SrcIntProp p Source->Send[values[1]].Gain = 1.0f; Source->Send[values[1]].GainHF = 1.0f; Source->Send[values[1]].HFReference = LOWPASSFREQREF; + Source->Send[values[1]].GainLF = 1.0f; + Source->Send[values[1]].LFReference = HIGHPASSFREQREF; } else { Source->Send[values[1]].Gain = filter->Gain; Source->Send[values[1]].GainHF = filter->GainHF; Source->Send[values[1]].HFReference = filter->HFReference; + Source->Send[values[1]].GainLF = filter->GainLF; + Source->Send[values[1]].LFReference = filter->LFReference; } Source->NeedsUpdate = AL_TRUE; UnlockContext(Context); @@ -2319,11 +2327,15 @@ static ALvoid InitSourceParams(ALsource *Source) Source->Direct.Gain = 1.0f; Source->Direct.GainHF = 1.0f; Source->Direct.HFReference = LOWPASSFREQREF; + Source->Direct.GainLF = 1.0f; + Source->Direct.LFReference = HIGHPASSFREQREF; for(i = 0;i < MAX_SENDS;i++) { Source->Send[i].Gain = 1.0f; Source->Send[i].GainHF = 1.0f; Source->Send[i].HFReference = LOWPASSFREQREF; + Source->Send[i].GainLF = 1.0f; + Source->Send[i].LFReference = HIGHPASSFREQREF; } Source->NeedsUpdate = AL_TRUE; |