Skip to content

Commit

Permalink
fix #85956: drum note altered by arrow changes pitch on reload
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella committed Nov 4, 2015
1 parent 59b72e6 commit 4450f75
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
5 changes: 4 additions & 1 deletion libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1223,8 +1223,11 @@ void Score::upDown(bool up, UpDownMode mode)
case StaffGroup::PERCUSSION:
{
const Drumset* ds = part->instrument()->drumset();
if (ds)
if (ds) {
newPitch = up ? ds->prevPitch(pitch) : ds->nextPitch(pitch);
newTpc1 = pitch2tpc(newPitch, Key::C, Prefer::NEAREST);
newTpc2 = newTpc1;
}
}
break;
case StaffGroup::TAB:
Expand Down
24 changes: 11 additions & 13 deletions libmscore/note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1184,26 +1184,24 @@ void Note::read(XmlReader& e)
// but since there are other causes of tpc corruption (eg, https://musescore.org/en/node/74746)
// including perhaps some we don't know about yet,
// we will attempt to fix some problems here regardless of version
if (!e.pasteMode() && !MScore::testMode) {
if (staff() && !staff()->isDrumStaff() && !e.pasteMode() && !MScore::testMode) {
int tpc1Pitch = (tpc2pitch(_tpc[0]) + 12) % 12;
int tpc2Pitch = (tpc2pitch(_tpc[1]) + 12) % 12;
int concertPitch = _pitch % 12;
if (tpc1Pitch != concertPitch) {
qDebug("bad tpc1 - concertPitch = %d, tpc1 = %d", concertPitch, tpc1Pitch);
_pitch += tpc1Pitch - concertPitch;
}
if (staff()) {
Interval v = staff()->part()->instrument(e.tick())->transpose();
int transposedPitch = (_pitch - v.chromatic) % 12;
if (tpc2Pitch != transposedPitch) {
qDebug("bad tpc2 - transposedPitch = %d, tpc2 = %d", transposedPitch, tpc2Pitch);
// just in case the staff transposition info is not reliable here,
// do not attempt to correct tpc
// except for older scores where we know there are tpc problems
if (score()->mscVersion() <= 206) {
v.flip();
_tpc[1] = Ms::transposeTpc(_tpc[0], v, true);
}
Interval v = staff()->part()->instrument(e.tick())->transpose();
int transposedPitch = (_pitch - v.chromatic) % 12;
if (tpc2Pitch != transposedPitch) {
qDebug("bad tpc2 - transposedPitch = %d, tpc2 = %d", transposedPitch, tpc2Pitch);
// just in case the staff transposition info is not reliable here,
// do not attempt to correct tpc
// except for older scores where we know there are tpc problems
if (score()->mscVersion() <= 206) {
v.flip();
_tpc[1] = Ms::transposeTpc(_tpc[0], v, true);
}
}
}
Expand Down

0 comments on commit 4450f75

Please sign in to comment.