Skip to content

Commit

Permalink
Shorten some long lines
Browse files Browse the repository at this point in the history
  • Loading branch information
kcat committed May 16, 2024
1 parent d24fc10 commit 44a6fce
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions alc/effects/chorus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ void ChorusState::update(const ContextBase *context, const EffectSlot *slot,

mWaveform = props.Waveform;

mDelay = std::max(float2int(std::round(props.Delay*frequency*gCubicTable.sTableSteps)), mindelay);
mDepth = std::min(static_cast<float>(mDelay)*props.Depth, static_cast<float>(mDelay-mindelay));
const auto stepscale = float{frequency * gCubicTable.sTableSteps};
mDelay = std::max(float2int(std::round(props.Delay * stepscale)), mindelay);
mDepth = std::min(static_cast<float>(mDelay) * props.Depth,
static_cast<float>(mDelay - mindelay));

mFeedback = props.Feedback;

Expand All @@ -159,7 +161,8 @@ void ChorusState::update(const ContextBase *context, const EffectSlot *slot,
* max range to avoid overflow when calculating the displacement.
*/
static constexpr int range_limit{std::numeric_limits<int>::max()/360 - 180};
const uint lfo_range{float2uint(std::min(std::round(frequency/props.Rate), float{range_limit}))};
const auto range = std::round(frequency / props.Rate);
const uint lfo_range{float2uint(std::min(range, float{range_limit}))};

mLfoOffset = mLfoOffset * lfo_range / mLfoRange;
mLfoRange = lfo_range;
Expand Down

0 comments on commit 44a6fce

Please sign in to comment.