summaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alAuxEffectSlot.h6
-rw-r--r--OpenAL32/Include/alFilter.h8
-rw-r--r--OpenAL32/Include/alSource.h2
-rw-r--r--OpenAL32/alAuxEffectSlot.c5
-rw-r--r--OpenAL32/alSource.c5
5 files changed, 24 insertions, 2 deletions
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h
index d4cb0d11..9bae788d 100644
--- a/OpenAL32/Include/alAuxEffectSlot.h
+++ b/OpenAL32/Include/alAuxEffectSlot.h
@@ -1,8 +1,9 @@
#ifndef _AL_AUXEFFECTSLOT_H_
#define _AL_AUXEFFECTSLOT_H_
-#include "alEffect.h"
#include "AL/al.h"
+#include "alEffect.h"
+#include "alFilter.h"
#ifdef __cplusplus
extern "C" {
@@ -28,7 +29,8 @@ typedef struct ALeffectslot
ALuint ReverbReflectPos;
ALuint ReverbLatePos;
ALfloat ReverbDecayGain;
- ALfloat LastDecaySample;
+
+ FILTER iirFilter;
ALuint refcount;
diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h
index 038304e8..f1d24d0f 100644
--- a/OpenAL32/Include/alFilter.h
+++ b/OpenAL32/Include/alFilter.h
@@ -7,6 +7,11 @@
extern "C" {
#endif
+typedef struct {
+ float *history; /* pointer to history in filter */
+ float *coef; /* pointer to coefficients of filter */
+} FILTER;
+
#define AL_FILTER_TYPE 0x8001
#define AL_FILTER_NULL 0x0000
@@ -48,6 +53,9 @@ AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pf
ALvoid ReleaseALFilters(ALvoid);
+float lpFilter(FILTER *iir, float input);
+int InitLowPassFilter(ALCcontext *Context, FILTER *iir);
+
#ifdef __cplusplus
}
#endif
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index 1d3fc57c..73b02609 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -75,6 +75,8 @@ typedef struct ALsource
ALboolean WetGainHFAuto;
ALfloat OuterGainHF;
+ FILTER iirFilter;
+
ALfloat AirAbsorptionFactor;
ALfloat RoomRolloffFactor;
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 23765cf6..e05448cd 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -71,6 +71,8 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo
break;
}
+ InitLowPassFilter(Context, &(*list)->iirFilter);
+
(*list)->Gain = 1.0;
(*list)->AuxSendAuto = AL_TRUE;
(*list)->refcount = 0;
@@ -139,6 +141,9 @@ AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, ALuint *effect
ALAuxiliaryEffectSlot = ((ALeffectslot*)ALTHUNK_LOOKUPENTRY(effectslots[i]));
+ free(ALAuxiliaryEffectSlot->iirFilter.coef);
+ free(ALAuxiliaryEffectSlot->iirFilter.history);
+
// Remove Source from list of Sources
list = &Context->AuxiliaryEffectSlot;
while(*list && *list != ALAuxiliaryEffectSlot)
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 89212933..1960b676 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -75,6 +75,8 @@ ALAPI ALvoid ALAPIENTRY alGenSources(ALsizei n,ALuint *sources)
break;
}
+ InitLowPassFilter(Context, &(*list)->iirFilter);
+
sources[i] = (ALuint)ALTHUNK_ADDENTRY(*list);
(*list)->source = sources[i];
@@ -179,6 +181,9 @@ ALAPI ALvoid ALAPIENTRY alDeleteSources(ALsizei n, const ALuint *sources)
ALSource->Send[j].Slot = NULL;
}
+ free(ALSource->iirFilter.coef);
+ free(ALSource->iirFilter.history);
+
// Decrement Source count
Context->SourceCount--;