Make some constants constexpr, mark as float so MSVC doesn't print a warning about a double to float truncation

This commit is contained in:
sukibaby
2025-04-29 21:40:54 -07:00
committed by teejusb
parent 8dcb01f3ee
commit 305a24196a
2 changed files with 7 additions and 7 deletions
+4 -4
View File
@@ -26,15 +26,15 @@ namespace StepParity
// 0.1 = 1/16th note at 150bpm. Jacks quicker than this are harder.
// Above this speed, footswitches should be prioritized
const float JACK_THRESHOLD = 0.1;
constexpr float JACK_THRESHOLD = 0.1f;
// 0.15 = 1/8th at 200bpm, or 3/16th at 150bpm. Below this speed, jumps should be prioritized
const float SLOW_BRACKET_THRESHOLD = 0.15;
constexpr float SLOW_BRACKET_THRESHOLD = 0.15f;
// 0.2 = 1/8th at 150bpm. Footswitches slower than this are harder.
// Below this speed, jacks should be prioritized
const float SLOW_FOOTSWITCH_THRESHOLD = 0.2;
constexpr float SLOW_FOOTSWITCH_THRESHOLD = 0.2f;
// 0.4 = 1/4th at 150bpm. Once a footswitch gets slow enough, though,
// just ignore it.
const float SLOW_FOOTSWITCH_IGNORE = 0.4;
constexpr float SLOW_FOOTSWITCH_IGNORE = 0.4f;
class StepParityCost
{
+3 -3
View File
@@ -28,13 +28,13 @@ LuaXType( TechCountsCategory );
// 0.176 ~= 1/8th at 175bpm
// Anything slower isn't counted as a jack
const float JACK_CUTOFF = 0.176;
constexpr float JACK_CUTOFF = 0.176f;
// 0.3 = 1/4th at 200bpm (or 3/16th at 150bpm)
// Anything slower isn't counted as a footswitch
const float FOOTSWITCH_CUTOFF = 0.3;
constexpr float FOOTSWITCH_CUTOFF = 0.3f;
// 0.235 ~= 1/8th at 128bpm
// Anything slower isn't counted as a doublestep
const float DOUBLESTEP_CUTOFF = 0.235;
constexpr float DOUBLESTEP_CUTOFF = 0.235f;
// TechCounts methods
TechCounts::TechCounts()