diff layer/SpectrogramLayer.cpp @ 592:a13aa5320221 sonification

Extends the audio feedback of the piano scale to the Spectrum layer (horizontal piano keyboard). Increase of the piano keyboard width (SpectrogramLayer) and height (SpectrumLayer) for layout purposes. A get method should be added to obtain the scale size parameter outside the layer class.
author mathieub <mathieu.barthet@eecs.qmul.ac.uk>
date Wed, 06 Jul 2011 18:05:42 +0100
parents 0946feb81b79
children c080d14ff414
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp	Fri Jun 24 16:42:48 2011 +0100
+++ b/layer/SpectrogramLayer.cpp	Wed Jul 06 18:05:42 2011 +0100
@@ -3274,7 +3274,8 @@
     int fw = paint.fontMetrics().width(tr("43Hz"));
     if (tw < fw) tw = fw;
 
-    int tickw = (m_frequencyScale == LogFrequencyScale ? 10 : 4);
+    //int tickw = (m_frequencyScale == LogFrequencyScale ? 10 : 4);
+    int tickw = (m_frequencyScale == LogFrequencyScale ? 20 : 4);
     
     return cw + tickw + tw + 13;
 }
@@ -3292,8 +3293,11 @@
 
     int h = rect.height(), w = rect.width();
 
-    int tickw = (m_frequencyScale == LogFrequencyScale ? 10 : 4);
-    int pkw = (m_frequencyScale == LogFrequencyScale ? 10 : 0);
+    //int tickw = (m_frequencyScale == LogFrequencyScale ? 10 : 4);
+    //int pkw = (m_frequencyScale == LogFrequencyScale ? 10 : 0);
+
+    int tickw = (m_frequencyScale == LogFrequencyScale ? 20 : 4);
+    int pkw = (m_frequencyScale == LogFrequencyScale ? 20 : 0);
 
     size_t bins = m_fftSize / 2;
     int sr = m_model->getSampleRate();
@@ -3798,7 +3802,9 @@
 
         std::cerr<< "Frequency: " << freq << " " << unit.toStdString() << " (midi pitch = " << midipitch << ")" << std::endl;
 
-        v->playExampleNote(midipitch);
+        if ((midipitch>=0)&&(midipitch<127)) {
+            v->playExampleNote(midipitch);
+        }
 
         return true;