comparison layer/WaveformLayer.cpp @ 362:a9dfa2d6d5ac

* Add pitch range in octaves, semitones and cents to the measurement rect as well as in Hz * Avoid crash when adding time ruler This commit contains a lot of debug output (will be slow)
author Chris Cannam
date Wed, 06 Feb 2008 16:21:29 +0000
parents 2f83b6e3b8ca
children 26ce2fb7bcbf
comparison
equal deleted inserted replaced
361:67834ac56f2b 362:a9dfa2d6d5ac
662 } 662 }
663 } 663 }
664 664
665 if (int(modelZoomLevel) != zoomLevel) { 665 if (int(modelZoomLevel) != zoomLevel) {
666 666
667 std::cerr << "WaveformLayer::paint: zoom level " << zoomLevel << " differs from model zoom level " << modelZoomLevel << std::endl;
668 std::cerr << "index from " << index;
669
667 index = size_t((double(index) * zoomLevel) / modelZoomLevel); 670 index = size_t((double(index) * zoomLevel) / modelZoomLevel);
671
672 std::cerr << " to " << index << std::endl;
668 673
669 if (int(modelZoomLevel) < zoomLevel) { 674 if (int(modelZoomLevel) < zoomLevel) {
670 // Peaks may be missed! The model should avoid 675 // Peaks may be missed! The model should avoid
671 // this by rounding zoom levels up rather than 676 // this by rounding zoom levels up rather than
672 // down, but we'd better cope in case it doesn't 677 // down, but we'd better cope in case it doesn't
673 maxIndex = index; 678 maxIndex = index;
674 } else { 679 } else {
675 maxIndex = size_t((double(index + 1) * zoomLevel) 680 maxIndex = size_t((double(index + 1) * zoomLevel)
676 / modelZoomLevel) - 1; 681 / modelZoomLevel) - 1;
677 } 682 }
683
684 std::cerr << "maxIndex = " << maxIndex << std::endl;
678 } 685 }
679 686
680 if (ranges && index < ranges->size()) { 687 if (ranges && index < ranges->size()) {
681 688
682 range = (*ranges)[index]; 689 range = (*ranges)[index];