(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
This commit is contained in:
Paul Davis 2010-09-15 16:16:37 +00:00
parent 3b8d6d3b56
commit 5f948f6961
3 changed files with 15 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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.
*/