[MusicXML] Wrong midi port when exporting Instrument Change

• Jun 10, 2015 - 20:38
Type
Functional
Severity
S4 - Minor
Status
closed
Project

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