Skip to content

Commit

Permalink
Added Test for the advanced scale mode notation
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Apr 9, 2023
1 parent 5d51208 commit fba6a41
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 7 deletions.
38 changes: 38 additions & 0 deletions src/test/keyutilstest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,44 @@ TEST_F(KeyUtilsTest, KeyNameNotation) {
KeyUtils::guessKeyFromText("xyz"));
}

TEST_F(KeyUtilsTest, ScaleModeNotation) {
EXPECT_EQ(mixxx::track::io::key::C_MAJOR,
KeyUtils::guessKeyFromText("C ionian"));
EXPECT_EQ(mixxx::track::io::key::A_MINOR,
KeyUtils::guessKeyFromText("A aeolian"));
EXPECT_EQ(mixxx::track::io::key::C_MAJOR,
KeyUtils::guessKeyFromText("F lydian"));
EXPECT_EQ(mixxx::track::io::key::C_MAJOR,
KeyUtils::guessKeyFromText("G mixolydian"));
EXPECT_EQ(mixxx::track::io::key::A_MINOR,
KeyUtils::guessKeyFromText("D dorian"));
EXPECT_EQ(mixxx::track::io::key::A_MINOR,
KeyUtils::guessKeyFromText("E phrygian"));
EXPECT_EQ(mixxx::track::io::key::A_MINOR,
KeyUtils::guessKeyFromText("B locrian"));

EXPECT_EQ(mixxx::track::io::key::F_SHARP_MINOR,
KeyUtils::guessKeyFromText("11A"));
EXPECT_EQ(mixxx::track::io::key::A_MAJOR,
KeyUtils::guessKeyFromText("11B"));
EXPECT_EQ(mixxx::track::io::key::A_MAJOR,
KeyUtils::guessKeyFromText("11I"));
EXPECT_EQ(mixxx::track::io::key::A_MAJOR,
KeyUtils::guessKeyFromText("11L"));
EXPECT_EQ(mixxx::track::io::key::A_MAJOR,
KeyUtils::guessKeyFromText("11M"));
EXPECT_EQ(mixxx::track::io::key::F_SHARP_MINOR,
KeyUtils::guessKeyFromText("11D"));
EXPECT_EQ(mixxx::track::io::key::F_SHARP_MINOR,
KeyUtils::guessKeyFromText("11P"));
EXPECT_EQ(mixxx::track::io::key::F_SHARP_MINOR,
KeyUtils::guessKeyFromText("11C"));

// Redundant Mode
EXPECT_EQ(mixxx::track::io::key::INVALID,
KeyUtils::guessKeyFromText("Cm ionian"));
}

mixxx::track::io::key::ChromaticKey incrementKey(
mixxx::track::io::key::ChromaticKey key, int steps=1) {
return static_cast<mixxx::track::io::key::ChromaticKey>(
Expand Down
14 changes: 7 additions & 7 deletions src/track/keyutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ constexpr int s_sortKeysCircleOfFifthsLancelot[] = {
/*
// Strings used by Rapid Evolution when exporting detailed keys to file tags
constexpr const char* s_scaleModeText[] = {
"ionian", // standard major
"aeolian", // natural minor
"lydian", // major with raised 4th
"mixolydian", // major with lowered 7th
"dorian", // minor with raised 6th
"phrygian", // minor with lowered 2nd
"locrian", // minor with lowered 2nd and 7th
"ionian", // standard major
"aeolian", // natural minor
"lydian", // major with raised 4th
"mixolydian", // major with lowered 7th
"dorian", // minor with raised 6th
"phrygian", // minor with lowered 2nd
"locrian", // minor with lowered 2nd and 7th
};
*/

Expand Down

0 comments on commit fba6a41

Please sign in to comment.