Prevent note trim to zero length (shown as stuck).

The reasonable value 1 tick doesn't seem to work here, presumably it gets lost
in rounding conversion somewhere.  Instead use a really small power of two
reciprocal.  Once we use actual beats and ticks we can fix this to be a minimum
of one tick (the actual minimum length for a note).
This commit is contained in:
David Robillard 2015-01-08 19:13:00 -05:00
parent 3f34f0a0a4
commit 57947ff5a8
1 changed files with 5 additions and 6 deletions

View File

@ -2693,6 +2693,8 @@ MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_
}
}
len = std::max(Evoral::Beats(1 / 512.0), len);
char buf[16];
snprintf (buf, sizeof (buf), "%.3g beats", len.to_double());
show_verbose_cursor (buf, 0, 0);
@ -2761,12 +2763,9 @@ MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_
}
if (!at_front) {
const Evoral::Beats len = x_beats - canvas_note->note()->time();
if (!!len) {
/* XXX convert to beats */
note_diff_add_change (canvas_note, MidiModel::NoteDiffCommand::Length, len);
}
const Evoral::Beats len = std::max(Evoral::Beats(1 / 512.0),
x_beats - canvas_note->note()->time());
note_diff_add_change (canvas_note, MidiModel::NoteDiffCommand::Length, len);
}
delete resize_rect;