From db3521027e749c5511a9ed5a4bdfc29b1934a4d9 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 3 Apr 2020 17:29:37 +0200 Subject: [PATCH] Fix some clang-tidy warnings --- src/sfizz/Synth.cpp | 2 +- src/sfizz/Voice.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/sfizz/Synth.cpp b/src/sfizz/Synth.cpp index 54d7fc12..ec102de3 100644 --- a/src/sfizz/Synth.cpp +++ b/src/sfizz/Synth.cpp @@ -785,7 +785,7 @@ void sfz::Synth::pitchWheel(int delay, int pitch) noexcept { ASSERT(pitch <= 8192); ASSERT(pitch >= -8192); - const auto normalizedPitch = normalizeBend(pitch); + const auto normalizedPitch = normalizeBend(float(pitch)); ScopedTiming logger { dispatchDuration, ScopedTiming::Operation::addToDuration }; resources.midiState.pitchBendEvent(delay, normalizedPitch); diff --git a/src/sfizz/Voice.cpp b/src/sfizz/Voice.cpp index 775d220d..4a9c6c76 100644 --- a/src/sfizz/Voice.cpp +++ b/src/sfizz/Voice.cpp @@ -670,8 +670,10 @@ void sfz::Voice::setupOscillatorUnison() detunes[0] = 0.0; detunes[1] = -d; detunes[2] = +d; - for (int i = 3; i < m; ++i) - detunes[i] = d * ((i & 1) ? -0.25f : +0.25f) * ((i - 1) / 2); + for (int i = 3; i < m; ++i) { + int n = (i - 1) / 2; + detunes[i] = d * ((i & 1) ? -0.25f : +0.25f) * float(n); + } // detune (ratio) for (int i = 0; i < m; ++i) @@ -681,7 +683,7 @@ void sfz::Voice::setupOscillatorUnison() waveLeftGain[0] = 0.0; waveRightGain[m - 1] = 0.0; for (int i = 0; i < m - 1; ++i) { - float g = 1 - i / float(m - 1); + float g = 1.0f - float(i) / float(m - 1); waveLeftGain[m - 1 - i] = g; waveRightGain[i] = g; }