Skip to content

Commit

Permalink
Fix #311792: Override alter tag with note tuning value if present
Browse files Browse the repository at this point in the history
Duplicate of musescore#6693
  • Loading branch information
infojunkie authored and Jojo-Schmitz committed Sep 3, 2021
1 parent 3a932b4 commit 94e4b34
Show file tree
Hide file tree
Showing 4 changed files with 850 additions and 5 deletions.
16 changes: 11 additions & 5 deletions importexport/musicxml/exportxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3305,11 +3305,17 @@ static void writePitch(XmlWriter& xml, const Note* const note, const bool useDru
default: break;
}
}
if (alter && !alter2)
xml.tag("alter", alter);
if (!alter && alter2)
xml.tag("alter", alter2);
// TODO what if both alter and alter2 are present? For Example: playing with transposing instruments
// Override accidental with explicit note tuning
auto tuning = note->tuning();
if (fabs(tuning) > 0.01)
alter2 = tuning / 100.0;
// `alter` represents the "regular" (Western) pitch which can be
// 0 (natural), 1 (sharp), -1 (flat), etc. or some other integer depending on transposing instruments.
// `alter2` represents a microtone or manually-adjusted note tuning.
// In MusicXML, These two values are merged in the same "alter" tag.
// https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-alter.htm
if (alter || alter2)
xml.tag("alter", alter + alter2);
xml.tag(useDrumset ? "display-octave" : "octave", octave);
xml.etag();
}
Expand Down
Loading

0 comments on commit 94e4b34

Please sign in to comment.