fix #85956: drum note altered by arrow changes pitch on reload

This commit is contained in:
Marc Sabatella 2015-11-04 08:22:24 -07:00
parent 59b72e646f
commit 4450f7576b
2 changed files with 15 additions and 14 deletions

View file

@ -1223,8 +1223,11 @@ void Score::upDown(bool up, UpDownMode mode)
case StaffGroup::PERCUSSION: case StaffGroup::PERCUSSION:
{ {
const Drumset* ds = part->instrument()->drumset(); const Drumset* ds = part->instrument()->drumset();
if (ds) if (ds) {
newPitch = up ? ds->prevPitch(pitch) : ds->nextPitch(pitch); newPitch = up ? ds->prevPitch(pitch) : ds->nextPitch(pitch);
newTpc1 = pitch2tpc(newPitch, Key::C, Prefer::NEAREST);
newTpc2 = newTpc1;
}
} }
break; break;
case StaffGroup::TAB: case StaffGroup::TAB:

View file

@ -1184,7 +1184,7 @@ void Note::read(XmlReader& e)
// but since there are other causes of tpc corruption (eg, https://musescore.org/en/node/74746) // 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, // including perhaps some we don't know about yet,
// we will attempt to fix some problems here regardless of version // 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 tpc1Pitch = (tpc2pitch(_tpc[0]) + 12) % 12;
int tpc2Pitch = (tpc2pitch(_tpc[1]) + 12) % 12; int tpc2Pitch = (tpc2pitch(_tpc[1]) + 12) % 12;
int concertPitch = _pitch % 12; int concertPitch = _pitch % 12;
@ -1192,18 +1192,16 @@ void Note::read(XmlReader& e)
qDebug("bad tpc1 - concertPitch = %d, tpc1 = %d", concertPitch, tpc1Pitch); qDebug("bad tpc1 - concertPitch = %d, tpc1 = %d", concertPitch, tpc1Pitch);
_pitch += tpc1Pitch - concertPitch; _pitch += tpc1Pitch - concertPitch;
} }
if (staff()) { Interval v = staff()->part()->instrument(e.tick())->transpose();
Interval v = staff()->part()->instrument(e.tick())->transpose(); int transposedPitch = (_pitch - v.chromatic) % 12;
int transposedPitch = (_pitch - v.chromatic) % 12; if (tpc2Pitch != transposedPitch) {
if (tpc2Pitch != transposedPitch) { qDebug("bad tpc2 - transposedPitch = %d, tpc2 = %d", transposedPitch, tpc2Pitch);
qDebug("bad tpc2 - transposedPitch = %d, tpc2 = %d", transposedPitch, tpc2Pitch); // just in case the staff transposition info is not reliable here,
// just in case the staff transposition info is not reliable here, // do not attempt to correct tpc
// do not attempt to correct tpc // except for older scores where we know there are tpc problems
// except for older scores where we know there are tpc problems if (score()->mscVersion() <= 206) {
if (score()->mscVersion() <= 206) { v.flip();
v.flip(); _tpc[1] = Ms::transposeTpc(_tpc[0], v, true);
_tpc[1] = Ms::transposeTpc(_tpc[0], v, true);
}
} }
} }
} }