Skip to content
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

Merged
merged 13 commits into from
Sep 8, 2016
Merged

sort keys by circle of fifths #1000

merged 13 commits into from
Sep 8, 2016

Conversation

Be-ing
Copy link
Contributor

@Be-ing Be-ing commented Sep 2, 2016

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!

@daschuer
Copy link
Member

daschuer commented Sep 4, 2016

Woo! PR #1000!

You got it! Congratulations ;-)

@daschuer
Copy link
Member

daschuer commented Sep 4, 2016

This was:
#649


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;
Copy link
Member

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.

@daschuer
Copy link
Member

daschuer commented Sep 4, 2016

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?

I think it will be the best, to use a ControlObject for it.

@Be-ing
Copy link
Contributor Author

Be-ing commented Sep 4, 2016

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?

@Be-ing
Copy link
Contributor Author

Be-ing commented Sep 6, 2016

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.

@daschuer
Copy link
Member

daschuer commented Sep 6, 2016

Travis fails, not your fault:
The job exceeded the maximum time limit for jobs, and has been terminated.

@@ -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"));
Copy link
Member

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

@@ -12,8 +12,6 @@
class KeyUtils {
public:
enum KeyNotation {
// The default notation (set with setNotation).
DEFAULT = 0,
Copy link
Contributor Author

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

@daschuer
Copy link
Member

daschuer commented Sep 7, 2016

A m_pKeyNotation->emitValueChanged(); here will issue the signal only slots bound in DlgPrefKey.

Just call slotSetKeySortOrder() directly like for a short solution.
.. or set bPersist = true in ControlObject and replace all related direct pConfig-> calles by ControlProxies.

@daschuer
Copy link
Member

daschuer commented Sep 8, 2016

LGTM! Thank you.

@daschuer daschuer merged commit 40babde into mixxxdj:master Sep 8, 2016
@Be-ing
Copy link
Contributor Author

Be-ing commented Sep 8, 2016

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.

@esbrandt
Copy link
Contributor

esbrandt commented Sep 8, 2016

Thanks for adding this useful feature.
Much appreciated.

On Sep 8, 2016, at 20:21, Be notifications@github.com wrote:

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.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub #1000 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AEUPSQ-Rj5dtctSYwKdCmF7TRWBBRrakks5qoFI5gaJpZM4J0Kg6.

@esbrandt
Copy link
Contributor

esbrandt commented Sep 8, 2016

Hmm, now there is this warning in the log

Warning [Main]: QString::arg: Argument missing: CASE key_id WHEN 0 THEN 0 WHEN 1 THEN 1 WHEN 22 THEN 2 WHEN 8 THEN 3 WHEN 17 THEN 4 WHEN 3 THEN 5 WHEN 24 THEN 6 WHEN 10 THEN 7 WHEN 19 THEN 8 WHEN 5 THEN 9 WHEN 14 THEN 10 WHEN 12 THEN 11 WHEN 21 THEN 12 WHEN 7 THEN 13 WHEN 16 THEN 14 WHEN 2 THEN 15 WHEN 23 THEN 16 WHEN 9 THEN 17 WHEN 18 THEN 18 WHEN 4 THEN 19 WHEN 13 THEN 20 WHEN 11 THEN 21 WHEN 20 THEN 22 WHEN 6 THEN 23 WHEN 15 THEN 24 END, key

FWIW , i have many short samples in my library, thad don´t have a key detected, even after analyzing.

Any hints?

@Be-ing
Copy link
Contributor Author

Be-ing commented Sep 8, 2016

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.

@Be-ing
Copy link
Contributor Author

Be-ing commented Sep 8, 2016

Ah, I see. The key field in the DB is NULL if no key is detected. I think adding something like WHEN NULL THEN 0 will get rid of the warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants