aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-05-29 22:31:36 -0700
committerChris Robinson <[email protected]>2019-05-29 22:31:36 -0700
commit2909f263fd1a2e7122b0345c6d11209084815fd1 (patch)
tree43fc5530d46f50edd7e5ca95f9c2d3dd4c95d3fc
parent893ffe9a84d497d38e6e472b0cffbd9c37e0c366 (diff)
Use span<FloatBufferLine> for EffectState::process output
-rw-r--r--Alc/alu.cpp3
-rw-r--r--Alc/effects/autowah.cpp9
-rw-r--r--Alc/effects/base.h3
-rw-r--r--Alc/effects/chorus.cpp7
-rw-r--r--Alc/effects/compressor.cpp29
-rw-r--r--Alc/effects/dedicated.cpp8
-rw-r--r--Alc/effects/distortion.cpp35
-rw-r--r--Alc/effects/echo.cpp7
-rw-r--r--Alc/effects/equalizer.cpp7
-rw-r--r--Alc/effects/fshifter.cpp8
-rw-r--r--Alc/effects/modulator.cpp7
-rw-r--r--Alc/effects/null.cpp4
-rw-r--r--Alc/effects/pshifter.cpp8
-rw-r--r--Alc/effects/reverb.cpp6
14 files changed, 66 insertions, 75 deletions
diff --git a/Alc/alu.cpp b/Alc/alu.cpp
index ed89f903..2f172b99 100644
--- a/Alc/alu.cpp
+++ b/Alc/alu.cpp
@@ -1466,8 +1466,9 @@ void ProcessContext(ALCcontext *ctx, const ALsizei SamplesToDo)
[SamplesToDo](const ALeffectslot *slot) -> void
{
EffectState *state{slot->Params.mEffectState};
+ const auto outchans = static_cast<size_t>(state->mOutChannels);
state->process(SamplesToDo, slot->Wet.Buffer, slot->Wet.NumChannels,
- state->mOutBuffer, state->mOutChannels);
+ {state->mOutBuffer, outchans});
}
);
}
diff --git a/Alc/effects/autowah.cpp b/Alc/effects/autowah.cpp
index 2b0cb610..90531229 100644
--- a/Alc/effects/autowah.cpp
+++ b/Alc/effects/autowah.cpp
@@ -72,7 +72,7 @@ struct ALautowahState final : public EffectState {
ALboolean deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
- void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override;
+ void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(ALautowahState)
};
@@ -128,7 +128,7 @@ void ALautowahState::update(const ALCcontext *context, const ALeffectslot *slot,
}
}
-void ALautowahState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput)
+void ALautowahState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut)
{
const ALfloat attack_rate = mAttackRate;
const ALfloat release_rate = mReleaseRate;
@@ -156,7 +156,6 @@ void ALautowahState::process(const ALsizei samplesToDo, const FloatBufferLine *R
}
mEnvDelay = env_delay;
- const al::span<FloatBufferLine> output{samplesOut, samplesOut+numOutput};
ASSUME(numInput > 0);
for(ALsizei c{0};c < numInput;++c)
{
@@ -193,8 +192,8 @@ void ALautowahState::process(const ALsizei samplesToDo, const FloatBufferLine *R
mChans[c].Filter.z2 = z2;
/* Now, mix the processed sound data to the output. */
- MixSamples(mBufferOut, output, mChans[c].CurrentGains, mChans[c].TargetGains, samplesToDo,
- 0, samplesToDo);
+ MixSamples(mBufferOut, samplesOut, mChans[c].CurrentGains, mChans[c].TargetGains,
+ samplesToDo, 0, samplesToDo);
}
}
diff --git a/Alc/effects/base.h b/Alc/effects/base.h
index c7c6f1c0..d2b33b9b 100644
--- a/Alc/effects/base.h
+++ b/Alc/effects/base.h
@@ -4,6 +4,7 @@
#include "alMain.h"
#include "almalloc.h"
+#include "alspan.h"
#include "atomic.h"
@@ -151,7 +152,7 @@ struct EffectState {
virtual ALboolean deviceUpdate(const ALCdevice *device) = 0;
virtual void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) = 0;
- virtual void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) = 0;
+ virtual void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut) = 0;
void IncRef() noexcept;
void DecRef() noexcept;
diff --git a/Alc/effects/chorus.cpp b/Alc/effects/chorus.cpp
index cdbb2036..9226c747 100644
--- a/Alc/effects/chorus.cpp
+++ b/Alc/effects/chorus.cpp
@@ -101,7 +101,7 @@ struct ChorusState final : public EffectState {
ALboolean deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
- void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override;
+ void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(ChorusState)
};
@@ -198,7 +198,7 @@ void ChorusState::update(const ALCcontext *Context, const ALeffectslot *Slot, co
}
}
-void ChorusState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput)
+void ChorusState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, const al::span<FloatBufferLine> samplesOut)
{
const auto bufmask = static_cast<ALsizei>(mSampleBuffer.size()-1);
const ALfloat feedback{mFeedback};
@@ -206,7 +206,6 @@ void ChorusState::process(const ALsizei samplesToDo, const FloatBufferLine *REST
ALfloat *RESTRICT delaybuf{mSampleBuffer.data()};
ALsizei offset{mOffset};
- const al::span<FloatBufferLine> output{samplesOut, samplesOut+numOutput};
for(ALsizei base{0};base < samplesToDo;)
{
const ALsizei todo = mini(256, samplesToDo-base);
@@ -254,7 +253,7 @@ void ChorusState::process(const ALsizei samplesToDo, const FloatBufferLine *REST
}
for(ALsizei c{0};c < 2;c++)
- MixSamples(temps[c], output, mGains[c].Current, mGains[c].Target, samplesToDo-base,
+ MixSamples(temps[c], samplesOut, mGains[c].Current, mGains[c].Target, samplesToDo-base,
base, todo);
base += todo;
diff --git a/Alc/effects/compressor.cpp b/Alc/effects/compressor.cpp
index a3435d61..5c0d0121 100644
--- a/Alc/effects/compressor.cpp
+++ b/Alc/effects/compressor.cpp
@@ -52,7 +52,7 @@ struct CompressorState final : public EffectState {
ALboolean deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
- void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override;
+ void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(CompressorState)
};
@@ -87,21 +87,18 @@ void CompressorState::update(const ALCcontext* UNUSED(context), const ALeffectsl
}
}
-void CompressorState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput)
+void CompressorState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut)
{
- ALsizei i, j, k;
- ALsizei base;
-
- for(base = 0;base < samplesToDo;)
+ for(ALsizei base{0};base < samplesToDo;)
{
ALfloat gains[256];
- ALsizei td = mini(256, samplesToDo-base);
- ALfloat env = mEnvFollower;
+ const ALsizei td{mini(256, samplesToDo-base)};
/* Generate the per-sample gains from the signal envelope. */
+ ALfloat env{mEnvFollower};
if(mEnabled)
{
- for(i = 0;i < td;++i)
+ for(ALsizei i{0};i < td;++i)
{
/* Clamp the absolute amplitude to the defined envelope limits,
* then attack or release the envelope to reach it.
@@ -125,7 +122,7 @@ void CompressorState::process(const ALsizei samplesToDo, const FloatBufferLine *
* ensure smooth gain changes when the compressor is turned on and
* off.
*/
- for(i = 0;i < td;++i)
+ for(ALsizei i{0};i < td;++i)
{
const ALfloat amplitude{1.0f};
if(amplitude > env)
@@ -140,17 +137,17 @@ void CompressorState::process(const ALsizei samplesToDo, const FloatBufferLine *
/* Now compress the signal amplitude to output. */
ASSUME(numInput > 0);
- for(j = 0;j < numInput;j++)
+ for(ALsizei j{0};j < numInput;j++)
{
- ASSUME(numOutput > 0);
- for(k = 0;k < numOutput;k++)
+ const ALfloat *outgains{mGain[j]};
+ for(FloatBufferLine &output : samplesOut)
{
- const ALfloat gain{mGain[j][k]};
+ const ALfloat gain{*(outgains++)};
if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD))
continue;
- for(i = 0;i < td;i++)
- samplesOut[k][base+i] += samplesIn[j][base+i] * gains[i] * gain;
+ for(ALsizei i{0};i < td;i++)
+ output[base+i] += samplesIn[j][base+i] * gains[i] * gain;
}
}
diff --git a/Alc/effects/dedicated.cpp b/Alc/effects/dedicated.cpp
index b4eaa8e8..06d187fc 100644
--- a/Alc/effects/dedicated.cpp
+++ b/Alc/effects/dedicated.cpp
@@ -40,7 +40,7 @@ struct DedicatedState final : public EffectState {
ALboolean deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
- void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override;
+ void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(DedicatedState)
};
@@ -90,10 +90,10 @@ void DedicatedState::update(const ALCcontext* UNUSED(context), const ALeffectslo
}
}
-void DedicatedState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput)
+void DedicatedState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, const al::span<FloatBufferLine> samplesOut)
{
- MixSamples(samplesIn[0].data(), {samplesOut, samplesOut+numOutput}, mCurrentGains,
- mTargetGains, samplesToDo, 0, samplesToDo);
+ MixSamples(samplesIn[0].data(), samplesOut, mCurrentGains, mTargetGains, samplesToDo, 0,
+ samplesToDo);
}
diff --git a/Alc/effects/distortion.cpp b/Alc/effects/distortion.cpp
index ffe2a102..4830ad1c 100644
--- a/Alc/effects/distortion.cpp
+++ b/Alc/effects/distortion.cpp
@@ -50,7 +50,7 @@ struct DistortionState final : public EffectState {
ALboolean deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
- void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override;
+ void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(DistortionState)
};
@@ -95,14 +95,10 @@ void DistortionState::update(const ALCcontext *context, const ALeffectslot *slot
ComputePanGains(target.Main, coeffs, slot->Params.Gain*props->Distortion.Gain, mGain);
}
-void DistortionState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput)
+void DistortionState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, const al::span<FloatBufferLine> samplesOut)
{
- ALfloat (*RESTRICT buffer)[BUFFERSIZE] = mBuffer;
- const ALfloat fc = mEdgeCoeff;
- ALsizei base;
- ALsizei i, k;
-
- for(base = 0;base < samplesToDo;)
+ const ALfloat fc{mEdgeCoeff};
+ for(ALsizei base{0};base < samplesToDo;)
{
/* Perform 4x oversampling to avoid aliasing. Oversampling greatly
* improves distortion quality and allows to implement lowpass and
@@ -114,47 +110,48 @@ void DistortionState::process(const ALsizei samplesToDo, const FloatBufferLine *
/* Fill oversample buffer using zero stuffing. Multiply the sample by
* the amount of oversampling to maintain the signal's power.
*/
- for(i = 0;i < todo;i++)
- buffer[0][i] = !(i&3) ? samplesIn[0][(i>>2)+base] * 4.0f : 0.0f;
+ for(ALsizei i{0};i < todo;i++)
+ mBuffer[0][i] = !(i&3) ? samplesIn[0][(i>>2)+base] * 4.0f : 0.0f;
/* First step, do lowpass filtering of original signal. Additionally
* perform buffer interpolation and lowpass cutoff for oversampling
* (which is fortunately first step of distortion). So combine three
* operations into the one.
*/
- mLowpass.process(buffer[1], buffer[0], todo);
+ mLowpass.process(mBuffer[1], mBuffer[0], todo);
/* Second step, do distortion using waveshaper function to emulate
* signal processing during tube overdriving. Three steps of
* waveshaping are intended to modify waveform without boost/clipping/
* attenuation process.
*/
- for(i = 0;i < todo;i++)
+ for(ALsizei i{0};i < todo;i++)
{
- ALfloat smp = buffer[1][i];
+ ALfloat smp{mBuffer[1][i]};
smp = (1.0f + fc) * smp/(1.0f + fc*fabsf(smp));
smp = (1.0f + fc) * smp/(1.0f + fc*fabsf(smp)) * -1.0f;
smp = (1.0f + fc) * smp/(1.0f + fc*fabsf(smp));
- buffer[0][i] = smp;
+ mBuffer[0][i] = smp;
}
/* Third step, do bandpass filtering of distorted signal. */
- mBandpass.process(buffer[1], buffer[0], todo);
+ mBandpass.process(mBuffer[1], mBuffer[0], todo);
todo >>= 2;
- for(k = 0;k < numOutput;k++)
+ const ALfloat *outgains{mGain};
+ for(FloatBufferLine &output : samplesOut)
{
/* Fourth step, final, do attenuation and perform decimation,
* storing only one sample out of four.
*/
- const ALfloat gain{mGain[k]};
+ const ALfloat gain{*(outgains++)};
if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD))
continue;
- for(i = 0;i < todo;i++)
- samplesOut[k][base+i] += gain * buffer[1][i*4];
+ for(ALsizei i{0};i < todo;i++)
+ output[base+i] += gain * mBuffer[1][i*4];
}
base += todo;
diff --git a/Alc/effects/echo.cpp b/Alc/effects/echo.cpp
index e82e75bd..dadb41bb 100644
--- a/Alc/effects/echo.cpp
+++ b/Alc/effects/echo.cpp
@@ -60,7 +60,7 @@ struct EchoState final : public EffectState {
ALboolean deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
- void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override;
+ void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(EchoState)
};
@@ -119,7 +119,7 @@ void EchoState::update(const ALCcontext *context, const ALeffectslot *slot, cons
ComputePanGains(target.Main, coeffs[1], slot->Params.Gain, mGains[1].Target);
}
-void EchoState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput)
+void EchoState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, const al::span<FloatBufferLine> samplesOut)
{
const auto mask = static_cast<ALsizei>(mSampleBuffer.size()-1);
ALfloat *RESTRICT delaybuf{mSampleBuffer.data()};
@@ -157,9 +157,8 @@ void EchoState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRI
mFilter.setComponents(z1, z2);
mOffset = offset;
- const al::span<FloatBufferLine> output{samplesOut, samplesOut+numOutput};
for(ALsizei c{0};c < 2;c++)
- MixSamples(mTempBuffer[c], output, mGains[c].Current, mGains[c].Target, samplesToDo, 0,
+ MixSamples(mTempBuffer[c], samplesOut, mGains[c].Current, mGains[c].Target, samplesToDo, 0,
samplesToDo);
}
diff --git a/Alc/effects/equalizer.cpp b/Alc/effects/equalizer.cpp
index f6be258b..d37f15ea 100644
--- a/Alc/effects/equalizer.cpp
+++ b/Alc/effects/equalizer.cpp
@@ -94,7 +94,7 @@ struct EqualizerState final : public EffectState {
ALboolean deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
- void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override;
+ void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(EqualizerState)
};
@@ -158,9 +158,8 @@ void EqualizerState::update(const ALCcontext *context, const ALeffectslot *slot,
}
}
-void EqualizerState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput)
+void EqualizerState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut)
{
- const al::span<FloatBufferLine> output{samplesOut, samplesOut+numOutput};
ASSUME(numInput > 0);
for(ALsizei c{0};c < numInput;c++)
{
@@ -169,7 +168,7 @@ void EqualizerState::process(const ALsizei samplesToDo, const FloatBufferLine *R
mChans[c].filter[2].process(mSampleBuffer, mSampleBuffer, samplesToDo);
mChans[c].filter[3].process(mSampleBuffer, mSampleBuffer, samplesToDo);
- MixSamples(mSampleBuffer, output, mChans[c].CurrentGains, mChans[c].TargetGains,
+ MixSamples(mSampleBuffer, samplesOut, mChans[c].CurrentGains, mChans[c].TargetGains,
samplesToDo, 0, samplesToDo);
}
}
diff --git a/Alc/effects/fshifter.cpp b/Alc/effects/fshifter.cpp
index 56068b06..d50a7733 100644
--- a/Alc/effects/fshifter.cpp
+++ b/Alc/effects/fshifter.cpp
@@ -83,7 +83,7 @@ struct FshifterState final : public EffectState {
ALboolean deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
- void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override;
+ void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(FshifterState)
};
@@ -138,7 +138,7 @@ void FshifterState::update(const ALCcontext *context, const ALeffectslot *slot,
ComputePanGains(target.Main, coeffs, slot->Params.Gain, mTargetGains);
}
-void FshifterState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput)
+void FshifterState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, const al::span<FloatBufferLine> samplesOut)
{
static constexpr complex_d complex_zero{0.0, 0.0};
ALfloat *RESTRICT BufferOut = mBufferOut;
@@ -198,8 +198,8 @@ void FshifterState::process(const ALsizei samplesToDo, const FloatBufferLine *RE
}
/* Now, mix the processed sound data to the output. */
- MixSamples(BufferOut, {samplesOut, samplesOut+numOutput}, mCurrentGains, mTargetGains,
- maxi(samplesToDo, 512), 0, samplesToDo);
+ MixSamples(BufferOut, samplesOut, mCurrentGains, mTargetGains, maxi(samplesToDo, 512), 0,
+ samplesToDo);
}
diff --git a/Alc/effects/modulator.cpp b/Alc/effects/modulator.cpp
index 9b7abbb7..60728d2e 100644
--- a/Alc/effects/modulator.cpp
+++ b/Alc/effects/modulator.cpp
@@ -93,7 +93,7 @@ struct ModulatorState final : public EffectState {
ALboolean deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
- void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override;
+ void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(ModulatorState)
};
@@ -141,11 +141,10 @@ void ModulatorState::update(const ALCcontext *context, const ALeffectslot *slot,
}
}
-void ModulatorState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput)
+void ModulatorState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut)
{
const ALsizei step{mStep};
- const al::span<FloatBufferLine> output{samplesOut, samplesOut+numOutput};
for(ALsizei base{0};base < samplesToDo;)
{
alignas(16) ALfloat modsamples[MAX_UPDATE_SAMPLES];
@@ -165,7 +164,7 @@ void ModulatorState::process(const ALsizei samplesToDo, const FloatBufferLine *R
for(i = 0;i < td;i++)
temps[i] *= modsamples[i];
- MixSamples(temps, output, mChans[c].CurrentGains, mChans[c].TargetGains,
+ MixSamples(temps, samplesOut, mChans[c].CurrentGains, mChans[c].TargetGains,
samplesToDo-base, base, td);
}
diff --git a/Alc/effects/null.cpp b/Alc/effects/null.cpp
index 96c0e928..6076a2d9 100644
--- a/Alc/effects/null.cpp
+++ b/Alc/effects/null.cpp
@@ -19,7 +19,7 @@ struct NullState final : public EffectState {
ALboolean deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
- void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override;
+ void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(NullState)
};
@@ -55,7 +55,7 @@ void NullState::update(const ALCcontext* UNUSED(context), const ALeffectslot* UN
* input to the output buffer. The result should be added to the output buffer,
* not replace it.
*/
-void NullState::process(const ALsizei /*samplesToDo*/, const FloatBufferLine *RESTRICT /*samplesIn*/, const ALsizei /*numInput*/, FloatBufferLine *RESTRICT /*samplesOut*/, const ALsizei /*numOutput*/)
+void NullState::process(const ALsizei /*samplesToDo*/, const FloatBufferLine *RESTRICT /*samplesIn*/, const ALsizei /*numInput*/, const al::span<FloatBufferLine> /*samplesOut*/)
{
}
diff --git a/Alc/effects/pshifter.cpp b/Alc/effects/pshifter.cpp
index 34f442bc..184c9a40 100644
--- a/Alc/effects/pshifter.cpp
+++ b/Alc/effects/pshifter.cpp
@@ -153,7 +153,7 @@ struct PshifterState final : public EffectState {
ALboolean deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
- void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override;
+ void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(PshifterState)
};
@@ -197,7 +197,7 @@ void PshifterState::update(const ALCcontext* UNUSED(context), const ALeffectslot
ComputePanGains(target.Main, coeffs, slot->Params.Gain, mTargetGains);
}
-void PshifterState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput)
+void PshifterState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, const al::span<FloatBufferLine> samplesOut)
{
/* Pitch shifter engine based on the work of Stephan Bernsee.
* http://blogs.zynaptiq.com/bernsee/pitch-shifting-using-the-ft/
@@ -321,8 +321,8 @@ void PshifterState::process(const ALsizei samplesToDo, const FloatBufferLine *RE
mCount = count;
/* Now, mix the processed sound data to the output. */
- MixSamples(bufferOut, {samplesOut, samplesOut+numOutput}, mCurrentGains, mTargetGains,
- maxi(samplesToDo, 512), 0, samplesToDo);
+ MixSamples(bufferOut, samplesOut, mCurrentGains, mTargetGains, maxi(samplesToDo, 512), 0,
+ samplesToDo);
}
diff --git a/Alc/effects/reverb.cpp b/Alc/effects/reverb.cpp
index 5d2f25f9..d3a60b5e 100644
--- a/Alc/effects/reverb.cpp
+++ b/Alc/effects/reverb.cpp
@@ -446,7 +446,7 @@ struct ReverbState final : public EffectState {
ALboolean deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
- void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override;
+ void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(ReverbState)
};
@@ -1442,7 +1442,7 @@ void LateReverb_Faded(ReverbState *State, const ALsizei offset, const ALsizei to
VectorScatterRevDelayIn(late_delay, offset, mixX, mixY, base, out, todo);
}
-void ReverbState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput)
+void ReverbState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut)
{
ALsizei fadeCount{mFadeCount};
@@ -1526,7 +1526,7 @@ void ReverbState::process(const ALsizei samplesToDo, const FloatBufferLine *REST
mFadeCount = fadeCount;
/* Finally, mix early reflections and late reverb. */
- (this->*mMixOut)({samplesOut, samplesOut+numOutput}, samplesToDo);
+ (this->*mMixOut)(samplesOut, samplesToDo);
}