Closed cifkao closed 3 years ago
It's not easy to get this right...
It should be OK now. Not sure how to fix the coverage. (We're not testing Chord
because there are no chords in the test data.)
Looks like a bug to me. Once time
is adjusted, end
(a property that returns time + duration
) is no longer accurate.
However, time
and duration
are two different attributes, so we should handle them separately if possible for consistency reason. It can be quite tricky to adjust them independently due to potential accumulations of rounding errors.
It doesn't seem to be possible to me to adjust them separately without caching the old time value somewhere... Or making sure duration gets adjusted first, which would be quite fragile.
I think maybe classes like Note
and Chord
should just override adjust_time
instead of _adjust_time
. That way the function will get called only once for the whole object and interactions between attributes can be handled easily.
How about this?
Merged. Thank you!
We want
func
to be applied to absolute timestamps, not durations.