summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-10-06 10:11:01 -0700
committerChris Robinson <[email protected]>2013-10-06 10:11:01 -0700
commit6425480d40e2a1b150c208db0421eabb51fe0624 (patch)
tree51e7c60d51b3a34f96f46237c6925017173cd32d
parent8448b94c0bf3f0ddbd040b25a68ff0ca2dcc37bd (diff)
Don't store the effect slot in SendParams
This makes it much more like DirectParams.
-rw-r--r--Alc/ALu.c29
-rw-r--r--Alc/mixer.c2
-rw-r--r--Alc/mixer_c.c20
-rw-r--r--Alc/mixer_sse.c31
-rw-r--r--OpenAL32/Include/alSource.h4
5 files changed, 53 insertions, 33 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 8274f265..34fd9d22 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -437,12 +437,20 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
for(i = 0;i < NumSends;i++)
{
ALeffectslot *Slot = ALSource->Send[i].Slot;
-
if(!Slot && i == 0)
Slot = Device->DefaultSlot;
- if(Slot && Slot->EffectType == AL_EFFECT_NULL)
- Slot = NULL;
- ALSource->Params.Send[i].Slot = Slot;
+ if(!Slot || Slot->EffectType == AL_EFFECT_NULL)
+ {
+ ALSource->Params.Send[i].OutBuffer = NULL;
+ ALSource->Params.Send[i].ClickRemoval = NULL;
+ ALSource->Params.Send[i].PendingClicks = NULL;
+ }
+ else
+ {
+ ALSource->Params.Send[i].OutBuffer = Slot->WetBuffer;
+ ALSource->Params.Send[i].ClickRemoval = Slot->ClickRemoval;
+ ALSource->Params.Send[i].PendingClicks = Slot->PendingClicks;
+ }
ALSource->Params.Send[i].Gain = WetGain[i];
}
@@ -574,7 +582,18 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
RoomAirAbsorption[i] = AIRABSORBGAINHF;
}
- ALSource->Params.Send[i].Slot = Slot;
+ if(!Slot || Slot->EffectType == AL_EFFECT_NULL)
+ {
+ ALSource->Params.Send[i].OutBuffer = NULL;
+ ALSource->Params.Send[i].ClickRemoval = NULL;
+ ALSource->Params.Send[i].PendingClicks = NULL;
+ }
+ else
+ {
+ ALSource->Params.Send[i].OutBuffer = Slot->WetBuffer;
+ ALSource->Params.Send[i].ClickRemoval = Slot->ClickRemoval;
+ ALSource->Params.Send[i].PendingClicks = Slot->PendingClicks;
+ }
}
/* Transform source to listener space (convert to head relative) */
diff --git a/Alc/mixer.c b/Alc/mixer.c
index 3039f29f..5f76feaa 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -337,7 +337,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo)
for(j = 0;j < Device->NumAuxSends;j++)
{
SendParams *sendparms = &Source->Params.Send[j];
- if(!sendparms->Slot)
+ if(!sendparms->OutBuffer)
continue;
DoFilter(&sendparms->LpFilter[chan], SrcData, ResampledData,
diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c
index 045a8b1f..168aa43f 100644
--- a/Alc/mixer_c.c
+++ b/Alc/mixer_c.c
@@ -86,7 +86,7 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2],
void MixDirect_C(const DirectParams *params, const ALfloat *restrict data, ALuint srcchan,
ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize)
{
- ALfloat (*restrict DryBuffer)[BUFFERSIZE] = params->OutBuffer;
+ ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer;
ALfloat *restrict ClickRemoval = params->ClickRemoval;
ALfloat *restrict PendingClicks = params->PendingClicks;
ALfloat DrySend;
@@ -102,7 +102,7 @@ void MixDirect_C(const DirectParams *params, const ALfloat *restrict data, ALuin
if(OutPos == 0)
ClickRemoval[c] -= data[0]*DrySend;
for(pos = 0;pos < BufferSize;pos++)
- DryBuffer[c][OutPos+pos] += data[pos]*DrySend;
+ OutBuffer[c][OutPos+pos] += data[pos]*DrySend;
if(OutPos+pos == SamplesToDo)
PendingClicks[c] += data[pos]*DrySend;
}
@@ -112,20 +112,20 @@ void MixDirect_C(const DirectParams *params, const ALfloat *restrict data, ALuin
void MixSend_C(const SendParams *params, const ALfloat *restrict data,
ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize)
{
- ALeffectslot *Slot = params->Slot;
- ALfloat (*restrict WetBuffer)[BUFFERSIZE] = Slot->WetBuffer;
- ALfloat *restrict WetClickRemoval = Slot->ClickRemoval;
- ALfloat *restrict WetPendingClicks = Slot->PendingClicks;
- ALfloat WetSend = params->Gain;
+ ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer;
+ ALfloat *restrict ClickRemoval = params->ClickRemoval;
+ ALfloat *restrict PendingClicks = params->PendingClicks;
+ ALfloat WetSend;
ALuint pos;
+ WetSend = params->Gain;
if(!(WetSend > 0.00001f))
return;
if(OutPos == 0)
- WetClickRemoval[0] -= data[0] * WetSend;
+ ClickRemoval[0] -= data[0] * WetSend;
for(pos = 0;pos < BufferSize;pos++)
- WetBuffer[0][OutPos+pos] += data[pos] * WetSend;
+ OutBuffer[0][OutPos+pos] += data[pos] * WetSend;
if(OutPos+pos == SamplesToDo)
- WetPendingClicks[0] += data[pos] * WetSend;
+ PendingClicks[0] += data[pos] * WetSend;
}
diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c
index d348f9da..cd8ea299 100644
--- a/Alc/mixer_sse.c
+++ b/Alc/mixer_sse.c
@@ -143,17 +143,16 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2],
void MixDirect_SSE(const DirectParams *params, const ALfloat *restrict data, ALuint srcchan,
ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize)
{
- ALfloat (*restrict DryBuffer)[BUFFERSIZE] = params->OutBuffer;
+ ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer;
ALfloat *restrict ClickRemoval = params->ClickRemoval;
ALfloat *restrict PendingClicks = params->PendingClicks;
ALfloat DrySend;
+ __m128 gain;
ALuint pos;
ALuint c;
for(c = 0;c < MaxChannels;c++)
{
- __m128 gain;
-
DrySend = params->Gains[srcchan][c];
if(!(DrySend > 0.00001f))
continue;
@@ -165,12 +164,12 @@ void MixDirect_SSE(const DirectParams *params, const ALfloat *restrict data, ALu
for(pos = 0;BufferSize-pos > 3;pos += 4)
{
const __m128 val4 = _mm_load_ps(&data[pos]);
- __m128 dry4 = _mm_load_ps(&DryBuffer[c][OutPos+pos]);
+ __m128 dry4 = _mm_load_ps(&OutBuffer[c][OutPos+pos]);
dry4 = _mm_add_ps(dry4, _mm_mul_ps(val4, gain));
- _mm_store_ps(&DryBuffer[c][OutPos+pos], dry4);
+ _mm_store_ps(&OutBuffer[c][OutPos+pos], dry4);
}
for(;pos < BufferSize;pos++)
- DryBuffer[c][OutPos+pos] += data[pos]*DrySend;
+ OutBuffer[c][OutPos+pos] += data[pos]*DrySend;
if(OutPos+pos == SamplesToDo)
PendingClicks[c] += data[pos]*DrySend;
@@ -181,31 +180,31 @@ void MixDirect_SSE(const DirectParams *params, const ALfloat *restrict data, ALu
void MixSend_SSE(const SendParams *params, const ALfloat *restrict data,
ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize)
{
- ALeffectslot *Slot = params->Slot;
- ALfloat (*restrict WetBuffer)[BUFFERSIZE] = Slot->WetBuffer;
- ALfloat *restrict WetClickRemoval = Slot->ClickRemoval;
- ALfloat *restrict WetPendingClicks = Slot->PendingClicks;
- const ALfloat WetGain = params->Gain;
+ ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer;
+ ALfloat *restrict ClickRemoval = params->ClickRemoval;
+ ALfloat *restrict PendingClicks = params->PendingClicks;
+ ALfloat WetGain;
__m128 gain;
ALuint pos;
+ WetGain = params->Gain;
if(!(WetGain > 0.00001f))
return;
if(OutPos == 0)
- WetClickRemoval[0] -= data[0] * WetGain;
+ ClickRemoval[0] -= data[0] * WetGain;
gain = _mm_set1_ps(WetGain);
for(pos = 0;BufferSize-pos > 3;pos += 4)
{
const __m128 val4 = _mm_load_ps(&data[pos]);
- __m128 wet4 = _mm_load_ps(&WetBuffer[0][OutPos+pos]);
+ __m128 wet4 = _mm_load_ps(&OutBuffer[0][OutPos+pos]);
wet4 = _mm_add_ps(wet4, _mm_mul_ps(val4, gain));
- _mm_store_ps(&WetBuffer[0][OutPos+pos], wet4);
+ _mm_store_ps(&OutBuffer[0][OutPos+pos], wet4);
}
for(;pos < BufferSize;pos++)
- WetBuffer[0][OutPos+pos] += data[pos] * WetGain;
+ OutBuffer[0][OutPos+pos] += data[pos] * WetGain;
if(OutPos+pos == SamplesToDo)
- WetPendingClicks[0] += data[pos] * WetGain;
+ PendingClicks[0] += data[pos] * WetGain;
}
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index 03da250f..632c8fc1 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -66,7 +66,9 @@ typedef struct DirectParams {
} DirectParams;
typedef struct SendParams {
- struct ALeffectslot *Slot;
+ ALfloat (*OutBuffer)[BUFFERSIZE];
+ ALfloat *ClickRemoval;
+ ALfloat *PendingClicks;
/* Gain control, which applies to all input channels to a single (mono)
* output buffer. */