diff options
author | Robert Jonsson <spamatica@gmail.com> | 2013-05-14 18:18:53 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2013-05-14 18:18:53 +0000 |
commit | 9eb1bc5f2bf1e922b55f643f8de22383c638930c (patch) | |
tree | fee42d105eb339cdec943fa6cf7fb36ed13ab385 /muse2/muse | |
parent | a4b19f67d039c20369c44ca81845cd4b9eda4878 (diff) |
move drum in drum editor with midi in
Diffstat (limited to 'muse2/muse')
-rw-r--r-- | muse2/muse/midiedit/drumedit.cpp | 34 | ||||
-rw-r--r-- | muse2/muse/midiedit/drumedit.h | 1 |
2 files changed, 35 insertions, 0 deletions
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index e2ba0ef1..a93ad01e 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -622,6 +622,8 @@ DrumEdit::DrumEdit(MusECore::PartList* pl, QWidget* parent, const char* name, un connect(ctrl, SIGNAL(clicked()), SLOT(addCtrlClicked())); + connect(MusEGlobal::song, SIGNAL(midiNote(int, int)), SLOT(midiNote(int,int))); + QClipboard* cb = QApplication::clipboard(); connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged())); @@ -673,6 +675,38 @@ void DrumEdit::songChanged1(MusECore::SongChangedFlags_t bits) } //--------------------------------------------------------- +// midiNote +//--------------------------------------------------------- +void DrumEdit::midiNote(int pitch, int velo) +{ + //if (debugMsg) + printf("DrumEdit::midiNote: pitch=%i, velo=%i\n", pitch, velo); + int index=0; + + // *note = old_style_drummap_mode ? ourDrumMap[index].anote : instrument_map[index].pitch; + + if ((DrumCanvas*)(canvas)->midiin()) + { + if (old_style_drummap_mode()) { + MusECore::DrumMap *dmap= ((DrumCanvas*)canvas)->getOurDrumMap(); + for (index = 0; index < ((DrumCanvas*)canvas)->getOurDrumMapSize(); ++index) { + + if ((&dmap[index])->anote == pitch) + break; + } + + } + else + { + for (index = 0; index < get_instrument_map().size(); ++index) { + if (get_instrument_map().at(index).pitch == pitch) + break; + } + } + dlist->setCurDrumInstrument(index); + } +} +//--------------------------------------------------------- // horizontalZoom //--------------------------------------------------------- diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h index fef06bfe..2a97bbf5 100644 --- a/muse2/muse/midiedit/drumedit.h +++ b/muse2/muse/midiedit/drumedit.h @@ -169,6 +169,7 @@ class DrumEdit : public MidiEditor { void display_old_new_conflict_message(); void deltaModeChanged(bool); + void midiNote(int pitch, int velo); public slots: void setSelection(int tick, MusECore::Event&, MusECore::Part*, bool update); |