Musescore code design

• Feb 28, 2016 - 20:01

Hi,
Perhaps I will have the possibility to help with development.
First I'm trying to undertand the basic of the code organization.
I wonder if someody can explain the choice to organize in segments then divided in voices instead of voices divided in segments?
Or is there any document I could read explaining the rationale behind the current organization?
Thanks
Fred


Comments

In reply to by frfancha

In that case, let me guess at a reasonable answer:

It's very often necessary to know the complete list of things that happen at a given time slice, and also, ranges are defined in terms of a start and end time slice, plus the range of staves covered. Since the number of staves in a score is fixed (or at least, it changes only rarely), and usually very small in comparison to the number of time slices in a score, it seems most efficient to have a *list* of segments, each having an *array* of staves (or voices). Clearly, an array of segments wouldn't make sense - we are way too often adding and deleting segments from the middle of the score for that to be efficient. Whereas an array of staves/voices allows us to very quickly find what content a given voice has in a given segment.

Now, if we had an array of voices, each having a list of segments, certain operations might be easier - like finding the next note in a given voice - but that's hardly difficult or inefficient now. Whereas finding the list of all elements that occur at a given segment would be extremely inefficient in such an arrangement - we'd need to do full list traversals for each voice.

Do you still have an unanswered question? Please log in first to post your question.