music-notation-swift / music-notation-core

Music Notation Library in Swift (Deprecated. See `music-notation` instead)
MIT License
115 stars 16 forks source link

Rework Tuplet validation with ticks #69

Closed drumnkyle closed 8 years ago

drumnkyle commented 8 years ago

Tuplet validation uses some methodology that would not be shared with MeasureDurationValidator. Instead, @migue48 and I discussed creating a ticks property that is set in NoteDuration. Each value from the duration will have an integer associated with it starting with 256th note = 32. This is derived, because we are figuring the smallest would be a 256th note with 5 dots (1/2048th note = 1). This property should be internal, because API users don't need to know about it.

This issue will also rewrite the NoteDuration.number(of:equalTo:) to use this new methodology. Also, the initialization for Tuplet will use this methodology so that it doesn't need fractions. Basically, the budget for number of ticks should be calculated (baseNoteDuration * numberOfNotes). Then, reduce the [NoteCollection] to number of ticks and compare the values to see if it's equal (valid), less, or greater.