diff options
author | Florian Jung <flo@windfisch.org> | 2011-05-25 17:27:35 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2011-05-25 17:27:35 +0000 |
commit | 3948032d0a2e439069d9a6859f7f35eebb54944d (patch) | |
tree | c4bb531ecdd05e21333cedacbf27ea01686e7b69 /muse2/muse/midiedit/dcanvas.cpp | |
parent | 5e47397a7d496b8dcc93e11b89cb0f9159f291e0 (diff) |
added step recording for drum edit
step-recording stuff has been put into a easy-to-use StepRec class
the midi-in and step-rec buttons are now fully functional again
Diffstat (limited to 'muse2/muse/midiedit/dcanvas.cpp')
-rw-r--r-- | muse2/muse/midiedit/dcanvas.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index eea29b46..4f904be1 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -88,7 +88,11 @@ DrumCanvas::DrumCanvas(MidiEditor* pr, QWidget* parent, int sx, setVirt(false); cursorPos= QPoint(0,0); _stepSize=1; + + steprec=new StepRec(NULL); + songChanged(SC_TRACK_INSERTED); + connect(song, SIGNAL(midiNote(int, int)), SLOT(midiNote(int,int))); } //--------------------------------------------------------- @@ -1063,6 +1067,10 @@ void DrumCanvas::keyPressed(int index, int velocity) // play note: MidiPlayEvent e(0, port, channel, 0x90, pitch, velocity); audio->msgPlayMidiEvent(&e); + + if (_steprec && pos[0] >= start_tick && pos[0] < end_tick && curPart) + steprec->record(curPart,index,drumMap[index].len,editor->raster(),velocity,globalKeyState&Qt::ControlModifier,globalKeyState&Qt::ShiftModifier); + } //--------------------------------------------------------- @@ -1503,3 +1511,19 @@ void DrumCanvas::moveAwayUnused() used.erase(it++); } } + + +//--------------------------------------------------------- +// midiNote +//--------------------------------------------------------- +void DrumCanvas::midiNote(int pitch, int velo) + { + if (debugMsg) printf("DrumCanvas::midiNote: pitch=%i, velo=%i\n", pitch, velo); + + if (_midiin && _steprec && curPart + && !audio->isPlaying() && velo && pos[0] >= start_tick + && pos[0] < end_tick + && !(globalKeyState & Qt::AltModifier)) { + steprec->record(curPart,drumInmap[pitch],drumMap[(int)drumInmap[pitch]].len,editor->raster(),velo,globalKeyState&Qt::ControlModifier,globalKeyState&Qt::ShiftModifier); + } + } |