Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoteEventSequence totalDuration calculation #29

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ScaleNum
Copy link

Previously the SequencerTrack sequence.totalDuration was calculated by combining the duration of all notes in the sequence, even if those notes were overlapping vertically.

So with enough chords early on in the sequence, the note's combined durations could exceed the SequencerTrack .length and cause the .length to be increased unnecessarily. Extended tracks would then loop out of sync. So now .add notes only increases the totalDuration value when the newly added noteEndTime > totalDuration.

Updated willSet condition of the sequence to only force the .length increase if the sequence.totalDuration is not 0.0. Reason: Whenever calling .clear() the NoteEventSequence totalDuration is reset to 0.0. Which previously caused the willSet to make the 0.01 increment increase to every empty track and print unnecessary log messages.

Also updated the .length increase value in the willSet, as the increase by 0.01 doesn't meaningfully help in the case of notes genuinely exceeding the track length. So now the .length will match the new totalDuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant