From b3141d2195fa20cde5b0b1dc8610a2fa43a9eaf1 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 3 May 2013 19:44:58 +0200 Subject: Fixed sample sorting. --- dgedit/samplesorter.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dgedit/samplesorter.cc b/dgedit/samplesorter.cc index a2ec3dc..71b1654 100644 --- a/dgedit/samplesorter.cc +++ b/dgedit/samplesorter.cc @@ -91,6 +91,7 @@ Levels SampleSorter::levels() { Levels lvls; + // Sort the segmentation lines: for(int i = 0; i < threshold.size(); i++) { for(int j = 0; j < threshold.size(); j++) { if(threshold[i] < threshold[j]) { @@ -101,16 +102,16 @@ Levels SampleSorter::levels() } } - + // for(int i = -1; i < threshold.size(); i++) { Level lvl; if(i == -1) lvl.velocity = 0; - else lvl.velocity = threshold[i]; + else lvl.velocity = threshold[i] * threshold[i]; float next; if(i == threshold.size() - 1) next = 1.0; - else next = threshold[i+1]; + else next = threshold[i+1] * threshold[i+1]; QMap::iterator si = sorted.begin(); while(si != sorted.end()) { @@ -203,7 +204,7 @@ void SampleSorter::paintEvent(QPaintEvent *event) else painter.setPen(colPt); painter.drawLine(mapX(threshold[i]), 0, mapX(threshold[i]), height()); char valstr[32]; - sprintf(valstr, "%.3f", threshold[i]); + sprintf(valstr, "%.3f", threshold[i] * threshold[i]); painter.setPen(colVel); painter.drawText(mapX(threshold[i]), height(), valstr); } -- cgit v1.2.3