Closed Scowluga closed 3 years ago
Great. There's definitely a lot of rough edges. Edge cases, logging, testing. But I think with this PR most of the functionality itself will be "working". Then we can iron out details. One step at a time!
Will merge and aim to make future PRs smaller.
This PR refactors the entire importer as set up in the first PR. The diff is virtually meaningless due to so many refactors. But the majority of the code is new anyways. All changes are open to discussion and improvement. The number of line changes looks scary, but most of it is just exported MusicXML files from MuseScore for testing.
Overall Importer Changes
File Organization
client/interop/musicxml/importer
which is logical.Importer State
[]model.ScoreUpdate
.[]model.ScoreUpdate
for each voice. EachelementHandler
modifies this as necessary.musicXMLImporter
now also supports various helper methods.Nested Index
[]model.ScoreUpdate
can containmodel.Chord
structs and potentially other structs with nested elements. Then I've created anestedIndex
class that can contain this information. I also added various helpers all innested_index.go
.noteHandler
and you will see how I use these for dealing with chords & ties.Post Processing
[]model.ScoreUpdate
returned by the importer is not ideal. There are various changes that can be made to generate more idiomatic Alda.post_process.go
. This work is quite straightforward and low priority, so will be completed after the important tags are handled.New Handled Tags
Barlines
Chords
Ties
findWithState
.getOctaveChange
).ties2
andties3
tests which are non-trivial.Voices
ties2
.Slurs
Dotted notes
Parts
midi-program
attribute and get the MIDI instrument number then convert it to a name.