changeset 105:571805759a66

* 1502816 file export is too slow and memory-hungry Use text stream when writing to file instead of accumulating into a string. * 1500625 Auto-align in MIDI layer confusing Make value extents convert to Hz in return value * 1494623: Duplicate display of frame 0 from vamp plugin output
author Chris Cannam
date Thu, 15 Jun 2006 15:48:05 +0000
parents 1348818e7be7
children 551d7ae05526
files layer/Colour3DPlotLayer.cpp layer/NoteLayer.cpp
diffstat 2 files changed, 19 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp	Thu Jun 15 12:28:47 2006 +0000
+++ b/layer/Colour3DPlotLayer.cpp	Thu Jun 15 15:48:05 2006 +0000
@@ -363,7 +363,15 @@
 
     for (int x = x0; x < x1; ++x) {
 
-        float sx0 = (float(v->getFrameForX(x)) - modelStart) / modelWindow;
+        long xf = v->getFrameForX(x);
+        if (xf < 0) {
+            for (int y = 0; y < h; ++y) {
+                img.setPixel(x - x0, y, m_cache->color(0));
+            }
+            continue;
+        }
+
+        float sx0 = (float(xf) - modelStart) / modelWindow;
         float sx1 = (float(v->getFrameForX(x+1)) - modelStart) / modelWindow;
             
         int sx0i = int(sx0 + 0.001);
--- a/layer/NoteLayer.cpp	Thu Jun 15 12:28:47 2006 +0000
+++ b/layer/NoteLayer.cpp	Thu Jun 15 15:48:05 2006 +0000
@@ -225,8 +225,11 @@
     min = m_model->getValueMinimum();
     max = m_model->getValueMaximum();
 
-    if (shouldConvertMIDIToHz()) unit = "Hz";
-    else unit = m_model->getScaleUnits();
+    if (shouldConvertMIDIToHz()) {
+        unit = "Hz";
+        min = Pitch::getFrequencyForPitch(lrintf(min));
+        max = Pitch::getFrequencyForPitch(lrintf(max + 1));
+    } else unit = m_model->getScaleUnits();
 
     if (m_verticalScale == MIDIRangeScale ||
         m_verticalScale == LogScale) logarithmic = true;
@@ -478,12 +481,15 @@
                 max = Pitch::getFrequencyForPitch(lrintf(max + 1));
             }
 
+            std::cerr << "NoteLayer[" << this << "]::getScaleExtents: min = " << min << ", max = " << max << ", log = " << log << std::endl;
+
         } else if (log) {
 
-//            std::cerr << "NoteLayer[" << this << "]::getScaleExtents: min = " << min << ", max = " << max << ", log = " << log << std::endl;
-
             min = (min < 0.0) ? -log10(-min) : (min == 0.0) ? 0.0 : log10(min);
             max = (max < 0.0) ? -log10(-max) : (max == 0.0) ? 0.0 : log10(max);
+
+            std::cerr << "NoteLayer[" << this << "]::getScaleExtents: min = " << min << ", max = " << max << ", log = " << log << std::endl;
+
         }
 
     } else {