the fix is really simple and it involves following changes in exportxml.cpp
1. modifying scoreInstrument
1. add the const Instrument* instr in the signature
2. add the xml.tag instrument-sound with the instr→instrumentId() if this is not empty.
2. modifying the places that call scoreInstrument by adding the pointer to the instrument object
2.1 line 5889 scoreInstrument(xml, idx + 1, i + 1, di.name,di);
2.2 line 5891 scoreInstrument(xml, idx + 1, i + 1, QString("Instrument %1").arg(i + 1),di);
2.3 line 5907 scoreInstrument(xml, idx + 1, instNr + 1, MScoreTextToMXML::toPlainText(rim.value(instNr)->trackName()),rim.value(instNr));
That's it. The new exportxml.cpp is attached .
Unfortunately I am having issues with the compilation (Mac OS...) however at least here the work is saved somehow and perhaps could be useful also to others.
By the way, the same fix needs to be applied also to the master branch (4.x) and there of course the line numbers are different but the content the same.
DrumSet actually cannot be mapped to Instrument. It has also no sound-instrument information stored and therefore the most appropriate way to handle that case is to simply pass a nullptr.
Hmm, now also many (MusicXML) regression tests need to get adjusted. A lot of work, but also a good sign, showing that the change really does what it should do
Comments
i'm implementing the fix
the fix is really simple and it involves following changes in exportxml.cpp
1. modifying scoreInstrument
1. add the const Instrument* instr in the signature
2. add the xml.tag instrument-sound with the instr→instrumentId() if this is not empty.
2. modifying the places that call scoreInstrument by adding the pointer to the instrument object
2.1 line 5889 scoreInstrument(xml, idx + 1, i + 1, di.name,di);
2.2 line 5891 scoreInstrument(xml, idx + 1, i + 1, QString("Instrument %1").arg(i + 1),di);
2.3 line 5907 scoreInstrument(xml, idx + 1, instNr + 1, MScoreTextToMXML::toPlainText(rim.value(instNr)->trackName()),rim.value(instNr));
That's it. The new exportxml.cpp is attached .
Unfortunately I am having issues with the compilation (Mac OS...) however at least here the work is saved somehow and perhaps could be useful also to others.
By the way, the same fix needs to be applied also to the master branch (4.x) and there of course the line numbers are different but the content the same.
In reply to the fix is really simple and… by lucatoldo
Can you also post a
git diff
output?In reply to Can you also post a git diff… by Jojo-Schmitz
here attached for version 4.0 however it is not properly handling DrumInstrument
How about simply this:
thankyou, yes absolutely safer
DrumSet actually cannot be mapped to Instrument. It has also no sound-instrument information stored and therefore the most appropriate way to handle that case is to simply pass a nullptr.
scoreInstrument(xml, static_cast(idx) + 1, i + 1, di.name, nullptr );
scoreInstrument(xml, static_cast(idx) + 1, i + 1, QString("Instrument %1").arg(i + 1), nullptr);
ok ?
attached the diff.txt
Or don't change those lines and rely on the default arg, that's what it is good for.
So let's stick with my diff above
See https://github.com/musescore/MuseScore/pull/12680 (for master)
(and soon https://github.com/musescore/MuseScore/pull/9000, for 3,x)
Hmm, now also many (MusicXML) regression tests need to get adjusted. A lot of work, but also a good sign, showing that the change really does what it should do
Fixed in branch master, commit cc8e2c7291
Fix #334025: Export missing instrument-sound tag
Fixed in branch master, commit 29e96ff724
_Merge pull request #12680 from Jojo-Schmitz/musicxml_instrument-sound
[MU4] Fix #334025: Export missing instrument-sound tag_
Automatically closed -- issue fixed for 2 weeks with no activity.