summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Klotz <uklotz@mixxx.org>2020-10-23 17:28:57 +0200
committerUwe Klotz <uklotz@mixxx.org>2020-10-23 17:28:57 +0200
commit7e62e9f1c3c0345a750392ff566dd176a14ebe3c (patch)
tree778453bdf896c60b58428e913dcc733190c2e2ff
parent37a6a5327e23d24c3539ec22ad571af93a0705f4 (diff)
parent6f2ad031233101ce0ea84df8b6552dccfe3ca8e6 (diff)
Merge branch '2.2' of git@github.com:mixxxdj/mixxx.git into 2.3
# Conflicts: # CHANGELOG # src/test/keyutilstest.cpp
-rw-r--r--CHANGELOG.md9
-rw-r--r--src/test/keyutilstest.cpp42
-rw-r--r--src/test/rescalertest.cpp8
-rw-r--r--src/track/keyutils.cpp18
4 files changed, 39 insertions, 38 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0e729d659f..965993a402 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -75,10 +75,11 @@
* Add controller mapping for Hercules DJControl Inpulse 200 [#2542](https://github.com/mixxxdj/mixxx/pull/2542)
* Add controller mapping for Hercules DJControl Jogvision [#2370](https://github.com/mixxxdj/mixxx/pull/2370)
-* Fix missing manual in deb package [lp:1889776] (https://bugs.launchpad.net/mixxx/+bug/1889776)
-* Fix caching of duplicate tracks that reference the same file #3027
-* Fix loss of precision when dealing with floating-point sample positions while setting loop out position and seeking using vinyl control #3126 #3127
-* Prevent moving a loop beyond track end #3117 https://bugs.launchpad.net/mixxx/+bug/1799574
+* Fix missing manual in deb package [lp:1889776](https://bugs.launchpad.net/mixxx/+bug/1889776)
+* Fix caching of duplicate tracks that reference the same file [#3027](https://github.com/mixxxdj/mixxx/pull/3027)
+* Fix loss of precision when dealing with floating-point sample positions while setting loop out position and seeking using vinyl control [#3126](https://github.com/mixxxdj/mixxx/pull/3126) [#3127](https://github.com/mixxxdj/mixxx/pull/3127)
+* Prevent moving a loop beyond track end [#3117](https://github.com/mixxxdj/mixxx/pull/3117) [lp:1799574](https://bugs.launchpad.net/mixxx/+bug/1799574)
+* Use 6 instead of only 4 compatible musical keys (major/minor) [#3205](https://github.com/mixxxdj/mixxx/pull/3205)
## [2.2.4](https://launchpad.net/mixxx/+milestone/2.2.4) (2020-06-27)
diff --git a/src/test/keyutilstest.cpp b/src/test/keyutilstest.cpp
index cd876b0fa9..d8fb148107 100644
--- a/src/test/keyutilstest.cpp
+++ b/src/test/keyutilstest.cpp
@@ -1,13 +1,12 @@
-#include <gtest/gtest.h>
#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
#include <QDebug>
-#include "track/keyutils.h"
#include "proto/keys.pb.h"
+#include "track/keyutils.h"
-using ::testing::ElementsAre;
-
-namespace {
+using ::testing::UnorderedElementsAre;
class KeyUtilsTest : public testing::Test {
};
@@ -206,8 +205,9 @@ TEST_F(KeyUtilsTest, ShortestStepsToKey) {
}
TEST_F(KeyUtilsTest, GetCompatibleKeys) {
- // The relative major, the perfect 4th and the perfect 5th are all
- // compatible. This is easily checked with the Circle of Fifths.
+ // The relative major/minor, the perfect 4th major/minor and the
+ // perfect 5th major/minor are all compatible. This is easily
+ // checked with the Circle of Fifths.
// Test keys on the boundary between 1 and 12 to check that wrap-around
// works.
@@ -215,21 +215,21 @@ TEST_F(KeyUtilsTest, GetCompatibleKeys) {
mixxx::track::io::key::A_MINOR;
QList<mixxx::track::io::key::ChromaticKey> compatible =
KeyUtils::getCompatibleKeys(key);
- std::sort(compatible.begin(), compatible.end());
- EXPECT_THAT(compatible, ElementsAre(
- mixxx::track::io::key::C_MAJOR,
- mixxx::track::io::key::D_MINOR,
- mixxx::track::io::key::E_MINOR,
- mixxx::track::io::key::A_MINOR));
+ EXPECT_THAT(compatible,
+ UnorderedElementsAre(mixxx::track::io::key::C_MAJOR,
+ mixxx::track::io::key::F_MAJOR,
+ mixxx::track::io::key::G_MAJOR,
+ mixxx::track::io::key::D_MINOR,
+ mixxx::track::io::key::E_MINOR,
+ mixxx::track::io::key::A_MINOR));
key = mixxx::track::io::key::F_MAJOR;
compatible = KeyUtils::getCompatibleKeys(key);
- std::sort(compatible.begin(), compatible.end());
- EXPECT_THAT(compatible, ElementsAre(
- mixxx::track::io::key::C_MAJOR,
- mixxx::track::io::key::F_MAJOR,
- mixxx::track::io::key::B_FLAT_MAJOR,
- mixxx::track::io::key::D_MINOR));
+ EXPECT_THAT(compatible,
+ UnorderedElementsAre(mixxx::track::io::key::C_MAJOR,
+ mixxx::track::io::key::F_MAJOR,
+ mixxx::track::io::key::B_FLAT_MAJOR,
+ mixxx::track::io::key::D_MINOR,
+ mixxx::track::io::key::A_MINOR,
+ mixxx::track::io::key::G_MINOR));
}
-
-} // namespace
diff --git a/src/test/rescalertest.cpp b/src/test/rescalertest.cpp
index a5ab8afe1c..f6bf014edf 100644
--- a/src/test/rescalertest.cpp
+++ b/src/test/rescalertest.cpp
@@ -1,15 +1,9 @@
#include <gtest/gtest.h>
-#include <gmock/gmock.h>
#include <QDebug>
#include "util/math.h"
#include "util/rescaler.h"
-
-using ::testing::ElementsAre;
-
-namespace {
-
class RescalerUtilsTest : public testing::Test {
};
@@ -62,5 +56,3 @@ TEST_F(RescalerUtilsTest, Test) {
result = RescalerUtils::oneByXToLinear(result, 1000, 0, 100);
EXPECT_TRUE(fabs(result - 50) < 0.0000000001);
}
-
-} // namespace
diff --git a/src/track/keyutils.cpp b/src/track/keyutils.cpp
index 87c2148542..b4db95d9fa 100644
--- a/src/track/keyutils.cpp
+++ b/src/track/keyutils.cpp
@@ -530,15 +530,15 @@ QList<mixxx::track::io::key::ChromaticKey> KeyUtils::getCompatibleKeys(
return compatible;
}
+ int openKeyNumber = KeyUtils::keyToOpenKeyNumber(key);
// We know the key is in the set of valid values. Save whether or not the
// value is minor.
bool major = keyIsMajor(key);
- int openKeyNumber = KeyUtils::keyToOpenKeyNumber(key);
// The compatible keys of particular key are:
// * The relative major/minor key.
- // * The perfect 4th (sub-dominant) key.
- // * The perfect 5th (dominant) key.
+ // * The perfect 4th (sub-dominant) major/minor key.
+ // * The perfect 5th (dominant) major/minor key.
//
// The Circle of Fifths is a handy tool that encodes this compatibility.
// Keys on the same radial of the circle are compatible and adjacent keys on
@@ -550,14 +550,22 @@ QList<mixxx::track::io::key::ChromaticKey> KeyUtils::getCompatibleKeys(
// The key is compatible with tracks in the same key.
compatible << key;
+ auto relativeKey = openKeyNumberToKey(openKeyNumber, !major);
+ int relativeOpenKeyNumber = KeyUtils::keyToOpenKeyNumber(relativeKey);
+
// The relative major/minor key is compatible.
- compatible << openKeyNumberToKey(openKeyNumber, !major);
+ compatible << relativeKey;
- // The perfect 4th and perfect 5th are compatible.
+ // The perfect 4th and perfect 5th of BOTH major and minor key are compatible
+ // (as explained by Phil Morse: https://youtu.be/9eECvYYAwbg?t=2370)
compatible << openKeyNumberToKey(
openKeyNumber == 12 ? 1 : openKeyNumber + 1, major);
compatible << openKeyNumberToKey(
+ relativeOpenKeyNumber == 12 ? 1 : relativeOpenKeyNumber + 1, !major);
+ compatible << openKeyNumberToKey(
openKeyNumber == 1 ? 12 : openKeyNumber - 1, major);
+ compatible << openKeyNumberToKey(
+ relativeOpenKeyNumber == 1 ? 12 : relativeOpenKeyNumber - 1, !major);
return compatible;
}