[MusicXML] Wrong midi port when exporting Instrument Change
Ubuntu 15.04 x64, commit d8321d9.
Steps to reproduce:
1. Create a new score with 15 Piano instruments (Add->Instruments).
2. Add an Instrument Change element on the last Piano stave.
3. Export to MusicXML *.xml file.
4. Open the exported file in text editor, and take a look at the last entry of "<midi-device>": "<midi-device id="P15-I2"".
Expected: line "<midi-device id="P15-I2" port="2"></midi-device>"
Actually: line "<midi-device id="P15-I2" port="1"></midi-device>"
Now take a look at the first entry of "<midi-device>" tag: "<midi-device id="P1-I1" port="1"></midi-device>". It is our first piano instrument. It turned out that the first and the last instruments in a MusicXML file have the same MIDI port and channel: 1 1. It's impossible.
This happens because current implementation uses part->midiPort() to get the MIDI port of an Instrument Change, but part->midiPort() returns the MIDI port of the first instrument in the Part. In most cases it's ok, but it could be a big problem after implementing "Assigning MIDI channels to instruments" feature or in a case described above.
Comments
see https://github.com/musescore/MuseScore/pull/2058
Fixed in branch master, commit 71fc221b21
fix #64696: MusicXML MIDI port export for Instrument Change element
Fixed in branch master, commit 520b62b6e4
Merge pull request #2058 from Igevorse/bugs
fix #64696: MusicXML MIDI port export for Instrument Change element
Fixed in branch 2.0.2, commit dfc17ceb13
fix #64696: MusicXML MIDI port export for Instrument Change element
Automatically closed -- issue fixed for 2 weeks with no activity.