Mercurial > hg > svcore
diff base/Pitch.cpp @ 1527:710e6250a401 zoom
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 17 Sep 2018 13:51:14 +0100 |
parents | 48e9f538e6e9 |
children |
line wrap: on
line diff
--- a/base/Pitch.cpp Mon Dec 12 15:18:52 2016 +0000 +++ b/base/Pitch.cpp Mon Sep 17 13:51:14 2018 +0100 @@ -21,8 +21,8 @@ double Pitch::getFrequencyForPitch(int midiPitch, - double centsOffset, - double concertA) + double centsOffset, + double concertA) { if (concertA <= 0.0) { concertA = Preferences::getInstance()->getTuningFrequency(); @@ -33,8 +33,8 @@ int Pitch::getPitchForFrequency(double frequency, - double *centsOffsetReturn, - double concertA) + double *centsOffsetReturn, + double concertA) { if (concertA <= 0.0) { concertA = Preferences::getInstance()->getTuningFrequency(); @@ -45,12 +45,12 @@ double centsOffset = (p - midiPitch) * 100.0; if (centsOffset >= 50.0) { - midiPitch = midiPitch + 1; - centsOffset = -(100.0 - centsOffset); + midiPitch = midiPitch + 1; + centsOffset = -(100.0 - centsOffset); } if (centsOffset < -50.0) { - midiPitch = midiPitch - 1; - centsOffset = (100.0 + centsOffset); + midiPitch = midiPitch - 1; + centsOffset = (100.0 + centsOffset); } if (centsOffsetReturn) *centsOffsetReturn = centsOffset; @@ -80,8 +80,8 @@ double centsOffset = (p - midiPitch) * 100.0; if (centsOffset >= 50.0) { - midiPitch = midiPitch + 1; - centsOffset = -(100.0 - centsOffset); + midiPitch = midiPitch + 1; + centsOffset = -(100.0 - centsOffset); } if (centsOffsetReturn) *centsOffsetReturn = centsOffset; @@ -120,12 +120,12 @@ // spelled from a MIDI pitch + flats flag in isolation. if (midiPitch < 0) { - while (midiPitch < 0) { - midiPitch += 12; - --octave; - } + while (midiPitch < 0) { + midiPitch += 12; + --octave; + } } else { - octave = midiPitch / 12 + baseOctave; + octave = midiPitch / 12 + baseOctave; } note = midiPitch % 12; @@ -133,8 +133,8 @@ QString Pitch::getPitchLabel(int midiPitch, - double centsOffset, - bool useFlats) + double centsOffset, + bool useFlats) { int note, octave; getNoteAndOctaveForPitch(midiPitch, note, octave); @@ -149,8 +149,8 @@ QString Pitch::getPitchLabelForFrequency(double frequency, - double concertA, - bool useFlats) + double concertA, + bool useFlats) { if (concertA <= 0.0) { concertA = Preferences::getInstance()->getTuningFrequency();