jsbean / RhythmSpellingTools

Structures that enable the spelling of Rhythms
MIT License
0 stars 0 forks source link

Inject customizable beaming algorithm #4

Open jsbean opened 7 years ago

jsbean commented 7 years ago

Currently, RhythmSpelling shoots out a default beaming. There is not yet any configurability to this algorithm, though there should be.

jsbean commented 7 years ago

Components could add up something like:

protocol BeamingStrategy {
    ...
}

struct DefaultBeamingStrategy: BeamingStrategy { 
    ...
}
extension RhythmSpelling {
    init(rhythmTree: RhythmTree, strategy: BeamingStrategy) {
        ...
    }
}
func makeJunctions(
    _ leaves: [MetricalDuration], 
    strategy: BeamingStrategy = DefaultBeamingStrategy
) -> [RhythmSpelling.BeamJunction] 
{
    ...
}