summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/hrtf.c2
-rw-r--r--Alc/mixer.c55
-rw-r--r--OpenAL32/Include/alMain.h2
-rw-r--r--OpenAL32/Include/alSource.h5
-rw-r--r--OpenAL32/alSource.c6
5 files changed, 35 insertions, 35 deletions
diff --git a/Alc/hrtf.c b/Alc/hrtf.c
index b33a7a9a..87f98b9a 100644
--- a/Alc/hrtf.c
+++ b/Alc/hrtf.c
@@ -82,7 +82,7 @@ void InitHrtf(void)
}
if(f != NULL)
{
- const ALubyte maxDelay = SRC_HISTORY_LENGTH - HRIR_LENGTH;
+ const ALubyte maxDelay = SRC_HISTORY_LENGTH;
ALboolean failed = AL_FALSE;
struct HRTF newdata;
size_t i, j;
diff --git a/Alc/mixer.c b/Alc/mixer.c
index 9a746ff9..86337a2e 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -98,10 +98,10 @@ static void Mix_Hrtf_##T##_##sampler(ALsource *Source, ALCdevice *Device, \
\
for(i = 0;i < NumChannels;i++) \
{ \
- static const ALuint MaxDelay = SRC_HISTORY_LENGTH - HRIR_LENGTH; \
ALfloat (*RESTRICT Coeffs)[2] = Source->Params.HrtfCoeffs[i]; \
const ALuint *RESTRICT Delay = Source->Params.HrtfDelay[i]; \
- ALfloat (*RESTRICT History)[2] = Source->HrtfHistory[i]; \
+ ALfloat *RESTRICT History = Source->HrtfHistory[i]; \
+ ALfloat (*RESTRICT Values)[2] = Source->HrtfValues[i]; \
ALuint Offset = Source->HrtfOffset + OutPos; \
\
pos = 0; \
@@ -112,18 +112,17 @@ static void Mix_Hrtf_##T##_##sampler(ALsource *Source, ALCdevice *Device, \
value = sampler(data + pos*NumChannels + i, NumChannels, frac); \
value = lpFilter2PC(DryFilter, i, value); \
\
- History[Offset&SRC_HISTORY_MASK][0] = value; \
- History[Offset&SRC_HISTORY_MASK][1] = value; \
+ History[Offset&SRC_HISTORY_MASK] = value; \
\
- History[(Offset-MaxDelay)&SRC_HISTORY_MASK][0] = \
- History[(Offset-Delay[0])&SRC_HISTORY_MASK][0];\
- History[(Offset-MaxDelay)&SRC_HISTORY_MASK][1] = \
- History[(Offset-Delay[1])&SRC_HISTORY_MASK][1];\
+ Values[Offset&HRIR_MASK][0] = \
+ History[(Offset-Delay[0])&SRC_HISTORY_MASK];\
+ Values[Offset&HRIR_MASK][1] = \
+ History[(Offset-Delay[1])&SRC_HISTORY_MASK];\
for(c = 0;c < HRIR_LENGTH;c++) \
{ \
- const ALuint off = (Offset-MaxDelay-c)&SRC_HISTORY_MASK; \
- ClickRemoval[FRONT_LEFT] -= History[off][0] * Coeffs[c][0]; \
- ClickRemoval[FRONT_RIGHT] -= History[off][1] * Coeffs[c][1]; \
+ const ALuint off = (Offset-c)&HRIR_MASK; \
+ ClickRemoval[FRONT_LEFT] -= Values[off][0] * Coeffs[c][0]; \
+ ClickRemoval[FRONT_RIGHT] -= Values[off][1] * Coeffs[c][1]; \
} \
} \
for(BufferIdx = 0;BufferIdx < BufferSize;BufferIdx++) \
@@ -131,18 +130,17 @@ static void Mix_Hrtf_##T##_##sampler(ALsource *Source, ALCdevice *Device, \
value = sampler(data + pos*NumChannels + i, NumChannels, frac); \
value = lpFilter2P(DryFilter, i, value); \
\
- History[Offset&SRC_HISTORY_MASK][0] = value; \
- History[Offset&SRC_HISTORY_MASK][1] = value; \
+ History[Offset&SRC_HISTORY_MASK] = value; \
\
- History[(Offset-MaxDelay)&SRC_HISTORY_MASK][0] = \
- History[(Offset-Delay[0])&SRC_HISTORY_MASK][0];\
- History[(Offset-MaxDelay)&SRC_HISTORY_MASK][1] = \
- History[(Offset-Delay[1])&SRC_HISTORY_MASK][1];\
+ Values[Offset&HRIR_MASK][0] = \
+ History[(Offset-Delay[0])&SRC_HISTORY_MASK];\
+ Values[Offset&HRIR_MASK][1] = \
+ History[(Offset-Delay[1])&SRC_HISTORY_MASK];\
for(c = 0;c < HRIR_LENGTH;c++) \
{ \
- const ALuint off = (Offset-MaxDelay-c)&SRC_HISTORY_MASK; \
- DryBuffer[OutPos][FRONT_LEFT] += History[off][0] * Coeffs[c][0];\
- DryBuffer[OutPos][FRONT_RIGHT] += History[off][1] * Coeffs[c][1];\
+ const ALuint off = (Offset-c)&HRIR_MASK; \
+ DryBuffer[OutPos][FRONT_LEFT] += Values[off][0] * Coeffs[c][0];\
+ DryBuffer[OutPos][FRONT_RIGHT] += Values[off][1] * Coeffs[c][1];\
} \
Offset++; \
\
@@ -156,18 +154,17 @@ static void Mix_Hrtf_##T##_##sampler(ALsource *Source, ALCdevice *Device, \
value = sampler(data + pos*NumChannels + i, NumChannels, frac); \
value = lpFilter2PC(DryFilter, i, value); \
\
- History[Offset&SRC_HISTORY_MASK][0] = value; \
- History[Offset&SRC_HISTORY_MASK][1] = value; \
+ History[Offset&SRC_HISTORY_MASK] = value; \
\
- History[(Offset-MaxDelay)&SRC_HISTORY_MASK][0] = \
- History[(Offset-Delay[0])&SRC_HISTORY_MASK][0];\
- History[(Offset-MaxDelay)&SRC_HISTORY_MASK][1] = \
- History[(Offset-Delay[1])&SRC_HISTORY_MASK][1];\
+ Values[Offset&HRIR_MASK][0] = \
+ History[(Offset-Delay[0])&SRC_HISTORY_MASK];\
+ Values[Offset&HRIR_MASK][1] = \
+ History[(Offset-Delay[1])&SRC_HISTORY_MASK];\
for(c = 0;c < HRIR_LENGTH;c++) \
{ \
- const ALuint off = (Offset-MaxDelay-c)&SRC_HISTORY_MASK; \
- PendingClicks[FRONT_LEFT] += History[off][0] * Coeffs[c][0]; \
- PendingClicks[FRONT_RIGHT] += History[off][1] * Coeffs[c][1]; \
+ const ALuint off = (Offset-c)&HRIR_MASK; \
+ PendingClicks[FRONT_LEFT] += Values[off][0] * Coeffs[c][0]; \
+ PendingClicks[FRONT_RIGHT] += Values[off][1] * Coeffs[c][1]; \
} \
} \
OutPos -= BufferSize; \
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index c77fa6eb..ab44fa55 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -497,7 +497,7 @@ ALboolean IsValidChannels(ALenum type);
#define HRIR_BITS (5)
#define HRIR_LENGTH (1<<HRIR_BITS)
-#define HRIR_LENGTH_MASK (HRIR_LENGTH-1)
+#define HRIR_MASK (HRIR_LENGTH-1)
void InitHrtf(void);
void GetHrtfCoeffs(ALfloat elevation, ALfloat angle, const ALshort **left, const ALshort **right, ALuint *ldelay, ALuint *rdelay);
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index 0572cbc1..e9c50f14 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -11,7 +11,7 @@
extern "C" {
#endif
-#define SRC_HISTORY_BITS (7)
+#define SRC_HISTORY_BITS (6)
#define SRC_HISTORY_LENGTH (1<<SRC_HISTORY_BITS)
#define SRC_HISTORY_MASK (SRC_HISTORY_LENGTH-1)
@@ -94,7 +94,8 @@ typedef struct ALsource
ALuint SampleSize;
/* HRTF info */
- ALfloat HrtfHistory[MAXCHANNELS][SRC_HISTORY_LENGTH][2];
+ ALfloat HrtfHistory[MAXCHANNELS][SRC_HISTORY_LENGTH];
+ ALfloat HrtfValues[MAXCHANNELS][HRIR_LENGTH][2];
ALuint HrtfOffset;
/* Current target parameters used for mixing */
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 9486915e..c50e648c 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -1382,9 +1382,11 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources)
{
ALuint k;
for(k = 0;k < SRC_HISTORY_LENGTH;k++)
+ Source->HrtfHistory[j][k] = 0.0f;
+ for(k = 0;k < HRIR_LENGTH;k++)
{
- Source->HrtfHistory[j][k][0] = 0.0f;
- Source->HrtfHistory[j][k][1] = 0.0f;
+ Source->HrtfValues[j][k][0] = 0.0f;
+ Source->HrtfValues[j][k][1] = 0.0f;
}
}
Source->HrtfOffset = 0;