diff 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
line wrap: on
line diff
--- a/layer/WaveformLayer.cpp	Thu Aug 03 15:40:11 2006 +0000
+++ b/layer/WaveformLayer.cpp	Fri Aug 04 17:01:37 2006 +0000
@@ -262,6 +262,7 @@
     m_gain = gain;
     m_cacheValid = false;
     emit layerParametersChanged();
+    emit verticalZoomChanged();
 }
 
 void
@@ -1194,7 +1195,25 @@
     setAutoNormalize(autoNormalize);
 }
 
-#ifdef INCLUDE_MOCFILES
-#include "WaveformLayer.moc.cpp"
-#endif
+int
+WaveformLayer::getVerticalZoomSteps(int &defaultStep) const
+{
+    defaultStep = 50;
+    return 100;
+}
 
+int
+WaveformLayer::getCurrentVerticalZoomStep() const
+{
+    int val = lrint(log10(m_gain) * 20.0) + 50;
+    if (val < 0) val = 0;
+    if (val > 100) val = 100;
+    return val;
+}
+
+void
+WaveformLayer::setVerticalZoomStep(int step)
+{
+    setGain(pow(10, float(step - 50) / 20.0));
+}
+