diff options
author | Chris Robinson <[email protected]> | 2023-12-24 02:48:20 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-12-24 02:48:20 -0800 |
commit | dae225e88dbf795e776a2c9f2dbe5bb07c2228b9 (patch) | |
tree | 8a2e79a24fef5a99b3d0f883ab03cc070a2b584a /alc/effects/echo.cpp | |
parent | 29a1001a22891294ab63102e8868bdea52eb7b93 (diff) |
Rework effect property handling
To nake EffectProps a variant instead of a union, and avoid manual vtables.
Diffstat (limited to 'alc/effects/echo.cpp')
-rw-r--r-- | alc/effects/echo.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/alc/effects/echo.cpp b/alc/effects/echo.cpp index 2f3343e8..a5bfa6a5 100644 --- a/alc/effects/echo.cpp +++ b/alc/effects/echo.cpp @@ -95,21 +95,22 @@ void EchoState::deviceUpdate(const DeviceBase *Device, const BufferStorage*) } void EchoState::update(const ContextBase *context, const EffectSlot *slot, - const EffectProps *props, const EffectTarget target) + const EffectProps *props_, const EffectTarget target) { + auto &props = std::get<EchoProps>(*props_); const DeviceBase *device{context->mDevice}; const auto frequency = static_cast<float>(device->Frequency); - mDelayTap[0] = maxu(float2uint(props->Echo.Delay*frequency + 0.5f), 1); - mDelayTap[1] = float2uint(props->Echo.LRDelay*frequency + 0.5f) + mDelayTap[0]; + mDelayTap[0] = maxu(float2uint(props.Delay*frequency + 0.5f), 1); + mDelayTap[1] = float2uint(props.LRDelay*frequency + 0.5f) + mDelayTap[0]; - const float gainhf{maxf(1.0f - props->Echo.Damping, 0.0625f)}; /* Limit -24dB */ + const float gainhf{maxf(1.0f - props.Damping, 0.0625f)}; /* Limit -24dB */ mFilter.setParamsFromSlope(BiquadType::HighShelf, LowpassFreqRef/frequency, gainhf, 1.0f); - mFeedGain = props->Echo.Feedback; + mFeedGain = props.Feedback; /* Convert echo spread (where 0 = center, +/-1 = sides) to angle. */ - const float angle{std::asin(props->Echo.Spread)}; + const float angle{std::asin(props.Spread)}; const auto coeffs0 = CalcAngleCoeffs(-angle, 0.0f, 0.0f); const auto coeffs1 = CalcAngleCoeffs( angle, 0.0f, 0.0f); |