diff options
author | David Robillard <d@drobilla.net> | 2015-01-08 19:13:00 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-01-08 19:13:00 -0500 |
commit | 57947ff5a82c55b02b4254ef4f6e65d9e8d3fd95 (patch) | |
tree | cb937d35bce706bef29892b69bf419cd59ae4450 /gtk2_ardour | |
parent | 3f34f0a0a4a758b89f511725e198c4ad6daca293 (diff) |
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).
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index eedf67836e..ef04fde798 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -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; |