From f783083862fa7a71f7774a14176e4a6bbbe324f9 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Sun, 16 Sep 2012 14:57:22 +0000 Subject: some improvements --- muse2/ChangeLog | 3 ++ muse2/muse/midiedit/prcanvas.cpp | 64 +++++++++++++++++++++++++++------------- muse2/muse/midiedit/prcanvas.h | 2 ++ muse2/synti/CMakeLists.txt | 2 +- 4 files changed, 50 insertions(+), 21 deletions(-) (limited to 'muse2') diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 0ba1a672..6177d2c0 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -2,6 +2,9 @@ - Fixed allocation error with drag&drop of plugins (rj) - Fixed close menu alternative in Instrument editor (rj) - Changed Aux name on strips to reflect the actual Aux strip name (rj) + - Fixed CR:3567893 Play Event on note creation (rj) + - Removed 'fluid' from the list of built synths, it is inferior to fluidsynth + and causes confusion (rj) 09.09.2012: - Added instructions on how to record audio with MusE to the new manual (rj) 08.09.2012: diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index 2bf94269..99c2ea8c 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -499,11 +499,18 @@ MusEGui::CItem* PianoCanvas::newItem(const QPoint& p, int) e.setPitch(pitch); e.setVelo(curVelo); e.setLenTick(len); - return new NEvent(e, curPart, pitch2y(pitch)); + + NEvent *newEvent = new NEvent(e, curPart, pitch2y(pitch)); + if(_playEvents) + startPlayEvent(newEvent); + return newEvent; } void PianoCanvas::newItem(MusEGui::CItem* item, bool noSnap) { + if(_playEvents) + stopPlayEvent(); + NEvent* nevent = (NEvent*) item; MusECore::Event event = nevent->event(); int x = item->x(); @@ -998,17 +1005,7 @@ void PianoCanvas::itemPressed(const MusEGui::CItem* item) { if (!_playEvents) return; - - int port = track()->outPort(); - int channel = track()->outChannel(); - NEvent* nevent = (NEvent*) item; - MusECore::Event event = nevent->event(); - playedPitch = event.pitch() + track()->transposition; - int velo = event.velo(); - - // play note: - MusECore::MidiPlayEvent e(0, port, channel, 0x90, playedPitch, velo); - MusEGlobal::audio->msgPlayMidiEvent(&e); + startPlayEvent(item); } //--------------------------------------------------------- @@ -1018,14 +1015,8 @@ void PianoCanvas::itemPressed(const MusEGui::CItem* item) void PianoCanvas::itemReleased(const MusEGui::CItem*, const QPoint&) { if (!_playEvents) - return; - int port = track()->outPort(); - int channel = track()->outChannel(); - - // release note: - MusECore::MidiPlayEvent ev(0, port, channel, 0x90, playedPitch, 0); - MusEGlobal::audio->msgPlayMidiEvent(&ev); - playedPitch = -1; + return; + stopPlayEvent(); } //--------------------------------------------------------- @@ -1167,4 +1158,37 @@ void PianoCanvas::resizeEvent(QResizeEvent* ev) EventCanvas::resizeEvent(ev); } +//--------------------------------------------------------- +// startPlayEvent +//--------------------------------------------------------- + +void PianoCanvas::startPlayEvent(const MusEGui::CItem* item) + { + int port = track()->outPort(); + int channel = track()->outChannel(); + NEvent* nevent = (NEvent*) item; + MusECore::Event event = nevent->event(); + playedPitch = event.pitch() + track()->transposition; + int velo = event.velo(); + + // play note: + MusECore::MidiPlayEvent e(0, port, channel, 0x90, playedPitch, velo); + MusEGlobal::audio->msgPlayMidiEvent(&e); + } + +//--------------------------------------------------------- +// stopPlayEvent +//--------------------------------------------------------- + +void PianoCanvas::stopPlayEvent() + { + int port = track()->outPort(); + int channel = track()->outChannel(); + + // release note: + MusECore::MidiPlayEvent ev(0, port, channel, 0x90, playedPitch, 0); + MusEGlobal::audio->msgPlayMidiEvent(&ev); + playedPitch = -1; + } + } // namespace MusEGui diff --git a/muse2/muse/midiedit/prcanvas.h b/muse2/muse/midiedit/prcanvas.h index ee83c88e..cbe6c68c 100644 --- a/muse2/muse/midiedit/prcanvas.h +++ b/muse2/muse/midiedit/prcanvas.h @@ -92,6 +92,8 @@ class PianoCanvas : public EventCanvas { virtual void itemMoved(const CItem*, const QPoint&); virtual void curPartChanged(); virtual void resizeEvent(QResizeEvent*); + virtual void startPlayEvent(const CItem*); + virtual void stopPlayEvent(); private slots: void midiNote(int pitch, int velo); diff --git a/muse2/synti/CMakeLists.txt b/muse2/synti/CMakeLists.txt index f239fde2..08a48f1b 100644 --- a/muse2/synti/CMakeLists.txt +++ b/muse2/synti/CMakeLists.txt @@ -45,7 +45,7 @@ if (ENABLE_EXPERIMENTAL) endif (ENABLE_EXPERIMENTAL) if (HAVE_FLUIDSYNTH) - set (SubDirs ${SubDirs} fluid fluidsynth ) + set (SubDirs ${SubDirs} fluidsynth ) # removed fluid, fluidsynth should supercede it in every way. endif (HAVE_FLUIDSYNTH) subdirs(${SubDirs}) -- cgit v1.2.3