comparison layer/NoteLayer.cpp @ 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 0f36cdf407a6
children 4a6e6aedf632
comparison
equal deleted inserted replaced
104:1348818e7be7 105:571805759a66
223 { 223 {
224 if (!m_model) return false; 224 if (!m_model) return false;
225 min = m_model->getValueMinimum(); 225 min = m_model->getValueMinimum();
226 max = m_model->getValueMaximum(); 226 max = m_model->getValueMaximum();
227 227
228 if (shouldConvertMIDIToHz()) unit = "Hz"; 228 if (shouldConvertMIDIToHz()) {
229 else unit = m_model->getScaleUnits(); 229 unit = "Hz";
230 min = Pitch::getFrequencyForPitch(lrintf(min));
231 max = Pitch::getFrequencyForPitch(lrintf(max + 1));
232 } else unit = m_model->getScaleUnits();
230 233
231 if (m_verticalScale == MIDIRangeScale || 234 if (m_verticalScale == MIDIRangeScale ||
232 m_verticalScale == LogScale) logarithmic = true; 235 m_verticalScale == LogScale) logarithmic = true;
233 236
234 return true; 237 return true;
476 if (shouldConvertMIDIToHz()) { 479 if (shouldConvertMIDIToHz()) {
477 min = Pitch::getFrequencyForPitch(lrintf(min)); 480 min = Pitch::getFrequencyForPitch(lrintf(min));
478 max = Pitch::getFrequencyForPitch(lrintf(max + 1)); 481 max = Pitch::getFrequencyForPitch(lrintf(max + 1));
479 } 482 }
480 483
484 std::cerr << "NoteLayer[" << this << "]::getScaleExtents: min = " << min << ", max = " << max << ", log = " << log << std::endl;
485
481 } else if (log) { 486 } else if (log) {
482
483 // std::cerr << "NoteLayer[" << this << "]::getScaleExtents: min = " << min << ", max = " << max << ", log = " << log << std::endl;
484 487
485 min = (min < 0.0) ? -log10(-min) : (min == 0.0) ? 0.0 : log10(min); 488 min = (min < 0.0) ? -log10(-min) : (min == 0.0) ? 0.0 : log10(min);
486 max = (max < 0.0) ? -log10(-max) : (max == 0.0) ? 0.0 : log10(max); 489 max = (max < 0.0) ? -log10(-max) : (max == 0.0) ? 0.0 : log10(max);
490
491 std::cerr << "NoteLayer[" << this << "]::getScaleExtents: min = " << min << ", max = " << max << ", log = " << log << std::endl;
492
487 } 493 }
488 494
489 } else { 495 } else {
490 496
491 min = m_model->getValueMinimum(); 497 min = m_model->getValueMinimum();