From 083de7cb49f1f7b6087f1b9512ccbe3e69ee9808 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Sat, 15 Dec 2012 21:02:48 +0000 Subject: avoid hanging notes when dragging notes in editors --- muse2/ChangeLog | 1 + muse2/muse/midiedit/prcanvas.cpp | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/muse2/ChangeLog b/muse2/ChangeLog index ffb4d1ea..42c3e921 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,5 +1,6 @@ 14.12.2012: - Made simpledrums ask to load another sample if a sample wasn't found during loading (rj) + - when dragging multiple notes in editors they are not played, to avoid hanging notes (rj) 12.12.2012: - Fixed some vst controls stuck. (Tim) - Added vst master timebase (sequencers should work now). WIP Not quite finished. (Tim) diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index 7670abb2..8273c8d9 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -456,8 +456,12 @@ bool PianoCanvas::moveItem(MusECore::Undo& operations, MusEGui::CItem* item, con // release note: MusECore::MidiPlayEvent ev1(0, port, channel, 0x90, event.pitch() + track()->transposition, 0); MusEGlobal::audio->msgPlayMidiEvent(&ev1); - MusECore::MidiPlayEvent ev2(0, port, channel, 0x90, npitch + track()->transposition, event.velo()); - MusEGlobal::audio->msgPlayMidiEvent(&ev2); + if (moving.size() == 1) { + MusECore::MidiPlayEvent ev2(0, port, channel, 0x90, npitch + track()->transposition, event.velo()); + MusEGlobal::audio->msgPlayMidiEvent(&ev2); + } + else + playedPitch=-1; } MusECore::Part* part = nevent->part(); @@ -1041,10 +1045,15 @@ void PianoCanvas::itemMoved(const MusEGui::CItem* item, const QPoint& pos) // release note: MusECore::MidiPlayEvent ev1(0, port, channel, 0x90, playedPitch, 0); MusEGlobal::audio->msgPlayMidiEvent(&ev1); - // play note: - MusECore::MidiPlayEvent e2(0, port, channel, 0x90, npitch + track()->transposition, event.velo()); - MusEGlobal::audio->msgPlayMidiEvent(&e2); - playedPitch = npitch + track()->transposition; + + if (moving.size() == 1) { // items moving + // play note: + MusECore::MidiPlayEvent e2(0, port, channel, 0x90, npitch + track()->transposition, event.velo()); + MusEGlobal::audio->msgPlayMidiEvent(&e2); + playedPitch = npitch + track()->transposition; + } + else + playedPitch = -1; } } -- cgit v1.2.3