From 9c959d7dee6841b05e549525a247b08b96f92e24 Mon Sep 17 00:00:00 2001 From: Michael Votaw Date: Tue, 20 Aug 2024 20:08:25 -0500 Subject: [PATCH] Cutoff for jacks is 170bpm 1/8th notes, and not after jumps --- src/StepParityDatastructs.h | 5 +++++ src/TechCounts.cpp | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/StepParityDatastructs.h b/src/StepParityDatastructs.h index 546d18c6f7..98842b57c3 100644 --- a/src/StepParityDatastructs.h +++ b/src/StepParityDatastructs.h @@ -24,6 +24,11 @@ namespace StepParity { }; const std::vector FEET = {LEFT_HEEL, LEFT_TOE, RIGHT_HEEL, RIGHT_TOE}; + // A map for getting the other part of the foot, when you don't actually care + // what part it is. + // OTHER_PART_OF_FOOT[LEFT_HEEL] == LEFT_TOE + const std::vector OTHER_PART_OF_FOOT = {NONE, LEFT_TOE, LEFT_HEEL, RIGHT_TOE, RIGHT_HEEL}; + const RString FEET_LABELS[] = {"N", "L", "l", "R", "r", "5??", "6??"}; const RString TapNoteTypeShortNames[] = { "Empty", "Tap", "Mine", "Attack", "AutoKeySound", "Fake", "", "" }; const RString TapNoteSubTypeShortNames[] = { "Hold", "Roll", "", "" }; diff --git a/src/TechCounts.cpp b/src/TechCounts.cpp index 2cb2c899d3..a238007148 100644 --- a/src/TechCounts.cpp +++ b/src/TechCounts.cpp @@ -23,7 +23,7 @@ XToLocalizedString( TechCountsCategory ); LuaFunction(TechCountsCategoryToLocalizedString, TechCountsCategoryToLocalizedString(Enum::Check(L, 1)) ); LuaXType( TechCountsCategory ); - +const float JACK_CUTOFF = 0.176; // 170bpm 1/8th notes, anything slower isn't considered a jack // TechCounts methods TechCounts::TechCounts() @@ -86,7 +86,7 @@ void TechCounts::CalculateTechCountsFromRows(const std::vector // A value of -1 means that Foot is not on any column int previousFootPlacement[StepParity::NUM_Foot]; int currentFootPlacement[StepParity::NUM_Foot]; - + int previousNoteCount = 0; for (int f = 0; f < StepParity::NUM_Foot; f++) { previousFootPlacement[f] = -1; @@ -101,6 +101,8 @@ void TechCounts::CalculateTechCountsFromRows(const std::vector for (unsigned long i = 1; i < rows.size(); i++) { const StepParity::Row ¤tRow = rows[i]; + const StepParity::Row &previousRow = rows[i - 1]; + int noteCount = 0; // copy the foot placement for the current row into currentColumns, @@ -143,7 +145,10 @@ void TechCounts::CalculateTechCountsFromRows(const std::vector if(previousFootPlacement[foot] == currentFootPlacement[foot]) { - out[TechCountsCategory_Jacks] += 1; + if(previousNoteCount == 1 && currentRow.second - previousRow.second < JACK_CUTOFF) + { + out[TechCountsCategory_Jacks] += 1; + } } else { @@ -212,6 +217,8 @@ void TechCounts::CalculateTechCountsFromRows(const std::vector previousColumns[c] = currentColumns[c]; currentColumns[c] = StepParity::NONE; } + + previousNoteCount = noteCount; } }