diff options
author | Chris Robinson <[email protected]> | 2011-05-18 18:52:47 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-05-18 18:52:47 -0700 |
commit | b838d123f899359e791450271d09324668f2d25c (patch) | |
tree | b1f79d6d7342910c14a87da5e874c4fcd3be5f45 | |
parent | 1d3926e1872657da9b0490cff233454b583ff964 (diff) |
Multiply the history offset in the filtering funcitons
-rw-r--r-- | Alc/mixer.c | 12 | ||||
-rw-r--r-- | OpenAL32/Include/alFilter.h | 38 |
2 files changed, 8 insertions, 42 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c index 61dfe00b..33181890 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -111,7 +111,7 @@ static void Mix_Hrtf_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ if(LIKELY(OutPos == 0)) \ { \ value = sampler(data + pos*NumChannels + i, NumChannels, frac); \ - value = lpFilter2PC(DryFilter, i*2, value); \ + value = lpFilter2PC(DryFilter, i, value); \ \ HrtfHistory[i][HrtfOffset&HRTF_LENGTH_MASK] = value; \ for(c = 0;c < HRTF_LENGTH;c++) \ @@ -127,7 +127,7 @@ static void Mix_Hrtf_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ for(BufferIdx = 0;BufferIdx < BufferSize;BufferIdx++) \ { \ value = sampler(data + pos*NumChannels + i, NumChannels, frac); \ - value = lpFilter2P(DryFilter, i*2, value); \ + value = lpFilter2P(DryFilter, i, value); \ \ HrtfHistory[i][HrtfOffset&HRTF_LENGTH_MASK] = value; \ for(c = 0;c < HRTF_LENGTH;c++) \ @@ -149,7 +149,7 @@ static void Mix_Hrtf_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ if(LIKELY(OutPos == SamplesToDo)) \ { \ value = sampler(data + pos*NumChannels + i, NumChannels, frac); \ - value = lpFilter2PC(DryFilter, i*2, value); \ + value = lpFilter2PC(DryFilter, i, value); \ \ HrtfHistory[i][HrtfOffset&HRTF_LENGTH_MASK] = value; \ for(c = 0;c < HRTF_LENGTH;c++) \ @@ -278,7 +278,7 @@ static void Mix_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ { \ value = sampler(data + pos*NumChannels + i, NumChannels, frac); \ \ - value = lpFilter2PC(DryFilter, i*2, value); \ + value = lpFilter2PC(DryFilter, i, value); \ for(c = 0;c < MAXCHANNELS;c++) \ ClickRemoval[c] -= value*DrySend[i][c]; \ } \ @@ -286,7 +286,7 @@ static void Mix_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ { \ value = sampler(data + pos*NumChannels + i, NumChannels, frac); \ \ - value = lpFilter2P(DryFilter, i*2, value); \ + value = lpFilter2P(DryFilter, i, value); \ for(c = 0;c < MAXCHANNELS;c++) \ DryBuffer[OutPos][c] += value*DrySend[i][c]; \ \ @@ -299,7 +299,7 @@ static void Mix_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ { \ value = sampler(data + pos*NumChannels + i, NumChannels, frac); \ \ - value = lpFilter2PC(DryFilter, i*2, value); \ + value = lpFilter2PC(DryFilter, i, value); \ for(c = 0;c < MAXCHANNELS;c++) \ PendingClicks[c] += value*DrySend[i][c]; \ } \ diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h index 927b7fc4..fc91bb16 100644 --- a/OpenAL32/Include/alFilter.h +++ b/OpenAL32/Include/alFilter.h @@ -16,28 +16,10 @@ typedef struct { ALfloat history[1]; #endif } FILTER; -/* -static __inline ALfloat lpFilter4P(FILTER *iir, ALuint offset, ALfloat input) -{ - ALfloat *history = &iir->history[offset]; - ALfloat a = iir->coeff; - ALfloat output = input; - - output = output + (history[0]-output)*a; - history[0] = output; - output = output + (history[1]-output)*a; - history[1] = output; - output = output + (history[2]-output)*a; - history[2] = output; - output = output + (history[3]-output)*a; - history[3] = output; - return output; -} -*/ static __inline ALfloat lpFilter2P(FILTER *iir, ALuint offset, ALfloat input) { - ALfloat *history = &iir->history[offset]; + ALfloat *history = &iir->history[offset*2]; ALfloat a = iir->coeff; ALfloat output = input; @@ -48,7 +30,6 @@ static __inline ALfloat lpFilter2P(FILTER *iir, ALuint offset, ALfloat input) return output; } - static __inline ALfloat lpFilter1P(FILTER *iir, ALuint offset, ALfloat input) { ALfloat *history = &iir->history[offset]; @@ -60,24 +41,10 @@ static __inline ALfloat lpFilter1P(FILTER *iir, ALuint offset, ALfloat input) return output; } -/* -static __inline ALfloat lpFilter4PC(const FILTER *iir, ALuint offset, ALfloat input) -{ - const ALfloat *history = &iir->history[offset]; - ALfloat a = iir->coeff; - ALfloat output = input; - - output = output + (history[0]-output)*a; - output = output + (history[1]-output)*a; - output = output + (history[2]-output)*a; - output = output + (history[3]-output)*a; - return output; -} -*/ static __inline ALfloat lpFilter2PC(const FILTER *iir, ALuint offset, ALfloat input) { - const ALfloat *history = &iir->history[offset]; + const ALfloat *history = &iir->history[offset*2]; ALfloat a = iir->coeff; ALfloat output = input; @@ -86,7 +53,6 @@ static __inline ALfloat lpFilter2PC(const FILTER *iir, ALuint offset, ALfloat in return output; } - static __inline ALfloat lpFilter1PC(FILTER *iir, ALuint offset, ALfloat input) { const ALfloat *history = &iir->history[offset]; |