summaryrefslogtreecommitdiff
path: root/gtk2_ardour/midi_region_view.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2020-01-11 10:57:14 -0700
committerPaul Davis <paul@linuxaudiosystems.com>2020-01-11 10:57:21 -0700
commit03c4335c1e20311fedd2c61c96a01d34447bf692 (patch)
tree16640760a147b303ebb82aac5db62ab904b2730b /gtk2_ardour/midi_region_view.cc
parentd79e869da8397063d782a8bda52445f666f85109 (diff)
fix drawing of zero-length notes
Note that the result is too narrow to be manipulated, though it can be moved
Diffstat (limited to 'gtk2_ardour/midi_region_view.cc')
-rw-r--r--gtk2_ardour/midi_region_view.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index 22f4e780ee..3db3be3fdf 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -1759,7 +1759,15 @@ MidiRegionView::update_sustained (Note* ev, bool update_ghost_regions)
const double y0 = 1 + floor(note_to_y(note->note()));
double y1;
- if (note->end_time() != std::numeric_limits<Temporal::Beats>::max()) {
+ if (note->length() == 0) {
+
+ /* special case actual zero-length notes */
+
+ x1 = x0 + 1.;
+
+ } else if (note->end_time() != std::numeric_limits<Temporal::Beats>::max()) {
+
+ /* normal note */
double note_end_time = note->end_time().to_double();
@@ -1770,7 +1778,11 @@ MidiRegionView::update_sustained (Note* ev, bool update_ghost_regions)
const samplepos_t note_end_samples = map.sample_at_quarter_note (session_source_start + note_end_time) - _region->position();
x1 = std::max(1., trackview.editor().sample_to_pixel (note_end_samples)) - 1;
+
} else {
+
+ /* nascent note currently being recorded, noteOff has not yet arrived */
+
x1 = std::max(1., trackview.editor().sample_to_pixel (_region->length())) - 1;
}
@@ -4212,6 +4224,7 @@ MidiRegionView::data_recorded (boost::weak_ptr<MidiSource> w)
ev.time() - src->natural_position() + _region->start());
if (ev.type() == MIDI_CMD_NOTE_ON) {
+
boost::shared_ptr<NoteType> note (new NoteType (ev.channel(), time_beats, std::numeric_limits<Temporal::Beats>::max() - time_beats, ev.note(), ev.velocity()));
assert (note->end_time() == std::numeric_limits<Temporal::Beats>::max());