Mercurial > hg > svgui
diff layer/WaveformLayer.cpp @ 680:ced5f158eda7 tonioni
Merge from default branch
author | Chris Cannam |
---|---|
date | Fri, 22 Nov 2013 10:40:51 +0000 |
parents | b5d3dea6d869 |
children | 26c5f7fd4807 1a0dfcbffaf1 |
line wrap: on
line diff
--- a/layer/WaveformLayer.cpp Tue Jul 16 17:59:01 2013 +0100 +++ b/layer/WaveformLayer.cpp Fri Nov 22 10:40:51 2013 +0000 @@ -670,7 +670,7 @@ *ranges, modelZoomLevel); #ifdef DEBUG_WAVEFORM_PAINT - std::cerr << ranges->size() << " ranges from " << frame0 << " to " << frame1 << std::endl; + std::cerr << "channel " << ch << ": " << ranges->size() << " ranges from " << frame0 << " to " << frame1 << " at zoom level " << modelZoomLevel << std::endl; #endif if (mergingChannels || mixingChannels) { @@ -844,18 +844,18 @@ } if (x != x0 && prevRangeBottom != -1) { - if (prevRangeBottom > rangeBottom && - prevRangeTop > rangeBottom) { + if (prevRangeBottom > rangeBottom + 1 && + prevRangeTop > rangeBottom + 1) { // paint->setPen(midColour); paint->setPen(baseColour); - paint->drawLine(x-1, prevRangeTop, x, rangeBottom); + paint->drawLine(x-1, prevRangeTop, x, rangeBottom + 1); paint->setPen(prevRangeTopColour); paint->drawPoint(x-1, prevRangeTop); - } else if (prevRangeBottom < rangeTop && - prevRangeTop < rangeTop) { + } else if (prevRangeBottom < rangeTop - 1 && + prevRangeTop < rangeTop - 1) { // paint->setPen(midColour); paint->setPen(baseColour); - paint->drawLine(x-1, prevRangeBottom, x, rangeTop); + paint->drawLine(x-1, prevRangeBottom, x, rangeTop - 1); paint->setPen(prevRangeBottomColour); paint->drawPoint(x-1, prevRangeBottom); } @@ -874,7 +874,7 @@ } #ifdef DEBUG_WAVEFORM_PAINT - std::cerr << "range " << rangeBottom << " -> " << rangeTop << std::endl; + std::cerr << "range " << rangeBottom << " -> " << rangeTop << ", means " << meanBottom << " -> " << meanTop << ", raw range " << range.min() << " -> " << range.max() << std::endl; #endif if (rangeTop == rangeBottom) { @@ -990,11 +990,11 @@ max = range.max(); singleValue = (min == max); } else { - int imin = int(range.min() * 1000); - int imax = int(range.max() * 1000); + int imin = lrint(range.min() * 10000); + int imax = lrint(range.max() * 10000); singleValue = (imin == imax); - min = float(imin)/1000; - max = float(imax)/1000; + min = float(imin)/10000; + max = float(imax)/10000; } int db = int(AudioLevel::multiplier_to_dB(std::max(fabsf(range.min()),