summaryrefslogtreecommitdiff
path: root/gtk2_ardour/step_editor.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-08-15 21:18:00 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-08-15 21:18:00 +0000
commit0b2f156c5850fb1c60aae25df4b9767bd7f92b89 (patch)
tree8e74678018ca4fff47b8fb18da55861edd40b910 /gtk2_ardour/step_editor.cc
parentfaca3e5f5d666fc543b23f6ab7b93a14f6c8ff7f (diff)
some fuzzy logic to avoid note "overlaps" during step editing
git-svn-id: svn://localhost/ardour2/branches/3.0@7634 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/step_editor.cc')
-rw-r--r--gtk2_ardour/step_editor.cc26
1 files changed, 22 insertions, 4 deletions
diff --git a/gtk2_ardour/step_editor.cc b/gtk2_ardour/step_editor.cc
index 822af4c559..f94c4ca989 100644
--- a/gtk2_ardour/step_editor.cc
+++ b/gtk2_ardour/step_editor.cc
@@ -44,6 +44,8 @@ StepEditor::start_step_editing ()
_step_edit_chord_duration = 0.0;
step_edit_region.reset ();
step_edit_region_view = 0;
+ last_added_pitch = -1;
+ last_added_end = 0;
resync_step_edit_position ();
prepare_step_edit_region ();
@@ -250,15 +252,31 @@ StepEditor::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evo
/* make sure its visible on the horizontal axis */
- nframes64_t fpos = step_edit_region->position() +
+ framepos_t fpos = step_edit_region->position() +
step_edit_region_view->beats_to_frames (step_edit_beat_pos + beat_duration);
if (fpos >= (_editor.leftmost_position() + _editor.current_page_frames())) {
_editor.reset_x_origin (fpos - (_editor.current_page_frames()/4));
}
-
- step_edit_region_view->step_add_note (channel, pitch, velocity, step_edit_beat_pos, beat_duration);
-
+
+ Evoral::MusicalTime at = step_edit_beat_pos;
+ Evoral::MusicalTime len = beat_duration;
+
+ if ((last_added_pitch >= 0) && (pitch == last_added_pitch) && (last_added_end == step_edit_beat_pos)) {
+
+ /* avoid any apparent note overlap - move the start of this note
+ up by 1 tick from where the last note ended
+ */
+
+ at += 1.0/Meter::ticks_per_beat;
+ len -= 1.0/Meter::ticks_per_beat;
+ }
+
+ step_edit_region_view->step_add_note (channel, pitch, velocity, at, len);
+
+ last_added_pitch = pitch;
+ last_added_end = at+len;
+
if (_step_edit_triplet_countdown > 0) {
_step_edit_triplet_countdown--;