rettinghaus / MEILER

MEI Lilypond Engraving Refinement
MIT License
20 stars 7 forks source link

Beams: Use keys and new template mode addBeamMarkup #11

Closed th-we closed 7 years ago

th-we commented 7 years ago

I did some changes to remove code duplication and hence improve maintainability because when refining the beaming logic, the code doesn't have to be changed in multiple places.

It sort of reverses the logic, i.e. instead of starting from a <note>/<chord>/<rest> and looking for a corresponding <beam>/<beamSpan>, the keys start at the <beam>/<beamSpan>s and find the elements they are anchored to. I expect this to be more efficient because:

This new solution is also more robust. In the also included beams test case, the first beam fails to render correctly as the last element in it is a <handShift> - which is a perfectly valid (though maybe not a very clever) place to put a <handShift>.

A similar approach could be taken e.g. for slurs and hairpins.

rettinghaus commented 7 years ago

Shouldn't that work on tuplets, too? Could you do it?

th-we commented 7 years ago

Maybe a similar approach could work for a number of things including tuplets, slurs and hairpins. I'll see what I can do, but right now I'm not sure when.