aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-06-05 19:58:58 -0700
committerChris Robinson <[email protected]>2019-06-05 19:58:58 -0700
commitf9da06fc6a265e3ab2f548a9533b222e7a183637 (patch)
treed430e2bdf5d4a20f8f4a29efda8901d861417d01
parent1ce310c6d1719c6f71664385e136b5510602ac21 (diff)
Use a span for the effect state's output target
-rw-r--r--Alc/alc.cpp6
-rw-r--r--Alc/alu.cpp2
-rw-r--r--Alc/effects/autowah.cpp3
-rw-r--r--Alc/effects/base.h3
-rw-r--r--Alc/effects/chorus.cpp3
-rw-r--r--Alc/effects/compressor.cpp3
-rw-r--r--Alc/effects/dedicated.cpp9
-rw-r--r--Alc/effects/distortion.cpp3
-rw-r--r--Alc/effects/echo.cpp3
-rw-r--r--Alc/effects/equalizer.cpp3
-rw-r--r--Alc/effects/fshifter.cpp3
-rw-r--r--Alc/effects/modulator.cpp3
-rw-r--r--Alc/effects/pshifter.cpp3
-rw-r--r--Alc/effects/reverb.cpp4
-rw-r--r--OpenAL32/alAuxEffectSlot.cpp3
15 files changed, 19 insertions, 35 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp
index a71cb662..58512f52 100644
--- a/Alc/alc.cpp
+++ b/Alc/alc.cpp
@@ -2062,8 +2062,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
aluInitEffectPanning(slot, device);
EffectState *state{slot->Effect.State};
- state->mOutBuffer = device->Dry.Buffer;
- state->mOutChannels = device->Dry.NumChannels;
+ state->mOutTarget = {device->Dry.Buffer, device->Dry.NumChannels};
if(state->deviceUpdate(device) == AL_FALSE)
update_failed = AL_TRUE;
else
@@ -2085,8 +2084,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
aluInitEffectPanning(slot, device);
EffectState *state{slot->Effect.State};
- state->mOutBuffer = device->Dry.Buffer;
- state->mOutChannels = device->Dry.NumChannels;
+ state->mOutTarget = {device->Dry.Buffer, device->Dry.NumChannels};
if(state->deviceUpdate(device) == AL_FALSE)
update_failed = AL_TRUE;
else
diff --git a/Alc/alu.cpp b/Alc/alu.cpp
index eed4ddc3..fc8b14d8 100644
--- a/Alc/alu.cpp
+++ b/Alc/alu.cpp
@@ -1455,7 +1455,7 @@ void ProcessContext(ALCcontext *ctx, const ALsizei SamplesToDo)
{
EffectState *state{slot->Params.mEffectState};
state->process(SamplesToDo, slot->Wet.Buffer, slot->Wet.NumChannels,
- {state->mOutBuffer, state->mOutChannels});
+ state->mOutTarget);
}
);
}
diff --git a/Alc/effects/autowah.cpp b/Alc/effects/autowah.cpp
index ab885460..90af6134 100644
--- a/Alc/effects/autowah.cpp
+++ b/Alc/effects/autowah.cpp
@@ -119,8 +119,7 @@ void ALautowahState::update(const ALCcontext *context, const ALeffectslot *slot,
mFreqMinNorm = MIN_FREQ / device->Frequency;
mBandwidthNorm = (MAX_FREQ-MIN_FREQ) / device->Frequency;
- mOutBuffer = target.Main->Buffer;
- mOutChannels = target.Main->NumChannels;
+ mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
for(ALuint i{0u};i < slot->Wet.NumChannels;++i)
{
auto coeffs = GetAmbiIdentityRow(i);
diff --git a/Alc/effects/base.h b/Alc/effects/base.h
index 1a59078f..c2848f37 100644
--- a/Alc/effects/base.h
+++ b/Alc/effects/base.h
@@ -144,8 +144,7 @@ struct EffectTarget {
struct EffectState {
RefCount mRef{1u};
- FloatBufferLine *mOutBuffer{nullptr};
- ALuint mOutChannels{0u};
+ al::span<FloatBufferLine> mOutTarget;
virtual ~EffectState() = default;
diff --git a/Alc/effects/chorus.cpp b/Alc/effects/chorus.cpp
index 9226c747..b77c3439 100644
--- a/Alc/effects/chorus.cpp
+++ b/Alc/effects/chorus.cpp
@@ -159,8 +159,7 @@ void ChorusState::update(const ALCcontext *Context, const ALeffectslot *Slot, co
CalcDirectionCoeffs({-1.0f, 0.0f, 0.0f}, 0.0f, coeffs[0]);
CalcDirectionCoeffs({ 1.0f, 0.0f, 0.0f}, 0.0f, coeffs[1]);
- mOutBuffer = target.Main->Buffer;
- mOutChannels = target.Main->NumChannels;
+ mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
ComputePanGains(target.Main, coeffs[0], Slot->Params.Gain, mGains[0].Target);
ComputePanGains(target.Main, coeffs[1], Slot->Params.Gain, mGains[1].Target);
diff --git a/Alc/effects/compressor.cpp b/Alc/effects/compressor.cpp
index 049f521b..883488cb 100644
--- a/Alc/effects/compressor.cpp
+++ b/Alc/effects/compressor.cpp
@@ -78,8 +78,7 @@ void CompressorState::update(const ALCcontext* UNUSED(context), const ALeffectsl
{
mEnabled = props->Compressor.OnOff;
- mOutBuffer = target.Main->Buffer;
- mOutChannels = target.Main->NumChannels;
+ mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
for(ALuint i{0u};i < slot->Wet.NumChannels;++i)
{
auto coeffs = GetAmbiIdentityRow(i);
diff --git a/Alc/effects/dedicated.cpp b/Alc/effects/dedicated.cpp
index 06d187fc..eb4076b2 100644
--- a/Alc/effects/dedicated.cpp
+++ b/Alc/effects/dedicated.cpp
@@ -62,8 +62,7 @@ void DedicatedState::update(const ALCcontext* UNUSED(context), const ALeffectslo
const int idx{!target.RealOut ? -1 : GetChannelIdxByName(*target.RealOut, LFE)};
if(idx != -1)
{
- mOutBuffer = target.RealOut->Buffer;
- mOutChannels = target.RealOut->NumChannels;
+ mOutTarget = {target.RealOut->Buffer, target.RealOut->NumChannels};
mTargetGains[idx] = Gain;
}
}
@@ -74,8 +73,7 @@ void DedicatedState::update(const ALCcontext* UNUSED(context), const ALeffectslo
const int idx{!target.RealOut ? -1 : GetChannelIdxByName(*target.RealOut, FrontCenter)};
if(idx != -1)
{
- mOutBuffer = target.RealOut->Buffer;
- mOutChannels = target.RealOut->NumChannels;
+ mOutTarget = {target.RealOut->Buffer, target.RealOut->NumChannels};
mTargetGains[idx] = Gain;
}
else
@@ -83,8 +81,7 @@ void DedicatedState::update(const ALCcontext* UNUSED(context), const ALeffectslo
ALfloat coeffs[MAX_AMBI_CHANNELS];
CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}, 0.0f, coeffs);
- mOutBuffer = target.Main->Buffer;
- mOutChannels = target.Main->NumChannels;
+ mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
ComputePanGains(target.Main, coeffs, Gain, mTargetGains);
}
}
diff --git a/Alc/effects/distortion.cpp b/Alc/effects/distortion.cpp
index 4830ad1c..3b8b73b7 100644
--- a/Alc/effects/distortion.cpp
+++ b/Alc/effects/distortion.cpp
@@ -90,8 +90,7 @@ void DistortionState::update(const ALCcontext *context, const ALeffectslot *slot
ALfloat coeffs[MAX_AMBI_CHANNELS];
CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}, 0.0f, coeffs);
- mOutBuffer = target.Main->Buffer;
- mOutChannels = target.Main->NumChannels;
+ mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
ComputePanGains(target.Main, coeffs, slot->Params.Gain*props->Distortion.Gain, mGain);
}
diff --git a/Alc/effects/echo.cpp b/Alc/effects/echo.cpp
index dadb41bb..594d2a7c 100644
--- a/Alc/effects/echo.cpp
+++ b/Alc/effects/echo.cpp
@@ -113,8 +113,7 @@ void EchoState::update(const ALCcontext *context, const ALeffectslot *slot, cons
CalcAngleCoeffs(-angle, 0.0f, 0.0f, coeffs[0]);
CalcAngleCoeffs( angle, 0.0f, 0.0f, coeffs[1]);
- mOutBuffer = target.Main->Buffer;
- mOutChannels = target.Main->NumChannels;
+ mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
ComputePanGains(target.Main, coeffs[0], slot->Params.Gain, mGains[0].Target);
ComputePanGains(target.Main, coeffs[1], slot->Params.Gain, mGains[1].Target);
}
diff --git a/Alc/effects/equalizer.cpp b/Alc/effects/equalizer.cpp
index 179dbc1b..14013aad 100644
--- a/Alc/effects/equalizer.cpp
+++ b/Alc/effects/equalizer.cpp
@@ -149,8 +149,7 @@ void EqualizerState::update(const ALCcontext *context, const ALeffectslot *slot,
mChans[i].filter[3].copyParamsFrom(mChans[0].filter[3]);
}
- mOutBuffer = target.Main->Buffer;
- mOutChannels = target.Main->NumChannels;
+ mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
for(ALuint i{0u};i < slot->Wet.NumChannels;++i)
{
auto coeffs = GetAmbiIdentityRow(i);
diff --git a/Alc/effects/fshifter.cpp b/Alc/effects/fshifter.cpp
index d50a7733..496a767d 100644
--- a/Alc/effects/fshifter.cpp
+++ b/Alc/effects/fshifter.cpp
@@ -133,8 +133,7 @@ void FshifterState::update(const ALCcontext *context, const ALeffectslot *slot,
ALfloat coeffs[MAX_AMBI_CHANNELS];
CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}, 0.0f, coeffs);
- mOutBuffer = target.Main->Buffer;
- mOutChannels = target.Main->NumChannels;
+ mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
ComputePanGains(target.Main, coeffs, slot->Params.Gain, mTargetGains);
}
diff --git a/Alc/effects/modulator.cpp b/Alc/effects/modulator.cpp
index 1630654f..131d275b 100644
--- a/Alc/effects/modulator.cpp
+++ b/Alc/effects/modulator.cpp
@@ -132,8 +132,7 @@ void ModulatorState::update(const ALCcontext *context, const ALeffectslot *slot,
for(ALuint i{1u};i < slot->Wet.NumChannels;++i)
mChans[i].Filter.copyParamsFrom(mChans[0].Filter);
- mOutBuffer = target.Main->Buffer;
- mOutChannels = target.Main->NumChannels;
+ mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
for(ALuint i{0u};i < slot->Wet.NumChannels;++i)
{
auto coeffs = GetAmbiIdentityRow(i);
diff --git a/Alc/effects/pshifter.cpp b/Alc/effects/pshifter.cpp
index 184c9a40..f1865830 100644
--- a/Alc/effects/pshifter.cpp
+++ b/Alc/effects/pshifter.cpp
@@ -192,8 +192,7 @@ void PshifterState::update(const ALCcontext* UNUSED(context), const ALeffectslot
ALfloat coeffs[MAX_AMBI_CHANNELS];
CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}, 0.0f, coeffs);
- mOutBuffer = target.Main->Buffer;
- mOutChannels = target.Main->NumChannels;
+ mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
ComputePanGains(target.Main, coeffs, slot->Params.Gain, mTargetGains);
}
diff --git a/Alc/effects/reverb.cpp b/Alc/effects/reverb.cpp
index 54151d6e..da8be835 100644
--- a/Alc/effects/reverb.cpp
+++ b/Alc/effects/reverb.cpp
@@ -888,8 +888,8 @@ void ReverbState::update3DPanning(const ALfloat *ReflectionsPan, const ALfloat *
*/
const alu::Matrix earlymat{GetTransformFromVector(ReflectionsPan)};
const alu::Matrix latemat{GetTransformFromVector(LateReverbPan)};
- mOutBuffer = target.Main->Buffer;
- mOutChannels = target.Main->NumChannels;
+
+ mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
for(ALsizei i{0};i < NUM_LINES;i++)
{
const ALfloat coeffs[MAX_AMBI_CHANNELS]{earlymat[0][i], earlymat[1][i], earlymat[2][i],
diff --git a/OpenAL32/alAuxEffectSlot.cpp b/OpenAL32/alAuxEffectSlot.cpp
index 4c7b3507..249f7cf3 100644
--- a/OpenAL32/alAuxEffectSlot.cpp
+++ b/OpenAL32/alAuxEffectSlot.cpp
@@ -643,8 +643,7 @@ ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect
FPUCtl mixer_mode{};
ALCdevice *Device{Context->Device};
std::unique_lock<std::mutex> statelock{Device->StateLock};
- State->mOutBuffer = Device->Dry.Buffer;
- State->mOutChannels = Device->Dry.NumChannels;
+ State->mOutTarget = {Device->Dry.Buffer, Device->Dry.NumChannels};
if(State->deviceUpdate(Device) == AL_FALSE)
{
statelock.unlock();