Use a span for the effect state's output target

This commit is contained in:
Chris Robinson
2019-06-05 19:58:58 -07:00
parent 1ce310c6d1
commit f9da06fc6a
15 changed files with 19 additions and 35 deletions
+2 -4
View File
@@ -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
+1 -1
View File
@@ -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);
}
);
}
+1 -2
View File
@@ -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);
+1 -2
View File
@@ -144,8 +144,7 @@ struct EffectTarget {
struct EffectState {
RefCount mRef{1u};
FloatBufferLine *mOutBuffer{nullptr};
ALuint mOutChannels{0u};
al::span<FloatBufferLine> mOutTarget;
virtual ~EffectState() = default;
+1 -2
View File
@@ -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);
+1 -2
View File
@@ -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);
+3 -6
View File
@@ -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);
}
}
+1 -2
View File
@@ -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);
}
+1 -2
View File
@@ -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);
}
+1 -2
View File
@@ -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);
+1 -2
View File
@@ -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);
}
+1 -2
View File
@@ -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);
+1 -2
View File
@@ -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);
}
+2 -2
View File
@@ -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],
+1 -2
View File
@@ -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();