Skip to content

Commit

Permalink
In process_block_until_close(), the equality checking was performed i…
Browse files Browse the repository at this point in the history
…n 2 steps and as in all cases NDX was 1, analysers warned that the loop part was ineffective.

To eliminate this warning, and simplify the code, just do a single loop from zero and also exit the loop when it fails the first test (should there ever be a use with NDX > 1).
Also simplify to only have the single call to processSmoothing.
  • Loading branch information
David Lowndes authored and David Lowndes committed Nov 22, 2024
1 parent 9ad1f54 commit f8eb625
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/common/ModulationSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -562,18 +562,15 @@ template <int NDX = 1> class ControllerModulationSourceVector : public Modulatio
{
assert(samplerate > 1000);

if (smoothingMode == Modulator::SmoothingMode::LEGACY)
{
processSmoothing(Modulator::SmoothingMode::SLOW_EXP, sigma);
}
else
{
processSmoothing(smoothingMode, sigma);
}
const auto sm = smoothingMode == Modulator::SmoothingMode::LEGACY
? Modulator::SmoothingMode::SLOW_EXP
: smoothingMode;

processSmoothing(sm, sigma);

auto res = (value[0] != target[0]);
bool res = true;

for (int i = 1; i < NDX; ++i)
for (int i = 0; (i < NDX) && res; ++i)
{
res &= (value[i] != target[i]);
}
Expand Down

0 comments on commit f8eb625

Please sign in to comment.