Sunday, 13 January 2013

Going for it, oops - nasty bug

Having completed the artwork and refactoring of the code for rests, it was time to force the issue, so went public on facebook with DrumScore, looking for friendly fire feedback for the first iteration.

There's so many different things I could work on next I really want the opinion of those who might use it as to what's most important to work on.

Then I find nasty bug. Nasty because it impact the ability to load a saved score back in, and worse still the issue is in the way the score was saved, so it's not a case of just fixing load code.

Turns out the way that ties are implemented, ie a list of JTie objects on each note that is at the head or tail of a tie works really well to support moving the tie end with the note, the primary objective, but when I come to iterate the list on each note, the list of JTie's order is indeterminate. This means my implementation of a depth counter for ties in the XML that represents the saved notes doesn't work.

In order for it to work, if a note is at the end of one tie, and is at the start of another, we would have to process the JTie which represents the close of the first tie, and thus decrementing the depth counter, before processing the JTie which represents the start of the second tie, and thus increments the counter.

In short, we risk bumping up the counter before down, meaning instead of closing tie 1 in the xml we start tie 2, and then process the close which is stored as closing tie 2, as that's where the counter was at.

Going to need to sort the JTie list with a custom comparator before storing it. More to come on this!

No comments:

Post a Comment