comparison layer/WaveformLayer.cpp @ 133:9e6b3e239b9d

* Add zoom thumbwheels to Pane. Implement horizontal thumbwheel, and vertical depending on layer type (supported for waveform and spectrogram, though wrong for log-scale spectrogram at the moment). * Add bare bones of a spectrum layer. * Add window icon * Add shortcut for "insert time instant" on laptops without keypad enter (";") * Delete FFT processing thread when it exits (at least, next time we're asked for something interesting) * Get audio file extensions from the file readers, and thus from libsndfile for the wave file reader -- leads to rather a wide combo box in file dialog though * Better refresh order for spectrogram (redraw centre section first)
author Chris Cannam
date Fri, 04 Aug 2006 17:01:37 +0000
parents 33929e0c3c6b
children 53b9c7656798
comparison
equal deleted inserted replaced
132:5d3a483856ff 133:9e6b3e239b9d
260 { 260 {
261 if (m_gain == gain) return; 261 if (m_gain == gain) return;
262 m_gain = gain; 262 m_gain = gain;
263 m_cacheValid = false; 263 m_cacheValid = false;
264 emit layerParametersChanged(); 264 emit layerParametersChanged();
265 emit verticalZoomChanged();
265 } 266 }
266 267
267 void 268 void
268 WaveformLayer::setAutoNormalize(bool autoNormalize) 269 WaveformLayer::setAutoNormalize(bool autoNormalize)
269 { 270 {
1192 bool autoNormalize = (attributes.value("autoNormalize") == "1" || 1193 bool autoNormalize = (attributes.value("autoNormalize") == "1" ||
1193 attributes.value("autoNormalize") == "true"); 1194 attributes.value("autoNormalize") == "true");
1194 setAutoNormalize(autoNormalize); 1195 setAutoNormalize(autoNormalize);
1195 } 1196 }
1196 1197
1197 #ifdef INCLUDE_MOCFILES 1198 int
1198 #include "WaveformLayer.moc.cpp" 1199 WaveformLayer::getVerticalZoomSteps(int &defaultStep) const
1199 #endif 1200 {
1200 1201 defaultStep = 50;
1202 return 100;
1203 }
1204
1205 int
1206 WaveformLayer::getCurrentVerticalZoomStep() const
1207 {
1208 int val = lrint(log10(m_gain) * 20.0) + 50;
1209 if (val < 0) val = 0;
1210 if (val > 100) val = 100;
1211 return val;
1212 }
1213
1214 void
1215 WaveformLayer::setVerticalZoomStep(int step)
1216 {
1217 setGain(pow(10, float(step - 50) / 20.0));
1218 }
1219