Remove the click removal buffers for auxiliary effect slots

This commit is contained in:
Chris Robinson 2014-03-23 16:28:55 -07:00
parent a25260ea8a
commit 72986882f5
9 changed files with 8 additions and 55 deletions

View File

@ -315,17 +315,9 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALCcontext *ALContext)
if(!Slot && i == 0) if(!Slot && i == 0)
Slot = Device->DefaultSlot; Slot = Device->DefaultSlot;
if(!Slot || Slot->EffectType == AL_EFFECT_NULL) if(!Slot || Slot->EffectType == AL_EFFECT_NULL)
{
src->Send[i].OutBuffer = NULL; src->Send[i].OutBuffer = NULL;
src->Send[i].ClickRemoval = NULL;
src->Send[i].PendingClicks = NULL;
}
else else
{
src->Send[i].OutBuffer = Slot->WetBuffer; src->Send[i].OutBuffer = Slot->WetBuffer;
src->Send[i].ClickRemoval = Slot->ClickRemoval;
src->Send[i].PendingClicks = Slot->PendingClicks;
}
} }
/* Calculate the stepping value */ /* Calculate the stepping value */
@ -716,17 +708,9 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext)
} }
if(!Slot || Slot->EffectType == AL_EFFECT_NULL) if(!Slot || Slot->EffectType == AL_EFFECT_NULL)
{
src->Send[i].OutBuffer = NULL; src->Send[i].OutBuffer = NULL;
src->Send[i].ClickRemoval = NULL;
src->Send[i].PendingClicks = NULL;
}
else else
{
src->Send[i].OutBuffer = Slot->WetBuffer; src->Send[i].OutBuffer = Slot->WetBuffer;
src->Send[i].ClickRemoval = Slot->ClickRemoval;
src->Send[i].PendingClicks = Slot->PendingClicks;
}
} }
/* Transform source to listener space (convert to head relative) */ /* Transform source to listener space (convert to head relative) */
@ -1231,17 +1215,6 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
slot_end = VECTOR_ITER_END(ctx->ActiveAuxSlots); slot_end = VECTOR_ITER_END(ctx->ActiveAuxSlots);
while(slot != slot_end) while(slot != slot_end)
{ {
ALfloat offset = (*slot)->ClickRemoval[0];
if(offset < (1.0f/32768.0f))
offset = 0.0f;
else for(i = 0;i < SamplesToDo;i++)
{
(*slot)->WetBuffer[0][i] += offset;
offset -= offset * (1.0f/256.0f);
}
(*slot)->ClickRemoval[0] = offset + (*slot)->PendingClicks[0];
(*slot)->PendingClicks[0] = 0.0f;
if(!DeferUpdates && ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE)) if(!DeferUpdates && ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE))
V((*slot)->EffectState,update)(device, *slot); V((*slot)->EffectState,update)(device, *slot);
@ -1260,17 +1233,6 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
slot = &device->DefaultSlot; slot = &device->DefaultSlot;
if(*slot != NULL) if(*slot != NULL)
{ {
ALfloat offset = (*slot)->ClickRemoval[0];
if(offset < (1.0f/32768.0f))
offset = 0.0f;
else for(i = 0;i < SamplesToDo;i++)
{
(*slot)->WetBuffer[0][i] += offset;
offset -= offset * (1.0f/256.0f);
}
(*slot)->ClickRemoval[0] = offset + (*slot)->PendingClicks[0];
(*slot)->PendingClicks[0] = 0.0f;
if(ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE)) if(ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE))
V((*slot)->EffectState,update)(device, *slot); V((*slot)->EffectState,update)(device, *slot);

View File

@ -342,8 +342,7 @@ ALvoid MixSource(ALactivesource *src, ALCdevice *Device, ALuint SamplesToDo)
DoFilter(&sendparms->LpFilter[chan], SrcData, ResampledData, DoFilter(&sendparms->LpFilter[chan], SrcData, ResampledData,
DstBufferSize); DstBufferSize);
src->WetMix(sendparms, SrcData, OutPos, src->WetMix(sendparms, SrcData, OutPos, DstBufferSize);
SamplesToDo, DstBufferSize);
} }
} }
/* Update positions */ /* Update positions */

View File

