diff --git a/src/project/internal/notationproject.cpp b/src/project/internal/notationproject.cpp index 3191544..c8e22d0 100644 --- a/src/project/internal/notationproject.cpp +++ b/src/project/internal/notationproject.cpp @@ -331,6 +331,13 @@ Ret NotationProject::doImport(const muse::io::path_t& path, const OpenParams& op return ret; } + //! NOTE Like the native readers (engraving/rw/read*/read*.cpp), make sure every instrument channel has a + //! MIDI mapping. Importers only add one when the file names a MIDI channel (MusicXML ), + //! so it can stay empty, and Part::midiPort() / midiChannel() (used e.g. by the MusicXML exporter) then + //! index the mapping with -1: out of bounds (in WebAssembly a trap, "memory access out of bounds"). + score->rebuildMidiMapping(); + score->updateChannel(); + if (openParams.unrollRepeats && score->repeatList().size() > 1) { MasterScore* original = score; score = original->unrollRepeats();