Set length of new percussive hits to 1 tick

This prevents overlap of successive hits.

Ardour 7 added a new duration select drop-down menu,
which defaults to "Auto" (musical grid) and removed
the special case when drawing percussive notes.
It was possible to accidentally create overlapping notes,
without the user being aware of doing so.
This commit is contained in:
Robin Gareus 2023-09-04 23:26:32 +02:00
parent 7d95334c0d
commit cf9f9db48b
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 7 additions and 12 deletions

View file

@ -6946,17 +6946,8 @@ HitCreateDrag::finished (GdkEvent* event, bool had_movement)
Beats const start = _region_view->region ()->absolute_time_to_region_beats (timepos_t (aligned_beats)); Beats const start = _region_view->region ()->absolute_time_to_region_beats (timepos_t (aligned_beats));
/* This code is like MidiRegionView::get_draw_length_beats() but /* Percussive hits are as short as possible */
* defaults to 1/64th note rather than a 1/4 note, since we're in Beats length (0, 1);
* percussive mode.
*/
bool success;
Beats length = _editor->get_draw_length_as_beats (success, pos);
if (!success) {
length = Beats::ticks (Beats::PPQN / 64);
}
/* create_note_at() implements UNDO for us */ /* create_note_at() implements UNDO for us */
_region_view->create_note_at (timepos_t (start), _y, length, event->button.state, false); _region_view->create_note_at (timepos_t (start), _y, length, event->button.state, false);

View file

@ -4697,6 +4697,10 @@ MidiRegionView::get_grid_beats (timepos_t const & pos) const
Temporal::Beats Temporal::Beats
MidiRegionView::get_draw_length_beats (timepos_t const & pos) const MidiRegionView::get_draw_length_beats (timepos_t const & pos) const
{ {
if (midi_view()->note_mode() == Percussive) {
return Temporal::Beats (0, 1);
}
PublicEditor& editor = trackview.editor(); PublicEditor& editor = trackview.editor();
bool success = false; bool success = false;
Temporal::Beats beats = editor.get_draw_length_as_beats (success, pos); Temporal::Beats beats = editor.get_draw_length_as_beats (success, pos);