Skip to content

Commit

Permalink
fix weird overflow on grace note duration
Browse files Browse the repository at this point in the history
  • Loading branch information
agourlay committed Nov 18, 2024
1 parent eeda219 commit e0a715a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/audio/midi_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ impl MidiBuilder {
};
let on_beat_duration = *start - grace_length;
if grace.is_on_beat || on_beat_duration < QUARTER_TIME as usize {
*start += grace_length;
*duration -= grace_length;
*start = start.saturating_add(grace_length);
*duration = duration.saturating_sub(grace_length);
}
self.add_note(
track_id,
Expand Down

0 comments on commit e0a715a

Please sign in to comment.