diff options
author | Chris Robinson <[email protected]> | 2014-03-23 07:31:33 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-03-23 07:31:33 -0700 |
commit | 55f851093f08bc1274a4b49c85a0651a9f6e9c0f (patch) | |
tree | 12463e35113b48726a202a8146fab578307cfed3 | |
parent | 92433532fef79583f04141db235799a143c5801b (diff) |
Remove the now-unneeded click removal buffers for the device
They are still there for auxiliary sends. However, they should go away soon
enough too, and then we won't have to mess around with calculating extra
"predictive" samples in the mixer.
-rw-r--r-- | Alc/ALc.c | 7 | ||||
-rw-r--r-- | Alc/ALu.c | 55 | ||||
-rw-r--r-- | Alc/mixer.c | 3 | ||||
-rw-r--r-- | Alc/mixer_c.c | 2 | ||||
-rw-r--r-- | Alc/mixer_defs.h | 12 | ||||
-rw-r--r-- | Alc/mixer_inc.c | 2 | ||||
-rw-r--r-- | Alc/mixer_neon.c | 2 | ||||
-rw-r--r-- | Alc/mixer_sse.c | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 3 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 5 |
10 files changed, 20 insertions, 73 deletions
@@ -1607,7 +1607,6 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) enum DevFmtType oldType; ALCuint oldFreq; FPUCtl oldMode; - ALuint i; // Check for attributes if(device->Type == Loopback) @@ -1844,12 +1843,6 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) aluInitPanning(device); - for(i = 0;i < MaxChannels;i++) - { - device->ClickRemoval[i] = 0.0f; - device->PendingClicks[i] = 0.0f; - } - V(device->Synth,update)(device); device->Hrtf = NULL; @@ -309,8 +309,6 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALCcontext *ALContext) DirectChannels = ALSource->DirectChannels; src->Direct.OutBuffer = Device->DryBuffer; - src->Direct.ClickRemoval = Device->ClickRemoval; - src->Direct.PendingClicks = Device->PendingClicks; for(i = 0;i < NumSends;i++) { ALeffectslot *Slot = ALSource->Send[i].Slot; @@ -659,8 +657,6 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext) RoomRolloffBase = ALSource->RoomRolloffFactor; src->Direct.OutBuffer = Device->DryBuffer; - src->Direct.ClickRemoval = Device->ClickRemoval; - src->Direct.PendingClicks = Device->PendingClicks; for(i = 0;i < NumSends;i++) { ALeffectslot *Slot = ALSource->Send[i].Slot; @@ -1254,52 +1250,17 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) device->SamplesDone %= device->Frequency; ALCdevice_Unlock(device); - /* Click-removal. Could do better; this only really handles immediate - * changes between updates where a predictive sample could be - * generated. Delays caused by effects and HRTF aren't caught. */ - if(device->FmtChans == DevFmtStereo) + if(device->Bs2b) { - /* Assumes the first two channels are FrontLeft and FrontRight */ - for(c = 0;c < 2;c++) - { - ALfloat offset = device->ClickRemoval[c]; - if(offset < (1.0f/32768.0f)) - offset = 0.0f; - else for(i = 0;i < SamplesToDo;i++) - { - device->DryBuffer[c][i] += offset; - offset -= offset * (1.0f/256.0f); - } - device->ClickRemoval[c] = offset + device->PendingClicks[c]; - device->PendingClicks[c] = 0.0f; - } - if(device->Bs2b) + /* Apply binaural/crossfeed filter */ + for(i = 0;i < SamplesToDo;i++) { float samples[2]; - for(i = 0;i < SamplesToDo;i++) - { - samples[0] = device->DryBuffer[FrontLeft][i]; - samples[1] = device->DryBuffer[FrontRight][i]; - bs2b_cross_feed(device->Bs2b, samples); - device->DryBuffer[FrontLeft][i] = samples[0]; - device->DryBuffer[FrontRight][i] = samples[1]; - } - } - } - else - { - for(c = 0;c < MaxChannels;c++) - { - ALfloat offset = device->ClickRemoval[c]; - if(offset < (1.0f/32768.0f)) - offset = 0.0f; - else for(i = 0;i < SamplesToDo;i++) - { - device->DryBuffer[c][i] += offset; - offset -= offset * (1.0f/256.0f); - } - device->ClickRemoval[c] = offset + device->PendingClicks[c]; - device->PendingClicks[c] = 0.0f; + samples[0] = device->DryBuffer[FrontLeft][i]; + samples[1] = device->DryBuffer[FrontRight][i]; + bs2b_cross_feed(device->Bs2b, samples); + device->DryBuffer[FrontLeft][i] = samples[0]; + device->DryBuffer[FrontRight][i] = samples[1]; } } diff --git a/Alc/mixer.c b/Alc/mixer.c index 96acb3e8..ae6b324f 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -331,8 +331,7 @@ ALvoid MixSource(ALactivesource *src, ALCdevice *Device, ALuint SamplesToDo) DoFilter(&directparms->LpFilter[chan], SrcData, ResampledData, DstBufferSize); - src->DryMix(directparms, SrcData, chan, OutPos, - SamplesToDo, DstBufferSize); + src->DryMix(directparms, SrcData, chan, OutPos, DstBufferSize); } for(j = 0;j < Device->NumAuxSends;j++) diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c index e83655e6..a4028beb 100644 --- a/Alc/mixer_c.c +++ b/Alc/mixer_c.c @@ -83,7 +83,7 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], void MixDirect_C(DirectParams *params, const ALfloat *restrict data, ALuint srcchan, - ALuint OutPos, ALuint UNUSED(SamplesToDo), ALuint BufferSize) + ALuint OutPos, ALuint BufferSize) { ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer; ALuint Counter = maxu(params->Counter, OutPos) - OutPos; diff --git a/Alc/mixer_defs.h b/Alc/mixer_defs.h index 878db968..34430517 100644 --- a/Alc/mixer_defs.h +++ b/Alc/mixer_defs.h @@ -16,18 +16,18 @@ void Resample_cubic32_C(const ALfloat *src, ALuint frac, ALuint increment, ALflo /* C mixers */ -void MixDirect_Hrtf_C(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); -void MixDirect_C(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); +void MixDirect_Hrtf_C(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); +void MixDirect_C(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); void MixSend_C(struct SendParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); /* SSE mixers */ -void MixDirect_Hrtf_SSE(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); -void MixDirect_SSE(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); +void MixDirect_Hrtf_SSE(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); +void MixDirect_SSE(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); void MixSend_SSE(struct SendParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); /* Neon mixers */ -void MixDirect_Hrtf_Neon(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); -void MixDirect_Neon(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); +void MixDirect_Hrtf_Neon(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); +void MixDirect_Neon(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); void MixSend_Neon(struct SendParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); #endif /* MIXER_DEFS_H */ diff --git a/Alc/mixer_inc.c b/Alc/mixer_inc.c index c28c2e97..93118423 100644 --- a/Alc/mixer_inc.c +++ b/Alc/mixer_inc.c @@ -24,7 +24,7 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], void MixDirect_Hrtf(DirectParams *params, const ALfloat *restrict data, ALuint srcchan, - ALuint OutPos, ALuint UNUSED(SamplesToDo), ALuint BufferSize) + ALuint OutPos, ALuint BufferSize) { ALfloat (*restrict DryBuffer)[BUFFERSIZE] = params->OutBuffer; const ALuint IrSize = params->Mix.Hrtf.Params.IrSize; diff --git a/Alc/mixer_neon.c b/Alc/mixer_neon.c index 15703226..35dfd1f1 100644 --- a/Alc/mixer_neon.c +++ b/Alc/mixer_neon.c @@ -78,7 +78,7 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], void MixDirect_Neon(DirectParams *params, const ALfloat *restrict data, ALuint srcchan, - ALuint OutPos, ALuint UNUSED(SamplesToDo), ALuint BufferSize) + ALuint OutPos, ALuint BufferSize) { ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer; ALuint Counter = maxu(params->Counter, OutPos) - OutPos; diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c index 52785086..38435dac 100644 --- a/Alc/mixer_sse.c +++ b/Alc/mixer_sse.c @@ -141,7 +141,7 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], void MixDirect_SSE(DirectParams *params, const ALfloat *restrict data, ALuint srcchan, - ALuint OutPos, ALuint UNUSED(SamplesToDo), ALuint BufferSize) + ALuint OutPos, ALuint BufferSize) { ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer; ALuint Counter = maxu(params->Counter, OutPos) - OutPos; diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 519b825e..7a8aa53c 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -669,9 +669,6 @@ struct ALCdevice_struct // Dry path buffer mix ALIGN(16) ALfloat DryBuffer[MaxChannels][BUFFERSIZE]; - ALIGN(16) ALfloat ClickRemoval[MaxChannels]; - ALIGN(16) ALfloat PendingClicks[MaxChannels]; - /* Running count of the mixer invocations, in 31.1 fixed point. This * actually increments *twice* when mixing, first at the start and then at * the end, so the bottom bit indicates if the device is currently mixing diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 6202c28a..3850875d 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -54,8 +54,6 @@ typedef struct HrtfParams { typedef struct DirectParams { ALfloat (*OutBuffer)[BUFFERSIZE]; - ALfloat *ClickRemoval; - ALfloat *PendingClicks; union { struct { @@ -100,8 +98,7 @@ typedef void (*ResamplerFunc)(const ALfloat *src, ALuint frac, ALuint increment, typedef ALvoid (*DryMixerFunc)(struct DirectParams *params, const ALfloat *restrict data, ALuint srcchan, - ALuint OutPos, ALuint SamplesToDo, - ALuint BufferSize); + ALuint OutPos, ALuint BufferSize); typedef ALvoid (*WetMixerFunc)(struct SendParams *params, const ALfloat *restrict data, ALuint OutPos, ALuint SamplesToDo, |