forked from mixxxdj/mixxx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkeydetectionsettings.h
72 lines (56 loc) · 2.73 KB
/
keydetectionsettings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef PREFERENCES_KEYDETECTIONSETTINGS_H
#define PREFERENCES_KEYDETECTIONSETTINGS_H
#include "preferences/usersettings.h"
#define VAMP_CONFIG_KEY "[Vamp]"
// VAMP_CONFIG_KEY Preferences. WARNING: Do not fix the "analyser" spelling here
// since user config files contain these strings.
#define VAMP_ANALYZER_KEY_LIBRARY "AnalyserKeyLibrary"
#define VAMP_ANALYZER_KEY_PLUGIN_ID "AnalyserKeyPluginID"
#define KEY_CONFIG_KEY "[Key]"
// KEY_CONFIG_KEY Preferences
#define KEY_DETECTION_ENABLED "KeyDetectionEnabled"
#define KEY_FAST_ANALYSIS "FastAnalysisEnabled"
#define KEY_REANALYZE_WHEN_SETTINGS_CHANGE "ReanalyzeWhenSettingsChange"
#define KEY_NOTATION "KeyNotation"
#define KEY_NOTATION_OPEN_KEY "OpenKey"
#define KEY_NOTATION_OPEN_KEY_AND_TRADITIONAL "OpenKey/Traditional"
#define KEY_NOTATION_LANCELOT "Lancelot"
#define KEY_NOTATION_LANCELOT_AND_TRADITIONAL "Lancelot/Traditional"
#define KEY_NOTATION_TRADITIONAL "Traditional"
#define KEY_NOTATION_CUSTOM "Custom"
#define KEY_NOTATION_CUSTOM_PREFIX "CustomKeyNotation"
class KeyDetectionSettings {
public:
KeyDetectionSettings(UserSettingsPointer pConfig) : m_pConfig(pConfig) {}
DEFINE_PREFERENCE_HELPERS(KeyDetectionEnabled, bool,
KEY_CONFIG_KEY, KEY_DETECTION_ENABLED, true);
DEFINE_PREFERENCE_HELPERS(FastAnalysis, bool,
KEY_CONFIG_KEY, KEY_FAST_ANALYSIS, false);
DEFINE_PREFERENCE_HELPERS(ReanalyzeWhenSettingsChange, bool,
KEY_CONFIG_KEY, KEY_REANALYZE_WHEN_SETTINGS_CHANGE, false);
// TODO(rryan): Enum
DEFINE_PREFERENCE_HELPERS(KeyNotation, QString,
KEY_CONFIG_KEY, KEY_NOTATION, KEY_NOTATION_TRADITIONAL);
QString getCustomKeyNotation(mixxx::track::io::key::ChromaticKey key) {
return m_pConfig->getValue<QString>(ConfigKey(KEY_CONFIG_KEY,
KEY_NOTATION_CUSTOM_PREFIX +
QString::number(key)));
}
void setCustomKeyNotation(mixxx::track::io::key::ChromaticKey key,
const QString& notation) {
m_pConfig->setValue(ConfigKey(KEY_CONFIG_KEY,
KEY_NOTATION_CUSTOM_PREFIX +
QString::number(key)), notation);
}
QString getKeyPluginId() const {
return m_pConfig->getValue<QString>(ConfigKey(
VAMP_CONFIG_KEY, VAMP_ANALYZER_KEY_PLUGIN_ID));
}
void setKeyPluginId(const QString& pluginId) {
m_pConfig->setValue(ConfigKey(
VAMP_CONFIG_KEY, VAMP_ANALYZER_KEY_PLUGIN_ID), pluginId);
}
private:
UserSettingsPointer m_pConfig;
};
#endif /* PREFERENCES_KEYDETECTIONSETTINGS_H */