From 0310a173af8eb2c5446188eca2df2271a9605bad Mon Sep 17 00:00:00 2001 From: Maurizio Gavioli Date: Wed, 19 Sep 2012 19:38:25 +0200 Subject: [PATCH] Fix #18220: Tablature::fretChord() was ignoring multiple notes of equal pitch --- libmscore/tablature.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libmscore/tablature.cpp b/libmscore/tablature.cpp index ba84138cc9..3cf6181e12 100644 --- a/libmscore/tablature.cpp +++ b/libmscore/tablature.cpp @@ -169,8 +169,16 @@ void Tablature::fretChord(Chord * chord) const bUsed[nString] = false; // we also need the notes sorted in order of string (from highest to lowest) and then pitch QMap sortedNotes; - foreach(Note * note, chord->notes()) - sortedNotes.insert(note->string()*1000 - note->pitch(), note); + int idx = 0; + int key; + foreach(Note * note, chord->notes()) { + key = note->string()*100000; + if(key < 0) // in case string is -1 + key = -key; + key -= note->pitch() * 100 + idx; // disambiguate notes of equal pitch + sortedNotes.insert(key, note); + idx++; + } // scan chord notes from highest, matching with strings from the highest foreach(Note * note, sortedNotes) {