aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-01-27 08:16:47 -0800
committerChris Robinson <[email protected]>2016-01-27 08:16:47 -0800
commit2fa3ae85c9a4050eab3a4f140fb6accd0a02ce85 (patch)
tree1aeb9e34ba5a5081de853f84a9d03159ef48fd00
parentfd387beda183c2c443ec45f7193f81cf82ede164 (diff)
Pass a pointer to the input samples array for effect processing
-rw-r--r--Alc/ALu.c24
-rw-r--r--Alc/effects/autowah.c4
-rw-r--r--Alc/effects/chorus.c6
-rw-r--r--Alc/effects/compressor.c6
-rw-r--r--Alc/effects/dedicated.c4
-rw-r--r--Alc/effects/distortion.c4
-rw-r--r--Alc/effects/echo.c4
-rw-r--r--Alc/effects/equalizer.c4
-rw-r--r--Alc/effects/flanger.c6
-rw-r--r--Alc/effects/modulator.c8
-rw-r--r--Alc/effects/null.c2
-rw-r--r--Alc/effects/reverb.c6
-rw-r--r--OpenAL32/Include/alAuxEffectSlot.h4
13 files changed, 44 insertions, 38 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 6a500833..2f1cdd85 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1473,19 +1473,25 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
}
/* effect slot processing */
-#define PROCESS_SLOT(iter) V((*iter)->EffectState,process)( \
- SamplesToDo, (*iter)->WetBuffer[0], device->DryBuffer, device->NumChannels \
-);
- VECTOR_FOR_EACH(ALeffectslot*, ctx->ActiveAuxSlots, PROCESS_SLOT);
-#undef PROCESS_SLOT
+ c = VECTOR_SIZE(ctx->ActiveAuxSlots);
+ for(i = 0;i < c;i++)
+ {
+ const ALeffectslot *slot = VECTOR_ELEM(ctx->ActiveAuxSlots, i);
+ ALeffectState *state = slot->EffectState;
+ V(state,process)(SamplesToDo, slot->WetBuffer, device->DryBuffer,
+ device->NumChannels);
+ }
ctx = ctx->next;
}
- if((slot=device->DefaultSlot) != NULL)
- V(slot->EffectState,process)(
- SamplesToDo, slot->WetBuffer[0], device->DryBuffer, device->NumChannels
- );
+ if(device->DefaultSlot != NULL)
+ {
+ const ALeffectslot *slot = device->DefaultSlot;
+ ALeffectState *state = slot->EffectState;
+ V(state,process)(SamplesToDo, slot->WetBuffer, device->DryBuffer,
+ device->NumChannels);
+ }
/* Increment the clock time. Every second's worth of samples is
* converted and added to clock base so that large sample counts don't
diff --git a/Alc/effects/autowah.c b/Alc/effects/autowah.c
index 2da75c56..09aecf15 100644
--- a/Alc/effects/autowah.c
+++ b/Alc/effects/autowah.c
@@ -78,7 +78,7 @@ static ALvoid ALautowahState_update(ALautowahState *state, const ALCdevice *devi
ComputeAmbientGains(device->AmbiCoeffs, device->NumChannels, slot->Gain, state->Gain);
}
-static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[BUFFERSIZE], ALuint NumChannels)
+static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
{
ALuint it, kt;
ALuint base;
@@ -91,7 +91,7 @@ static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo,
for(it = 0;it < td;it++)
{
- ALfloat smp = SamplesIn[it+base];
+ ALfloat smp = SamplesIn[0][it+base];
ALfloat a[3], b[3];
ALfloat alpha, w0;
ALfloat amplitude;
diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c
index 1477d58b..1c9efd47 100644
--- a/Alc/effects/chorus.c
+++ b/Alc/effects/chorus.c
@@ -204,7 +204,7 @@ DECL_TEMPLATE(Sinusoid)
#undef DECL_TEMPLATE
-static ALvoid ALchorusState_process(ALchorusState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
+static ALvoid ALchorusState_process(ALchorusState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
{
ALuint it, kt;
ALuint base;
@@ -217,10 +217,10 @@ static ALvoid ALchorusState_process(ALchorusState *state, ALuint SamplesToDo, co
switch(state->waveform)
{
case CWF_Triangle:
- ProcessTriangle(state, td, SamplesIn+base, temps);
+ ProcessTriangle(state, td, SamplesIn[0]+base, temps);
break;
case CWF_Sinusoid:
- ProcessSinusoid(state, td, SamplesIn+base, temps);
+ ProcessSinusoid(state, td, SamplesIn[0]+base, temps);
break;
}
diff --git a/Alc/effects/compressor.c b/Alc/effects/compressor.c
index 52a6324d..6c3b8375 100644
--- a/Alc/effects/compressor.c
+++ b/Alc/effects/compressor.c
@@ -62,7 +62,7 @@ static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCdevice
ComputeAmbientGains(device->AmbiCoeffs, device->NumChannels, slot->Gain, state->Gain);
}
-static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[BUFFERSIZE], ALuint NumChannels)
+static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
{
ALuint it, kt;
ALuint base;
@@ -79,7 +79,7 @@ static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint Samples
for(it = 0;it < td;it++)
{
- smp = SamplesIn[it+base];
+ smp = SamplesIn[0][it+base];
amplitude = fabsf(smp);
if(amplitude > gain)
@@ -100,7 +100,7 @@ static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint Samples
for(it = 0;it < td;it++)
{
- smp = SamplesIn[it+base];
+ smp = SamplesIn[0][it+base];
amplitude = 1.0f;
if(amplitude > gain)
diff --git a/Alc/effects/dedicated.c b/Alc/effects/dedicated.c
index fdc20601..06aad17c 100644
--- a/Alc/effects/dedicated.c
+++ b/Alc/effects/dedicated.c
@@ -76,7 +76,7 @@ static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCdevice *
}
}
-static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
+static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
{
const ALfloat *gains = state->gains;
ALuint i, c;
@@ -87,7 +87,7 @@ static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALuint SamplesTo
continue;
for(i = 0;i < SamplesToDo;i++)
- SamplesOut[c][i] += SamplesIn[i] * gains[c];
+ SamplesOut[c][i] += SamplesIn[0][i] * gains[c];
}
}
diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c
index dc2e280a..697758f0 100644
--- a/Alc/effects/distortion.c
+++ b/Alc/effects/distortion.c
@@ -86,7 +86,7 @@ static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCdevice
ComputeAmbientGains(Device->AmbiCoeffs, Device->NumChannels, Slot->Gain, state->Gain);
}
-static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
+static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
{
const ALfloat fc = state->edge_coeff;
ALuint base;
@@ -108,7 +108,7 @@ static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint Samples
/* Fill oversample buffer using zero stuffing */
for(it = 0;it < td;it++)
{
- oversample_buffer[it][0] = SamplesIn[it+base];
+ oversample_buffer[it][0] = SamplesIn[0][it+base];
oversample_buffer[it][1] = 0.0f;
oversample_buffer[it][2] = 0.0f;
oversample_buffer[it][3] = 0.0f;
diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c
index e2bb6407..ebb6cf12 100644
--- a/Alc/effects/echo.c
+++ b/Alc/effects/echo.c
@@ -111,7 +111,7 @@ static ALvoid ALechoState_update(ALechoState *state, const ALCdevice *Device, co
ComputePanningGains(Device->AmbiCoeffs, Device->NumChannels, coeffs, gain, state->Gain[1]);
}
-static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
+static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
{
const ALuint mask = state->BufferLength-1;
const ALuint tap1 = state->Tap[0].delay;
@@ -135,7 +135,7 @@ static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const
// Apply damping and feedback gain to the second tap, and mix in the
// new sample
- smp = ALfilterState_processSingle(&state->Filter, temps[i][1]+SamplesIn[i+base]);
+ smp = ALfilterState_processSingle(&state->Filter, temps[i][1]+SamplesIn[0][i+base]);
state->SampleBuffer[offset&mask] = smp * state->FeedGain;
offset++;
}
diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c
index 4f7846fd..8ef52986 100644
--- a/Alc/effects/equalizer.c
+++ b/Alc/effects/equalizer.c
@@ -126,7 +126,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice *
);
}
-static ALvoid ALequalizerState_process(ALequalizerState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
+static ALvoid ALequalizerState_process(ALequalizerState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
{
ALuint base;
ALuint it;
@@ -140,7 +140,7 @@ static ALvoid ALequalizerState_process(ALequalizerState *state, ALuint SamplesTo
for(it = 0;it < td;it++)
{
- ALfloat smp = SamplesIn[base+it];
+ ALfloat smp = SamplesIn[0][base+it];
for(ft = 0;ft < 4;ft++)
smp = ALfilterState_processSingle(&state->filter[ft], smp);
diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c
index 5fcc8be8..21536f04 100644
--- a/Alc/effects/flanger.c
+++ b/Alc/effects/flanger.c
@@ -204,7 +204,7 @@ DECL_TEMPLATE(Sinusoid)
#undef DECL_TEMPLATE
-static ALvoid ALflangerState_process(ALflangerState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
+static ALvoid ALflangerState_process(ALflangerState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
{
ALuint it, kt;
ALuint base;
@@ -217,10 +217,10 @@ static ALvoid ALflangerState_process(ALflangerState *state, ALuint SamplesToDo,
switch(state->waveform)
{
case FWF_Triangle:
- ProcessTriangle(state, td, SamplesIn+base, temps);
+ ProcessTriangle(state, td, SamplesIn[0]+base, temps);
break;
case FWF_Sinusoid:
- ProcessSinusoid(state, td, SamplesIn+base, temps);
+ ProcessSinusoid(state, td, SamplesIn[0]+base, temps);
break;
}
diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c
index 9ef5d0dc..1719efeb 100644
--- a/Alc/effects/modulator.c
+++ b/Alc/effects/modulator.c
@@ -151,20 +151,20 @@ static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCdevice *
ComputeAmbientGains(Device->AmbiCoeffs, Device->NumChannels, Slot->Gain, state->Gain);
}
-static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
+static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
{
switch(state->Waveform)
{
case SINUSOID:
- ProcessSin(state, SamplesToDo, SamplesIn, SamplesOut, NumChannels);
+ ProcessSin(state, SamplesToDo, SamplesIn[0], SamplesOut, NumChannels);
break;
case SAWTOOTH:
- ProcessSaw(state, SamplesToDo, SamplesIn, SamplesOut, NumChannels);
+ ProcessSaw(state, SamplesToDo, SamplesIn[0], SamplesOut, NumChannels);
break;
case SQUARE:
- ProcessSquare(state, SamplesToDo, SamplesIn, SamplesOut, NumChannels);
+ ProcessSquare(state, SamplesToDo, SamplesIn[0], SamplesOut, NumChannels);
break;
}
}
diff --git a/Alc/effects/null.c b/Alc/effects/null.c
index d5f5bf11..0600703d 100644
--- a/Alc/effects/null.c
+++ b/Alc/effects/null.c
@@ -41,7 +41,7 @@ static ALvoid ALnullState_update(ALnullState* UNUSED(state), const ALCdevice* UN
* input to the output buffer. The result should be added to the output buffer,
* not replace it.
*/
-static ALvoid ALnullState_process(ALnullState* UNUSED(state), ALuint UNUSED(samplesToDo), const ALfloat *restrict UNUSED(samplesIn), ALfloatBUFFERSIZE*restrict UNUSED(samplesOut), ALuint UNUSED(NumChannels))
+static ALvoid ALnullState_process(ALnullState* UNUSED(state), ALuint UNUSED(samplesToDo), const ALfloatBUFFERSIZE*restrict UNUSED(samplesIn), ALfloatBUFFERSIZE*restrict UNUSED(samplesOut), ALuint UNUSED(NumChannels))
{
}
diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c
index f3de2116..b822ec19 100644
--- a/Alc/effects/reverb.c
+++ b/Alc/effects/reverb.c
@@ -627,12 +627,12 @@ static ALvoid ALreverbState_processEax(ALreverbState *State, ALuint SamplesToDo,
}
}
-static ALvoid ALreverbState_process(ALreverbState *State, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
+static ALvoid ALreverbState_process(ALreverbState *State, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
{
if(State->IsEax)
- ALreverbState_processEax(State, SamplesToDo, SamplesIn, SamplesOut, NumChannels);
+ ALreverbState_processEax(State, SamplesToDo, SamplesIn[0], SamplesOut, NumChannels);
else
- ALreverbState_processStandard(State, SamplesToDo, SamplesIn, SamplesOut, NumChannels);
+ ALreverbState_processStandard(State, SamplesToDo, SamplesIn[0], SamplesOut, NumChannels);
}
// Given the allocated sample buffer, this function updates each delay line
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h
index bc768406..bbb112be 100644
--- a/OpenAL32/Include/alAuxEffectSlot.h
+++ b/OpenAL32/Include/alAuxEffectSlot.h
@@ -22,7 +22,7 @@ struct ALeffectStateVtable {
ALboolean (*const deviceUpdate)(ALeffectState *state, ALCdevice *device);
void (*const update)(ALeffectState *state, const ALCdevice *device, const struct ALeffectslot *slot);
- void (*const process)(ALeffectState *state, ALuint samplesToDo, const ALfloat *restrict samplesIn, ALfloat (*restrict samplesOut)[BUFFERSIZE], ALuint numChannels);
+ void (*const process)(ALeffectState *state, ALuint samplesToDo, const ALfloat (*restrict samplesIn)[BUFFERSIZE], ALfloat (*restrict samplesOut)[BUFFERSIZE], ALuint numChannels);
void (*const Delete)(void *ptr);
};
@@ -31,7 +31,7 @@ struct ALeffectStateVtable {
DECLARE_THUNK(T, ALeffectState, void, Destruct) \
DECLARE_THUNK1(T, ALeffectState, ALboolean, deviceUpdate, ALCdevice*) \
DECLARE_THUNK2(T, ALeffectState, void, update, const ALCdevice*, const ALeffectslot*) \
-DECLARE_THUNK4(T, ALeffectState, void, process, ALuint, const ALfloat*restrict, ALfloatBUFFERSIZE*restrict, ALuint) \
+DECLARE_THUNK4(T, ALeffectState, void, process, ALuint, const ALfloatBUFFERSIZE*restrict, ALfloatBUFFERSIZE*restrict, ALuint) \
static void T##_ALeffectState_Delete(void *ptr) \
{ return T##_Delete(STATIC_UPCAST(T, ALeffectState, (ALeffectState*)ptr)); } \
\