diff --git a/importexport/musicxml/importmxmlnotepitch.cpp b/importexport/musicxml/importmxmlnotepitch.cpp index e97188107abb2..2af8be7a30efa 100644 --- a/importexport/musicxml/importmxmlnotepitch.cpp +++ b/importexport/musicxml/importmxmlnotepitch.cpp @@ -109,6 +109,7 @@ void mxmlNotePitch::pitch(QXmlStreamReader& e) // defaults _step = -1; _alter = 0; + _tuning = 0.0; _octave = -1; while (e.readNextStartElement()) { @@ -123,6 +124,10 @@ void mxmlNotePitch::pitch(QXmlStreamReader& e) if (ok2 && (qAbs(altervalue) < 2.0) && (_accType == AccidentalType::NONE)) { // try to see if a microtonal accidental is needed _accType = microtonalGuess(altervalue); + + // If it's not a microtonal accidental we will use tuning + if (_accType == AccidentalType::NONE) + _tuning = 100 * altervalue; } _alter = 0; } diff --git a/importexport/musicxml/importmxmlnotepitch.h b/importexport/musicxml/importmxmlnotepitch.h index 5f1986f26814d..6ea87d7918222 100644 --- a/importexport/musicxml/importmxmlnotepitch.h +++ b/importexport/musicxml/importmxmlnotepitch.h @@ -37,6 +37,7 @@ class mxmlNotePitch Accidental* acc() const { return _acc; } AccidentalType accType() const { return _accType; } int alter() const { return _alter; } + qreal tuning() const { return _tuning; } int displayOctave() const { return _displayOctave; } int displayStep() const { return _displayStep; } void displayStepOctave(QXmlStreamReader& e); @@ -48,6 +49,7 @@ class mxmlNotePitch Accidental* _acc = 0; // created based on accidental element AccidentalType _accType = AccidentalType::NONE; // set by pitch() based on alter value (can be microtonal) int _alter = 0; + qreal _tuning = 0.0; int _displayStep = -1; // invalid int _displayOctave = -1; // invalid int _octave = -1; diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp index 090e4f1a39c4b..4b16352bb2c34 100644 --- a/importexport/musicxml/importmxmlpass2.cpp +++ b/importexport/musicxml/importmxmlpass2.cpp @@ -234,7 +234,7 @@ static int MusicXMLStepAltOct2Pitch(int step, int alter, int octave) Note that n's staff and track have not been set yet */ -static void xmlSetPitch(Note* n, int step, int alter, int octave, const int octaveShift, const Instrument* const instr, Interval inferredTranspose = Interval(0)) +static void xmlSetPitch(Note* n, int step, int alter, qreal tuning, int octave, const int octaveShift, const Instrument* const instr, Interval inferredTranspose = Interval(0)) { //qDebug("xmlSetPitch(n=%p, step=%d, alter=%d, octave=%d, octaveShift=%d)", // n, step, alter, octave, octaveShift); @@ -258,6 +258,7 @@ static void xmlSetPitch(Note* n, int step, int alter, int octave, const int octa tpc2 = Ms::transposeTpc(tpc2, inferredTranspose, true); int tpc1 = Ms::transposeTpc(tpc2, combinedIntval, true); n->setPitch(pitch, tpc1, tpc2); + n->setTuning(tuning); //qDebug(" pitch=%d tpc1=%d tpc2=%d", n->pitch(), n->tpc1(), n->tpc2()); } @@ -5946,11 +5947,11 @@ static void setPitch(Note* note, MusicXMLParserPass1& pass1, const QString& part } else { //qDebug("disp step %d oct %d", displayStep, displayOctave); - xmlSetPitch(note, mnp.displayStep(), 0, mnp.displayOctave(), 0, instrument); + xmlSetPitch(note, mnp.displayStep(), 0, 0.0, mnp.displayOctave(), 0, instrument); } } else { - xmlSetPitch(note, mnp.step(), mnp.alter(), mnp.octave(), octaveShift, instrument, pass1.getMusicXmlPart(partId)._inferredTranspose); + xmlSetPitch(note, mnp.step(), mnp.alter(), mnp.tuning(), mnp.octave(), octaveShift, instrument, pass1.getMusicXmlPart(partId)._inferredTranspose); } }