# HG changeset patch # User Chris Cannam # Date 1214988407 0 # Node ID ad4911230a66f8ffff8d3d81dc94fb70d0c1b329 # Parent 113cf8781bd12bc457343bdeebb256b674d78b0f * When displaying an absolute pitch range (number of semitones + number of cents) with a non-negative number of semitones, ensure that the number of cents is also non-negative. e.g. prefer 1+76c over 2-24c. In response to request from Craig Sapp diff -r 113cf8781bd1 -r ad4911230a66 base/Pitch.cpp --- a/base/Pitch.cpp Thu Jun 26 12:41:23 2008 +0000 +++ b/base/Pitch.cpp Wed Jul 02 08:46:47 2008 +0000 @@ -135,6 +135,19 @@ QString Pitch::getLabelForPitchRange(int semis, float cents) { + if (semis > 0) { + while (cents < 0.f) { + --semis; + cents += 100.f; + } + } + if (semis < 0) { + while (cents > 0.f) { + ++semis; + cents -= 100.f; + } + } + int ic = lrintf(cents); if (ic == 0) {