Merge pull request #2058 from Igevorse/bugs

fix #64696: MusicXML MIDI port export for Instrument Change element
This commit is contained in:
Nicolas Froment 2015-06-13 10:59:30 +02:00
commit 520b62b6e4
4 changed files with 2818 additions and 2 deletions

View file

@ -4465,8 +4465,13 @@ void ExportMusicXml::write(QIODevice* dev)
foreach(int instNr, rim.keys()) {
scoreInstrument(xml, idx + 1, instNr + 1, MScoreTextToMXML::toPlainText(rim.value(instNr)->trackName()));
}
foreach(int instNr, rim.keys()) {
xml.tag(QString("midi-device %1 port=\"%2\"").arg(instrId(idx+1, instNr + 1)).arg(part->midiPort() + 1), "");
for (auto ii = rim.constBegin(); ii != rim.constEnd(); ii++) {
int instNr = ii.key();
int midiPort = part->midiPort() + 1;
if (ii.value()->channel().size() > 0)
midiPort = score()->midiMapping(ii.value()->channel(0)->channel)->port + 1;
xml.tag(QString("midi-device %1 port=\"%2\"").arg(instrId(idx+1, instNr + 1)).arg(midiPort), "");
midiInstrument(xml, idx + 1, instNr + 1, rim.value(instNr), _score);
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -39,6 +39,7 @@ class TestMxmlIO : public QObject, public MTest
void mxmlIoTest(const char* file);
void mxmlIoTestRef(const char* file);
void mxmlMscxExportTestRef(const char* file);
void mxmlReadTestCompr(const char* file);
void mxmlReadWriteTestCompr(const char* file);
@ -92,6 +93,7 @@ private slots:
void helloReadWriteCompr() { mxmlReadWriteTestCompr("testHello"); }
void implicitMeasure1() { mxmlIoTest("testImplicitMeasure1"); }
void incorrectStaffNumber() { mxmlIoTestRef("testIncorrectStaffNumber"); }
void instrumentChangeMIDIportExport() { mxmlMscxExportTestRef("testInstrumentChangeMIDIportExport"); }
void invisibleElements() { mxmlIoTest("testInvisibleElements"); }
void keysig1() { mxmlIoTest("testKeysig1"); }
void keysig2() { mxmlIoTest("testKeysig2"); }
@ -252,6 +254,25 @@ void TestMxmlIO::mxmlIoTestRef(const char* file)
delete score;
}
//---------------------------------------------------------
// mxmlMscxExportTestRef
// read a MuseScore mscx file, write to a MusicXML file and verify against reference
//---------------------------------------------------------
void TestMxmlIO::mxmlMscxExportTestRef(const char* file)
{
MScore::debugMode = true;
preferences.musicxmlExportBreaks = MusicxmlExportBreaks::MANUAL;
preferences.musicxmlExportLayout = false;
Score* score = readScore(DIR + file + ".mscx");
QVERIFY(score);
fixupScore(score);
score->doLayout();
QVERIFY(saveMusicXml(score, QString(file) + ".xml"));
QVERIFY(saveCompareMusicXmlScore(score, QString(file) + ".xml", DIR + file + "_ref.xml"));
delete score;
}
//---------------------------------------------------------
// mxmlReadTestCompr
// read a compressed MusicXML file, write to a new file and verify against reference