comparison layer/SpectrogramLayer.cpp @ 1017:9c890b7dfa83 colourschemes

Add default spectrogram colours to prefs
author Chris Cannam
date Wed, 20 Jan 2016 11:43:16 +0000
parents 89f44d182d37
children 25ec2390fad3
comparison
equal deleted inserted replaced
1016:6a8084c72e7a 1017:9c890b7dfa83
36 #include <QTimer> 36 #include <QTimer>
37 #include <QApplication> 37 #include <QApplication>
38 #include <QMessageBox> 38 #include <QMessageBox>
39 #include <QMouseEvent> 39 #include <QMouseEvent>
40 #include <QTextStream> 40 #include <QTextStream>
41 #include <QSettings>
41 42
42 #include <iostream> 43 #include <iostream>
43 44
44 #include <cassert> 45 #include <cassert>
45 #include <cmath> 46 #include <cmath>
79 m_haveDetailedScale(false), 80 m_haveDetailedScale(false),
80 m_lastPaintBlockWidth(0), 81 m_lastPaintBlockWidth(0),
81 m_exiting(false), 82 m_exiting(false),
82 m_sliceableModel(0) 83 m_sliceableModel(0)
83 { 84 {
85 QString colourConfigName = "spectrogram-colour";
86 int colourConfigDefault = int(ColourMapper::Green);
87
84 if (config == FullRangeDb) { 88 if (config == FullRangeDb) {
85 m_initialMaxFrequency = 0; 89 m_initialMaxFrequency = 0;
86 setMaxFrequency(0); 90 setMaxFrequency(0);
87 } else if (config == MelodicRange) { 91 } else if (config == MelodicRange) {
88 setWindowSize(8192); 92 setWindowSize(8192);
91 setMaxFrequency(1500); 95 setMaxFrequency(1500);
92 setMinFrequency(40); 96 setMinFrequency(40);
93 setColourScale(LinearColourScale); 97 setColourScale(LinearColourScale);
94 setColourMap(ColourMapper::Sunset); 98 setColourMap(ColourMapper::Sunset);
95 setFrequencyScale(LogFrequencyScale); 99 setFrequencyScale(LogFrequencyScale);
100 colourConfigName = "spectrogram-melodic-colour";
101 colourConfigDefault = int(ColourMapper::Sunset);
96 // setGain(20); 102 // setGain(20);
97 } else if (config == MelodicPeaks) { 103 } else if (config == MelodicPeaks) {
98 setWindowSize(4096); 104 setWindowSize(4096);
99 setWindowHopLevel(5); 105 setWindowHopLevel(5);
100 m_initialMaxFrequency = 2000; 106 m_initialMaxFrequency = 2000;
102 setMinFrequency(40); 108 setMinFrequency(40);
103 setFrequencyScale(LogFrequencyScale); 109 setFrequencyScale(LogFrequencyScale);
104 setColourScale(LinearColourScale); 110 setColourScale(LinearColourScale);
105 setBinDisplay(PeakFrequencies); 111 setBinDisplay(PeakFrequencies);
106 setNormalization(NormalizeColumns); 112 setNormalization(NormalizeColumns);
107 } 113 colourConfigName = "spectrogram-melodic-colour";
108 114 colourConfigDefault = int(ColourMapper::Sunset);
115 }
116
117 QSettings settings;
118 settings.beginGroup("Preferences");
119 setColourMap(settings.value(colourConfigName, colourConfigDefault).toInt());
120 settings.endGroup();
121
109 Preferences *prefs = Preferences::getInstance(); 122 Preferences *prefs = Preferences::getInstance();
110 connect(prefs, SIGNAL(propertyChanged(PropertyContainer::PropertyName)), 123 connect(prefs, SIGNAL(propertyChanged(PropertyContainer::PropertyName)),
111 this, SLOT(preferenceChanged(PropertyContainer::PropertyName))); 124 this, SLOT(preferenceChanged(PropertyContainer::PropertyName)));
112 setWindowType(prefs->getWindowType()); 125 setWindowType(prefs->getWindowType());
113 126