summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-09-15 16:16:37 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-09-15 16:16:37 +0000
commit5f948f6961c948831e259c06de9821369d46f794 (patch)
treed51d22e8f877f231dc66c45b5ab1a7433d57b282 /gtk2_ardour
parent3b8d6d3b56087b0e2494003f5ad9033519efdb53 (diff)
(optionally) play note(s) as they are moved around on the pitch axis (finishes #3446)
git-svn-id: svn://localhost/ardour2/branches/3.0@7782 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor_drag.cc9
-rw-r--r--gtk2_ardour/midi_region_view.cc5
-rw-r--r--gtk2_ardour/midi_region_view.h3
3 files changed, 15 insertions, 2 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index e3e2f3a519..35183c59f5 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -3722,7 +3722,14 @@ NoteDrag::motion (GdkEvent *, bool)
char buf[12];
snprintf (buf, sizeof (buf), "%s (%d)", Evoral::midi_note_name (_primary->note()->note() + dy).c_str(),
(int) floor (_primary->note()->note() + dy));
-
+
+ if (dy) {
+ boost::shared_ptr<Evoral::Note<Evoral::MusicalTime> >
+ moved_note (new Evoral::Note<Evoral::MusicalTime> (*(_primary->note())));
+ moved_note->set_note (moved_note->note() + dy);
+ _region->play_midi_note (moved_note);
+ }
+
_editor->show_verbose_canvas_cursor_with (buf);
}
}
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index 6aa83acf11..ee86a38697 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -1324,6 +1324,11 @@ MidiRegionView::play_midi_note(boost::shared_ptr<NoteType> note)
const double note_length_beats = (note->off_event().time() - note->on_event().time());
nframes_t note_length_ms = beats_to_frames(note_length_beats)
* (1000 / (double)route_ui->session()->nominal_frame_rate());
+
+ /* note: we probably should not be binding a shared_ptr<NoteType>
+ here. Since its a one-shot timeout, its sort of OK, but ...
+ */
+
Glib::signal_timeout().connect(sigc::bind(sigc::mem_fun(this, &MidiRegionView::play_midi_note_off), note),
note_length_ms, G_PRIORITY_DEFAULT);
}
diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h
index 9523937565..ce7b3082c1 100644
--- a/gtk2_ardour/midi_region_view.h
+++ b/gtk2_ardour/midi_region_view.h
@@ -303,7 +303,8 @@ class MidiRegionView : public RegionView
private:
friend class EditNoteDialog;
-
+ friend class NoteDrag;
+
/** Play the NoteOn event of the given note immediately
* and schedule the playback of the corresponding NoteOff event.
*/