diff --git a/importexport/musicxml/importmxmlpass1.cpp b/importexport/musicxml/importmxmlpass1.cpp index ac06c2bf877c8..f33bc26336752 100644 --- a/importexport/musicxml/importmxmlpass1.cpp +++ b/importexport/musicxml/importmxmlpass1.cpp @@ -2009,6 +2009,11 @@ void MusicXMLParserPass1::scoreInstrument(const QString& partId) if (_instruments[partId].contains(instrId)) _instruments[partId][instrId].name = instrName; } + else if (_e.name() == "instrument-abbreviation") { + QString abbreviation = _e.readElementText(); + if (_instruments[partId].contains(instrId)) + _instruments[partId][instrId].abbreviation = abbreviation; + } else if (_e.name() == "instrument-sound") { QString instrSound = _e.readElementText(); if (_instruments[partId].contains(instrId)) diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp index 5d349aaf93667..8b147ad78964a 100644 --- a/importexport/musicxml/importmxmlpass2.cpp +++ b/importexport/musicxml/importmxmlpass2.cpp @@ -455,7 +455,7 @@ static Instrument createInstrument(const MusicXMLInstrument& mxmlInstr, const In } if (!it) { - it = Ms::searchTemplateForInstrNameList({mxmlInstr.name}); + it = Ms::searchTemplateForInstrNameList({mxmlInstr.name, mxmlInstr.abbreviation}); } if (!it) { diff --git a/importexport/musicxml/musicxmlsupport.h b/importexport/musicxml/musicxmlsupport.h index 438626e614480..d0378a6a20d7e 100644 --- a/importexport/musicxml/musicxmlsupport.h +++ b/importexport/musicxml/musicxmlsupport.h @@ -132,6 +132,7 @@ struct MusicXMLInstrument { int unpitched; // midi-unpitched read from MusicXML QString name; // instrument-name read from MusicXML QString sound; // instrument-sound read from MusicXML + QString abbreviation; // instrument-abbreviation read from MusicXML QString virtLib; // virtual-library read from MusicXML QString virtName; // virtual-name read from MusicXML int midiChannel; // midi-channel read from MusicXML diff --git a/libmscore/instrtemplate.cpp b/libmscore/instrtemplate.cpp index 09113cb011e7e..4d3876e34d3f8 100644 --- a/libmscore/instrtemplate.cpp +++ b/libmscore/instrtemplate.cpp @@ -756,6 +756,9 @@ InstrumentTemplate* searchTemplateForInstrNameList(const QList& nameLis for (InstrumentGroup* g : qAsConst(instrumentGroups)) { for (InstrumentTemplate* it : qAsConst(g->instrumentTemplates)) { for (const QString& name : nameList) { + if (name.isEmpty()) + continue; + if (it->trackName == name || it->longNames.contains(StaffName(name)) || it->shortNames.contains(StaffName(name)))