cleaner version of previous commit
git-svn-id: svn://localhost/ardour2/branches/3.0@7783 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
5f948f6961
commit
7eea9fac9d
@ -3715,21 +3715,15 @@ NoteDrag::motion (GdkEvent *, bool)
|
||||
double const tdy = dy * _note_height - _cumulative_dy;
|
||||
|
||||
if (tdx || tdy) {
|
||||
_region->move_selection (tdx, tdy);
|
||||
_cumulative_dx += tdx;
|
||||
_cumulative_dy += tdy;
|
||||
|
||||
_region->move_selection (tdx, tdy, _cumulative_dy);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -1316,7 +1316,10 @@ MidiRegionView::play_midi_note(boost::shared_ptr<NoteType> note)
|
||||
}
|
||||
|
||||
RouteUI* route_ui = dynamic_cast<RouteUI*> (&trackview);
|
||||
assert(route_ui);
|
||||
|
||||
if (!route_ui || !route_ui->midi_track()) {
|
||||
return;
|
||||
}
|
||||
|
||||
route_ui->midi_track()->write_immediate_event(
|
||||
note->on_event().size(), note->on_event().buffer());
|
||||
@ -1337,7 +1340,10 @@ bool
|
||||
MidiRegionView::play_midi_note_off(boost::shared_ptr<NoteType> note)
|
||||
{
|
||||
RouteUI* route_ui = dynamic_cast<RouteUI*> (&trackview);
|
||||
assert(route_ui);
|
||||
|
||||
if (!route_ui || !route_ui->midi_track()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
route_ui->midi_track()->write_immediate_event(
|
||||
note->off_event().size(), note->off_event().buffer());
|
||||
@ -1953,10 +1959,17 @@ MidiRegionView::add_to_selection (CanvasNoteEvent* ev)
|
||||
}
|
||||
|
||||
void
|
||||
MidiRegionView::move_selection(double dx, double dy)
|
||||
MidiRegionView::move_selection(double dx, double dy, double cumulative_dy)
|
||||
{
|
||||
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) {
|
||||
(*i)->move_event(dx, dy);
|
||||
|
||||
if (dy) {
|
||||
boost::shared_ptr<NoteType>
|
||||
moved_note (new NoteType (*((*i)->note())));
|
||||
moved_note->set_note (moved_note->note() + cumulative_dy);
|
||||
play_midi_note (moved_note);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ class MidiRegionView : public RegionView
|
||||
void delete_note (boost::shared_ptr<NoteType>);
|
||||
size_t selection_size() { return _selection.size(); }
|
||||
|
||||
void move_selection(double dx, double dy);
|
||||
void move_selection(double dx, double dy, double cumulative_dy);
|
||||
void note_dropped (ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::frameoffset_t, int8_t d_note);
|
||||
|
||||
void select_matching_notes (uint8_t notenum, uint16_t channel_mask, bool add, bool extend);
|
||||
@ -303,7 +303,6 @@ 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.
|
||||
|
Loading…
Reference in New Issue
Block a user