-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sort keys by circle of fifths #1000
Conversation
The order starts with C at the top, then its relative minor (a), then adds 1 sharp (G), then G's relative minor (e), and so adding sharps/removing flats around the circle of fifths.
You got it! Congratulations ;-) |
This was: |
|
||
m_columnSortByIndex.insert(m_columnIndexByEnum[COLUMN_PLAYLISTTRACKSTABLE_LOCATION], sortNoCase); | ||
m_columnSortByIndex.insert(m_columnIndexByEnum[COLUMN_PLAYLISTTRACKSTABLE_ARTIST], sortNoCase); | ||
m_columnSortByIndex.insert(m_columnIndexByEnum[COLUMN_PLAYLISTTRACKSTABLE_TITLE], sortNoCase); | ||
} | ||
|
||
void ColumnCache::setKeySortOrder(QString const& notation) { | ||
std::vector<mixxx::track::io::key::ChromaticKey> sortOrder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment, why we did not register a custom sorting function.
I think it will be the best, to use a ControlObject for it. |
The question still remains, how to make ColumnCache react when the CO changes? |
Okay, I figured out how to make use of a ControlObject and ControlProxy for this. It now responds to configuration changes. The new sorting order isn't applied until the user sorts the column again. I think this may be desirable to avoid unexpected changes in the sorting. http://mixxx.org/wiki/doku.php/developer_guide_control could use a bit of updating. |
Travis fails, not your fault: |
@@ -119,6 +119,7 @@ void DlgPrefKey::loadSettings() { | |||
|
|||
QString notation = m_pConfig->getValueString( | |||
ConfigKey(KEY_CONFIG_KEY, KEY_NOTATION)); | |||
m_pKeyNotation = new ControlProxy(ConfigKey("[Library]", "key_notation")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add "this" so the new ControlProxy will be deleted by the Qt Object tree
and add explanatory comment on use of KeyNotation CUSTOM
@@ -12,8 +12,6 @@ | |||
class KeyUtils { | |||
public: | |||
enum KeyNotation { | |||
// The default notation (set with setNotation). | |||
DEFAULT = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried making CUSTOM = 0, but then the sort order wasn't being set up properly for that notation when Mixxx started, even when I added m_pKeyNotation->emitValueChanged();
after https://github.com/Be-ing/mixxx/blob/3a5142f3dd5db09955320f4b938cd9e921315c8c/src/preferences/dialog/dlgprefkey.cpp#L141
A Just call slotSetKeySortOrder() directly like for a short solution. |
LGTM! Thank you. |
Thanks for reviewing. I'm glad this is finally polished and merged. I'll sure be paying more attention to the key info in my library now. |
Thanks for adding this useful feature.
|
Hmm, now there is this warning in the log
FWIW , i have many short samples in my library, thad don´t have a key detected, even after analyzing. Any hints? |
Hm, I'm guessing that has to do with how undetected keys are stored in the DB. Perhaps a special case needs to be added to the SQL to handle that. |
Ah, I see. The |
Fixing https://bugs.launchpad.net/mixxx/+bug/1435628
The order starts with C at the top, then its relative minor (a), then adds 1 sharp (G), then G's relative minor (e), and so adding sharps/removing flats around the circle of fifths. For Lancelot notation, it starts with G#m at the top, which is 1A in that notation, and proceeds alphanumerically (minor keys appear before their relative major keys in this case).
I'm having trouble figuring out how to go about making it respond to changes in the Key Preferences. Presently, the sort order is only determined when Mixxx starts. Maybe emit a signal from DlgPrefKey::slotApply() and connect a slot to it in ColumnCache's constructor?
Woo! PR #1000!