@ -115,7 +115,7 @@ void MixDirect_C(DirectParams *params, const ALfloat *restrict data, ALuint srcc
void MixSend_C(SendParams *params, const ALfloat *restrict data, void MixSend_C(SendParams *params, const ALfloat *restrict data,
ALuint OutPos, ALuint UNUSED(SamplesToDo), ALuint BufferSize) ALuint OutPos, ALuint BufferSize)
{ {
ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer; ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer;
ALuint Counter = maxu(params->Counter, OutPos) - OutPos; ALuint Counter = maxu(params->Counter, OutPos) - OutPos;

View File

@ -18,16 +18,16 @@ void Resample_cubic32_C(const ALfloat *src, ALuint frac, ALuint increment, ALflo
/* C mixers */ /* C mixers */
void MixDirect_Hrtf_C(struct DirectParams*,const ALfloat*restrict,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 MixDirect_C(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint);
void MixSend_C(struct SendParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); void MixSend_C(struct SendParams*,const ALfloat*restrict,ALuint,ALuint);
/* SSE mixers */ /* SSE mixers */
void MixDirect_Hrtf_SSE(struct DirectParams*,const ALfloat*restrict,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 MixDirect_SSE(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint);
void MixSend_SSE(struct SendParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); void MixSend_SSE(struct SendParams*,const ALfloat*restrict,ALuint,ALuint);
/* Neon mixers */ /* Neon mixers */
void MixDirect_Hrtf_Neon(struct DirectParams*,const ALfloat*restrict,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 MixDirect_Neon(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint);
void MixSend_Neon(struct SendParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); void MixSend_Neon(struct SendParams*,const ALfloat*restrict,ALuint,ALuint);
#endif /* MIXER_DEFS_H */ #endif /* MIXER_DEFS_H */

View File

@ -133,7 +133,7 @@ void MixDirect_Neon(DirectParams *params, const ALfloat *restrict data, ALuint s
void MixSend_Neon(SendParams *params, const ALfloat *restrict data, void MixSend_Neon(SendParams *params, const ALfloat *restrict data,
ALuint OutPos, ALuint UNUSED(SamplesToDo), ALuint BufferSize) ALuint OutPos, ALuint BufferSize)
{ {
ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer; ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer;
ALuint Counter = maxu(params->Counter, OutPos) - OutPos; ALuint Counter = maxu(params->Counter, OutPos) - OutPos;

View File

@ -204,7 +204,7 @@ void MixDirect_SSE(DirectParams *params, const ALfloat *restrict data, ALuint sr
void MixSend_SSE(SendParams *params, const ALfloat *restrict data, void MixSend_SSE(SendParams *params, const ALfloat *restrict data,
ALuint OutPos, ALuint UNUSED(SamplesToDo), ALuint BufferSize) ALuint OutPos, ALuint BufferSize)
{ {
ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer; ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer;
ALuint Counter = maxu(params->Counter, OutPos) - OutPos; ALuint Counter = maxu(params->Counter, OutPos) - OutPos;

View File

@ -74,9 +74,6 @@ typedef struct ALeffectslot {
ALIGN(16) ALfloat WetBuffer[1][BUFFERSIZE]; ALIGN(16) ALfloat WetBuffer[1][BUFFERSIZE];
ALfloat ClickRemoval[1];
ALfloat PendingClicks[1];
RefCount ref; RefCount ref;
/* Self ID */ /* Self ID */

View File

@ -82,8 +82,6 @@ typedef struct DirectParams {
typedef struct SendParams { typedef struct SendParams {
ALfloat (*OutBuffer)[BUFFERSIZE]; ALfloat (*OutBuffer)[BUFFERSIZE];
ALfloat *ClickRemoval;
ALfloat *PendingClicks;
/* Gain control, which applies to all input channels to a single (mono) /* Gain control, which applies to all input channels to a single (mono)
* output buffer. */ * output buffer. */
@ -108,8 +106,7 @@ typedef ALvoid (*DryMixerFunc)(struct DirectParams *params,
ALuint OutPos, ALuint BufferSize); ALuint OutPos, ALuint BufferSize);
typedef ALvoid (*WetMixerFunc)(struct SendParams *params, typedef ALvoid (*WetMixerFunc)(struct SendParams *params,
const ALfloat *restrict data, const ALfloat *restrict data,
ALuint OutPos, ALuint SamplesToDo, ALuint OutPos, ALuint BufferSize);
ALuint BufferSize);
#define GAIN_SILENCE_THRESHOLD (0.00001f) #define GAIN_SILENCE_THRESHOLD (0.00001f)

View File

@ -531,8 +531,6 @@ ALenum InitEffectSlot(ALeffectslot *slot)
{ {
for(i = 0;i < BUFFERSIZE;i++) for(i = 0;i < BUFFERSIZE;i++)
slot->WetBuffer[c][i] = 0.0f; slot->WetBuffer[c][i] = 0.0f;
slot->ClickRemoval[c] = 0.0f;
slot->PendingClicks[c] = 0.0f;
} }
slot->ref = 0; slot->ref = 0;