From 5fa43a0efb44390a29ed5933cd156ae003f05e46 Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Fri, 12 Jun 2020 20:04:21 +0200 Subject: [PATCH] Check the number of curves at compile time --- src/sfizz/Tuning.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/sfizz/Tuning.cpp b/src/sfizz/Tuning.cpp index fa83ebca..36a8fbcd 100644 --- a/src/sfizz/Tuning.cpp +++ b/src/sfizz/Tuning.cpp @@ -288,9 +288,9 @@ StretchTuning StretchTuning::createRailsbackFromRatio(float stretch) }; // known curves and their matching knob positions - const int num_curves = 3; - const float* curves[] = {railsback21, railsback41, railsback42}; - const float points[] = {0.25f, 0.5f, 1.0f}; + const float* curves[] = { railsback21, railsback41, railsback42 }; + const float points[] = { 0.25f, 0.5f, 1.0f }; + constexpr int num_curves = sizeof(curves) / sizeof(decltype(curves[0])); // int index = -1; @@ -319,7 +319,6 @@ StretchTuning StretchTuning::createRailsbackFromRatio(float stretch) // return createFromDetuneRatios(data); - } } // namespace sfz