diff --git a/mscore/importxml.cpp b/mscore/importxml.cpp index bc18445f2880a..7448ec9078547 100644 --- a/mscore/importxml.cpp +++ b/mscore/importxml.cpp @@ -1964,12 +1964,13 @@ Measure* MusicXml::xmlMeasure(Part* part, QDomElement e, int number, int measure if (implicit == "yes") measure->setIrregular(true); + int cv = 0; // current voice for chords, default is 0 for (e = e.firstChildElement(); !e.isNull(); e = e.nextSiblingElement()) { if (e.tagName() == "attributes") xmlAttributes(measure, staff, e.firstChildElement()); else if (e.tagName() == "note") { - xmlNote(measure, staff, part->id(), beam, e); + xmlNote(measure, staff, part->id(), beam, cv, e); moveTick(measure->tick(), tick, maxtick, noteTypeTickFr, divisions, e); #ifdef DEBUG_TICK qDebug(" after inserting note tick=%d", tick); @@ -4424,7 +4425,7 @@ static FiguredBass* findLastFiguredBass(int track, Segment* seg) \a Staff is the number of first staff of the part this note belongs to. */ -void MusicXml::xmlNote(Measure* measure, int staff, const QString& partId, Beam*& beam, QDomElement e) +void MusicXml::xmlNote(Measure* measure, int staff, const QString& partId, Beam*& beam, int& currentVoice, QDomElement e) { int ticks = 0; #ifdef DEBUG_TICK @@ -4433,8 +4434,8 @@ void MusicXml::xmlNote(Measure* measure, int staff, const QString& partId, Beam* QDomNode pn = e; // TODO remove pn QDomElement org_e = e; // save e for later QDomElement domElemNotations; - voice = 0; - move = 0; + int voice = 0; + int move = 0; bool rest = false; int relStaff = 0; @@ -4480,6 +4481,13 @@ void MusicXml::xmlNote(Measure* measure, int staff, const QString& partId, Beam* // silently ignore others (will be handled later) } + // Bug fix for Sibelius 7.1.3 which does not write for notes with + if (!chord) + // remember voice + currentVoice = voice; + else + // use voice from last note w/o + voice = currentVoice; // Musicxml voices are counted for all staffs of an // instrument. They are not limited. In mscore voices are associated diff --git a/mscore/musicxml.h b/mscore/musicxml.h index 43b38fe65e212..a80925b637fcd 100644 --- a/mscore/musicxml.h +++ b/mscore/musicxml.h @@ -171,8 +171,6 @@ class MusicXml { TextLine* dashes[MAX_DASHES]; Tie* tie; - int voice; - int move; Volta* lastVolta; QDomDocument* doc; @@ -228,7 +226,7 @@ class MusicXml { QMap& defyLyrics, QList& unNumbrdLyrics); void xmlNotations(Note* note, ChordRest* cr, int trk, int ticks, QDomElement node); - void xmlNote(Measure*, int stave, const QString& partId, Beam*& beam, QDomElement node); + void xmlNote(Measure*, int stave, const QString& partId, Beam*& beam, int& currentVoice, QDomElement node); void xmlHarmony(QDomElement node, int tick, Measure* m, int staff); int xmlClef(QDomElement, int staffIdx, Measure*); diff --git a/mtest/musicxml/io/testChordNoVoice.xml b/mtest/musicxml/io/testChordNoVoice.xml new file mode 100644 index 0000000000000..b9a3d3dc7e442 --- /dev/null +++ b/mtest/musicxml/io/testChordNoVoice.xml @@ -0,0 +1,109 @@ + + + + + MuseScore testfile + Chord (no voice) + + + + MuseScore 0.7.0 + 2007-09-10 + + + + Sibelius 7.1.3 leaves out the voice element for notes with a chord flag. + In this case, don't assume a missing voice means voice 1, but simply + attach the note to the previous note or chord. + + + + + + + + + + + 1 + 1 + 78.7402 + 0 + + + + + + + 1 + + 0 + major + + + 2 + + G + 2 + + + F + 4 + + + + + G + 4 + + 1 + 1 + quarter + up + 1 + + + + + G + 5 + + 1 + quarter + up + 1 + + + 1 + + + + G + 2 + + 1 + 5 + quarter + up + 2 + + + + + G + 3 + + 1 + quarter + up + 2 + + + light-heavy + + + + diff --git a/mtest/musicxml/io/testChordNoVoice_ref.xml b/mtest/musicxml/io/testChordNoVoice_ref.xml new file mode 100644 index 0000000000000..9933e68d10df8 --- /dev/null +++ b/mtest/musicxml/io/testChordNoVoice_ref.xml @@ -0,0 +1,104 @@ + + + + + MuseScore testfile + Chord (no voice) + + + + MuseScore 0.7.0 + 2007-09-10 + + + + + + + + + + 1 + 1 + 78.7402 + 0 + + + + + + + 1 + + 0 + major + + + 2 + + G + 2 + + + F + 4 + + + + + G + 4 + + 1 + 1 + quarter + up + 1 + + + + + G + 5 + + 1 + 1 + quarter + up + 1 + + + 1 + + + + G + 2 + + 1 + 5 + quarter + up + 2 + + + + + G + 3 + + 1 + 5 + quarter + up + 2 + + + light-heavy + + + + diff --git a/mtest/musicxml/io/tst_mxml_io.cpp b/mtest/musicxml/io/tst_mxml_io.cpp index 13ebd2161ead5..c4aede7fb9a8d 100644 --- a/mtest/musicxml/io/tst_mxml_io.cpp +++ b/mtest/musicxml/io/tst_mxml_io.cpp @@ -52,6 +52,7 @@ private slots: void arpGliss2() { mxmlIoTest("testArpGliss2"); } void barStyles() { mxmlIoTest("testBarStyles"); } void chordDiagrams1() { mxmlIoTest("testChordDiagrams1"); } + void chordNoVoice() { mxmlIoTestRef("testChordNoVoice"); } void clefs1() { mxmlIoTest("testClefs1"); } void completeMeasureRests() { mxmlIoTest("testCompleteMeasureRests"); } void dalSegno() { mxmlIoTest("testDalSegno"); } diff --git a/test/musicxml/testChordNoVoice.xml b/test/musicxml/testChordNoVoice.xml new file mode 100644 index 0000000000000..b9a3d3dc7e442 --- /dev/null +++ b/test/musicxml/testChordNoVoice.xml @@ -0,0 +1,109 @@ + + + + + MuseScore testfile + Chord (no voice) + + + + MuseScore 0.7.0 + 2007-09-10 + + + + Sibelius 7.1.3 leaves out the voice element for notes with a chord flag. + In this case, don't assume a missing voice means voice 1, but simply + attach the note to the previous note or chord. + + + + + + + + + + + 1 + 1 + 78.7402 + 0 + + + + + + + 1 + + 0 + major + + + 2 + + G + 2 + + + F + 4 + + + + + G + 4 + + 1 + 1 + quarter + up + 1 + + + + + G + 5 + + 1 + quarter + up + 1 + + + 1 + + + + G + 2 + + 1 + 5 + quarter + up + 2 + + + + + G + 3 + + 1 + quarter + up + 2 + + + light-heavy + + + + diff --git a/test/musicxml/testChordNoVoice_ref.xml b/test/musicxml/testChordNoVoice_ref.xml new file mode 100644 index 0000000000000..9933e68d10df8 --- /dev/null +++ b/test/musicxml/testChordNoVoice_ref.xml @@ -0,0 +1,104 @@ + + + + + MuseScore testfile + Chord (no voice) + + + + MuseScore 0.7.0 + 2007-09-10 + + + + + + + + + + 1 + 1 + 78.7402 + 0 + + + + + + + 1 + + 0 + major + + + 2 + + G + 2 + + + F + 4 + + + + + G + 4 + + 1 + 1 + quarter + up + 1 + + + + + G + 5 + + 1 + 1 + quarter + up + 1 + + + 1 + + + + G + 2 + + 1 + 5 + quarter + up + 2 + + + + + G + 3 + + 1 + 5 + quarter + up + 2 + + + light-heavy + + + + diff --git a/test/musicxml/testfiles_MusicXML_with_ref b/test/musicxml/testfiles_MusicXML_with_ref index c4173e139e9ff..097ef7352f6e3 100644 --- a/test/musicxml/testfiles_MusicXML_with_ref +++ b/test/musicxml/testfiles_MusicXML_with_ref @@ -1,3 +1,4 @@ +testChordNoVoice.xml testDurationRoundingError.xml testDynamics3.xml testEmptyMeasure.xml