diff options
author | Tim E. Real <termtech@rogers.com> | 2013-02-02 07:37:31 +0000 |
---|---|---|
committer | Tim E. Real <termtech@rogers.com> | 2013-02-02 07:37:31 +0000 |
commit | f118ed0cfca8ab717b87e1f00459199acba80bb9 (patch) | |
tree | 7a5a46771dcea1a978182d0da0134e6a5d049745 /muse2/muse | |
parent | 5d8ab88bd418da3a4047b38707b5a49f32e912ba (diff) |
Solved: "Old style" Drums: Track channel/port re-enabled, drum list columns default to them.
Required some icon and colour changes. See ChangeLog.
Fixed Old Style Drum lockup: Certain item channel overrides caused infinite loop in Audio::processMidi().
Diffstat (limited to 'muse2/muse')
-rw-r--r-- | muse2/muse/arranger/tlist.cpp | 122 | ||||
-rw-r--r-- | muse2/muse/conf.cpp | 12 | ||||
-rw-r--r-- | muse2/muse/ctrl/ctrlcanvas.cpp | 37 | ||||
-rw-r--r-- | muse2/muse/ctrl/ctrlpanel.cpp | 23 | ||||
-rw-r--r-- | muse2/muse/gconfig.cpp | 6 | ||||
-rw-r--r-- | muse2/muse/helper.cpp | 4 | ||||
-rw-r--r-- | muse2/muse/icons.cpp | 16 | ||||
-rw-r--r-- | muse2/muse/icons.h | 1 | ||||
-rw-r--r-- | muse2/muse/liste/editevent.cpp | 7 | ||||
-rw-r--r-- | muse2/muse/midi.cpp | 31 | ||||
-rw-r--r-- | muse2/muse/mididev.cpp | 11 | ||||
-rw-r--r-- | muse2/muse/midiedit/dcanvas.cpp | 60 | ||||
-rw-r--r-- | muse2/muse/midiedit/dlist.cpp | 80 | ||||
-rw-r--r-- | muse2/muse/midiedit/drumedit.cpp | 8 | ||||
-rw-r--r-- | muse2/muse/midiedit/drummap.cpp | 286 | ||||
-rw-r--r-- | muse2/muse/midiedit/drummap.h | 4 | ||||
-rw-r--r-- | muse2/muse/midiport.cpp | 26 | ||||
-rw-r--r-- | muse2/muse/midiport.h | 2 | ||||
-rw-r--r-- | muse2/muse/part.cpp | 112 | ||||
-rw-r--r-- | muse2/muse/song.cpp | 20 | ||||
-rw-r--r-- | muse2/muse/track.cpp | 14 | ||||
-rw-r--r-- | muse2/muse/widgets/musewidgetsplug.cpp | 6 |
22 files changed, 531 insertions, 357 deletions
diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index 262527a9..526b36de 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -330,6 +330,8 @@ void TList::paint(const QRect& r) pm = addtrack_addmiditrackIcon; break; case MusECore::Track::NEW_DRUM: + pm = addtrack_newDrumtrackIcon; + break; case MusECore::Track::DRUM: pm = addtrack_drumtrackIcon; break; @@ -388,11 +390,8 @@ void TList::paint(const QRect& r) { QString s; int n; - if (track->isMidiTrack() && track->type() == MusECore::Track::DRUM) { - p.drawText(r, Qt::AlignVCenter|Qt::AlignHCenter, "-"); - break; - } - else if (track->isMidiTrack()) { + // Default to track port if -1 and track channel if -1. + if (track->isMidiTrack()) { n = ((MusECore::MidiTrack*)track)->outChannel() + 1; } else { @@ -631,7 +630,8 @@ void TList::chanValueFinished() if(editTrack->isMidiTrack()) { MusECore::MidiTrack* mt = dynamic_cast<MusECore::MidiTrack*>(editTrack); - if (mt && mt->type() != MusECore::Track::DRUM) + // Default to track port if -1 and track channel if -1. + if (mt) { int channel = chan_edit->value() - 1; if(channel >= MIDI_CHANNELS) @@ -645,18 +645,10 @@ void TList::chanValueFinished() editTrack, mt->outChannel(), channel)); - //mt->setOutChannel(channel); DELETETHIS 10 (only the comments of course) MusEGlobal::audio->msgIdle(true); - //MusEGlobal::audio->msgSetTrackOutChannel(mt, channel); mt->setOutChanAndUpdate(channel); MusEGlobal::audio->msgIdle(false); - //if (mt->type() == MusECore::MidiTrack::DRUM) {//Change channel on all drum instruments - // for (int i=0; i<DRUM_MAPSIZE; i++) - // MusEGlobal::drumMap[i].channel = channel; - // } MusEGlobal::audio->msgUpdateSoloStates(); - //MusEGlobal::song->endUndo(SC_CHANNELS); - //MusEGlobal::song->endUndo(SC_MIDI_TRACK_PROP | SC_ROUTE); MusEGlobal::song->endUndo(SC_MIDI_TRACK_PROP); } } @@ -706,7 +698,10 @@ void TList::ctrlValueFinished() if(editTrack && editTrack->isMidiTrack()) { MusECore::MidiTrack* mt = dynamic_cast<MusECore::MidiTrack*>(editTrack); - if (mt && mt->type() != MusECore::Track::DRUM) + //if (mt && mt->type() != MusECore::Track::DRUM) + // Default to track port if -1 and track channel if -1. + // TODO TEST: Why was DRUM excluded? I want to say just "if(mt)", but will it break something with dynamic columns? // REMOVE Tim. + if (mt) { int val = ctrl_edit->value(); MusECore::MidiPort* mp = &MusEGlobal::midiPorts[mt->outPort()]; @@ -832,9 +827,9 @@ void TList::mouseDoubleClickEvent(QMouseEvent* ev) editor->show(); } else if (section == COL_OCHANNEL) { - //if (t->isMidiTrack() && t->type() != MusECore::Track::DRUM) // Enabled for audio tracks. And synth channels cannot be changed ATM. - if(t->type() == MusECore::Track::DRUM || t->type() == MusECore::Track::AUDIO_SOFTSYNTH) + // Default to track port if -1 and track channel if -1. + if(t->type() == MusECore::Track::AUDIO_SOFTSYNTH) { mousePressEvent(ev); return; @@ -1101,36 +1096,9 @@ void TList::portsPopupMenu(MusECore::Track* t, int x, int y) MusEGlobal::song->update(); } - // Changed by T356. DELETETHIS 5 - //track->setOutPort(n); - //MusEGlobal::audio->msgSetTrackOutPort(track, n); - - //MusEGlobal::song->update(); - if (t->type() == MusECore::Track::DRUM) { - bool change = QMessageBox::question(this, tr("Update drummap?"), - tr("Do you want to use same port for all instruments in the drummap?"), - tr("&Yes"), tr("&No"), QString::null, 0, 1); - MusEGlobal::audio->msgIdle(true); - if (!change) - { - // Delete all port controller events. - MusEGlobal::song->changeAllPortDrumCtrlEvents(false); - track->setOutPort(n); - - for (int i=0; i<DRUM_MAPSIZE; i++) //Remap all drum instruments to this port - MusEGlobal::drumMap[i].port = track->outPort(); - // Add all port controller events. - MusEGlobal::song->changeAllPortDrumCtrlEvents(true); - } - else - { - track->setOutPortAndUpdate(n); - } - MusEGlobal::audio->msgIdle(false); - MusEGlobal::audio->msgUpdateSoloStates(); // (p4.0.14) p4.0.17 - MusEGlobal::song->update(); - } - else if (t->type() == MusECore::Track::AUDIO_SOFTSYNTH) + + // Default to track port if -1 and track channel if -1. No need anymore to ask to change all items + if (t->type() == MusECore::Track::AUDIO_SOFTSYNTH) { if(md != 0) { @@ -1149,8 +1117,8 @@ void TList::portsPopupMenu(MusECore::Track* t, int x, int y) MusEGlobal::audio->msgIdle(true); track->setOutPortAndUpdate(n); MusEGlobal::audio->msgIdle(false); - MusEGlobal::audio->msgUpdateSoloStates(); // (p4.0.14) p4.0.17 - MusEGlobal::song->update(SC_MIDI_TRACK_PROP); // + MusEGlobal::audio->msgUpdateSoloStates(); + MusEGlobal::song->update(SC_MIDI_TRACK_PROP); } // Prompt and send init sequences. @@ -2074,9 +2042,6 @@ void TList::mousePressEvent(QMouseEvent* ev) MusECore::MidiTrack* mt = dynamic_cast<MusECore::MidiTrack*>(t); if (mt == 0) break; - if (mt->type() == MusECore::Track::DRUM) - break; - int channel = mt->outChannel(); channel += delta; if(channel >= MIDI_CHANNELS) @@ -2085,25 +2050,11 @@ void TList::mousePressEvent(QMouseEvent* ev) channel = 0; if (channel != mt->outChannel()) { - // Changed by T356. MusEGlobal::audio->msgIdle(true); mt->setOutChanAndUpdate(channel); MusEGlobal::audio->msgIdle(false); - - // DELETETHIS 15? - /* --- I really don't like this, you can mess up the whole map "as easy as dell" - if (mt->type() == MusECore::MidiTrack::DRUM) {//Change channel on all drum instruments - for (int i=0; i<DRUM_MAPSIZE; i++) - MusEGlobal::drumMap[i].channel = channel; - }*/ - - // may result in adding/removing mixer strip: - //MusEGlobal::song->update(-1); - //MusEGlobal::song->update(SC_CHANNELS); - //MusEGlobal::song->update(SC_MIDI_TRACK_PROP); - MusEGlobal::audio->msgUpdateSoloStates(); // p4.0.14 - //MusEGlobal::song->update(SC_MIDI_TRACK_PROP | SC_ROUTE); // - MusEGlobal::song->update(SC_MIDI_TRACK_PROP); // + MusEGlobal::audio->msgUpdateSoloStates(); + MusEGlobal::song->update(SC_MIDI_TRACK_PROP); } } else @@ -2748,7 +2699,7 @@ void TList::classesPopupMenu(MusECore::Track* t, int x, int y) p.clear(); p.addAction(QIcon(*addtrack_addmiditrackIcon), tr("Midi"))->setData(MusECore::Track::MIDI); p.addAction(QIcon(*addtrack_drumtrackIcon), tr("Drum"))->setData(MusECore::Track::DRUM); - p.addAction(QIcon(*addtrack_drumtrackIcon), tr("New style drum"))->setData(MusECore::Track::NEW_DRUM); + p.addAction(QIcon(*addtrack_newDrumtrackIcon), tr("New style drum"))->setData(MusECore::Track::NEW_DRUM); QAction* act = p.exec(mapToGlobal(QPoint(x, y)), 0); if (!act) @@ -2769,11 +2720,7 @@ void TList::classesPopupMenu(MusECore::Track* t, int x, int y) if(ev.type() == MusECore::Note) { int pitch = ev.pitch(); - // Changed by T356. - // Tested: Notes were being mixed up switching back and forth between midi and drum. - //pitch = MusEGlobal::drumMap[pitch].anote; DELETETHIS pitch = MusEGlobal::drumMap[pitch].enote; - ev.setPitch(pitch); } else @@ -2786,7 +2733,6 @@ void TList::classesPopupMenu(MusECore::Track* t, int x, int y) // Change the controller event's index into the drum map to an instrument note. ev.setA((ctl & ~0xff) | MusEGlobal::drumMap[ctl & 0x7f].enote); } - } } t->setType(MusECore::Track::TrackType(n)); @@ -2797,22 +2743,14 @@ void TList::classesPopupMenu(MusECore::Track* t, int x, int y) // // Midi -> Drum // - bool change = QMessageBox::question(this, tr("Update drummap?"), - tr("Do you want to use same port and channel for all instruments in the drummap?"), - tr("&Yes"), tr("&No"), QString::null, 0, 1); - + + // Default to track port if -1 and track channel if -1. No need anymore to ask to change all items. + MusEGlobal::audio->msgIdle(true); + // Delete all port controller events. MusEGlobal::song->changeAllPortDrumCtrlEvents(false); - if (!change) { - MusECore::MidiTrack* m = (MusECore::MidiTrack*) t; - for (int i=0; i<DRUM_MAPSIZE; i++) { - MusEGlobal::drumMap[i].channel = m->outChannel(); - MusEGlobal::drumMap[i].port = m->outPort(); - } - } - MusECore::PartList* pl = t->parts(); MusECore::MidiTrack* m = (MusECore::MidiTrack*) t; for (MusECore::iPart ip = pl->begin(); ip != pl->end(); ++ip) { @@ -2824,7 +2762,7 @@ void TList::classesPopupMenu(MusECore::Track* t, int x, int y) int pitch = ev.pitch(); pitch = MusEGlobal::drumInmap[pitch]; ev.setPitch(pitch); - } + } else { if(ev.type() == MusECore::Controller) @@ -2836,17 +2774,17 @@ void TList::classesPopupMenu(MusECore::Track* t, int x, int y) // Change the controller event's instrument note to an index into the drum map. ev.setA((ctl & ~0xff) | MusEGlobal::drumInmap[ctl & 0x7f]); } - } - } } + t->setType(MusECore::Track::DRUM); - // Add all port controller events. - MusEGlobal::song->changeAllPortDrumCtrlEvents(true); + // Add all port controller events. + MusEGlobal::song->changeAllPortDrumCtrlEvents(true); + MusEGlobal::audio->msgIdle(false); - MusEGlobal::song->update(SC_EVENT_MODIFIED); + MusEGlobal::song->update(SC_EVENT_MODIFIED); } else // MIDI -> NEW_DRUM or vice versa. added by flo. { diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp index 0d92b239..b63437d2 100644 --- a/muse2/muse/conf.cpp +++ b/muse2/muse/conf.cpp @@ -754,9 +754,9 @@ void readConfiguration(Xml& xml, bool doReadMidiPortConfig, bool doReadGlobalCon MusEGlobal::config.mixerBg = readColor(xml); else if (tag == "midiTrackLabelBg") MusEGlobal::config.midiTrackLabelBg = readColor(xml); - else if (tag == "drumTrackLabelBg") + else if (tag == "drumTrackLabelBg2") MusEGlobal::config.drumTrackLabelBg = readColor(xml); - else if (tag == "newDrumTrackLabelBg") + else if (tag == "newDrumTrackLabelBg2") MusEGlobal::config.newDrumTrackLabelBg = readColor(xml); else if (tag == "waveTrackLabelBg") MusEGlobal::config.waveTrackLabelBg = readColor(xml); @@ -766,7 +766,7 @@ void readConfiguration(Xml& xml, bool doReadMidiPortConfig, bool doReadGlobalCon MusEGlobal::config.inputTrackLabelBg = readColor(xml); else if (tag == "groupTrackLabelBg") MusEGlobal::config.groupTrackLabelBg = readColor(xml); - else if (tag == "auxTrackLabelBg") + else if (tag == "auxTrackLabelBg2") MusEGlobal::config.auxTrackLabelBg = readColor(xml); else if (tag == "synthTrackLabelBg") MusEGlobal::config.synthTrackLabelBg = readColor(xml); @@ -1334,13 +1334,13 @@ void MusE::writeGlobalConfiguration(int level, MusECore::Xml& xml) const xml.colorTag(level, "mixerBg", MusEGlobal::config.mixerBg); xml.colorTag(level, "midiTrackLabelBg", MusEGlobal::config.midiTrackLabelBg); - xml.colorTag(level, "drumTrackLabelBg", MusEGlobal::config.drumTrackLabelBg); - xml.colorTag(level, "newDrumTrackLabelBg",MusEGlobal::config.newDrumTrackLabelBg); + xml.colorTag(level, "drumTrackLabelBg2", MusEGlobal::config.drumTrackLabelBg); + xml.colorTag(level, "newDrumTrackLabelBg2",MusEGlobal::config.newDrumTrackLabelBg); xml.colorTag(level, "waveTrackLabelBg", MusEGlobal::config.waveTrackLabelBg); xml.colorTag(level, "outputTrackLabelBg", MusEGlobal::config.outputTrackLabelBg); xml.colorTag(level, "inputTrackLabelBg", MusEGlobal::config.inputTrackLabelBg); xml.colorTag(level, "groupTrackLabelBg", MusEGlobal::config.groupTrackLabelBg); - xml.colorTag(level, "auxTrackLabelBg", MusEGlobal::config.auxTrackLabelBg); + xml.colorTag(level, "auxTrackLabelBg2", MusEGlobal::config.auxTrackLabelBg); xml.colorTag(level, "synthTrackLabelBg", MusEGlobal::config.synthTrackLabelBg); xml.colorTag(level, "midiTrackBg", MusEGlobal::config.midiTrackBg); diff --git a/muse2/muse/ctrl/ctrlcanvas.cpp b/muse2/muse/ctrl/ctrlcanvas.cpp index 0028d426..9c19cf8b 100644 --- a/muse2/muse/ctrl/ctrlcanvas.cpp +++ b/muse2/muse/ctrl/ctrlcanvas.cpp @@ -518,7 +518,11 @@ void CtrlCanvas::partControllers(const MusECore::MidiPart* part, int num, int* d if((mt->type() == MusECore::Track::DRUM)) { n = (num & ~0xff) | MusEGlobal::drumMap[curDrumPitch].anote; - mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[curDrumPitch].port]; + // Default to track port if -1 and track channel if -1. + int mport = MusEGlobal::drumMap[curDrumPitch].port; + if(mport == -1) + mport = mt->outPort(); + mp = &MusEGlobal::midiPorts[mport]; } if(mt->type() == MusECore::Track::NEW_DRUM) { @@ -619,10 +623,19 @@ void CtrlCanvas::updateItems() { if(curDrumPitch < 0) continue; + // Default to track port if -1 and track channel if -1. int port = MusEGlobal::drumMap[ctl & 0x7f].port; + if(port == -1) + port = part->track()->outPort(); int chan = MusEGlobal::drumMap[ctl & 0x7f].channel; + if(chan == -1) + chan = part->track()->outChannel(); int cur_port = MusEGlobal::drumMap[curDrumPitch].port; + if(cur_port == -1) + cur_port = part->track()->outPort(); int cur_chan = MusEGlobal::drumMap[curDrumPitch].channel; + if(cur_chan == -1) + cur_chan = part->track()->outChannel(); if((port != cur_port) || (chan != cur_chan)) continue; ctl = (ctl & ~0xff) | MusEGlobal::drumMap[ctl & 0x7f].anote; @@ -1601,7 +1614,11 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MusECore::Midi if(is_drum_ctl) { - mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[curDrumPitch].port]; + // Default to track port if -1 and track channel if -1. + int mport = MusEGlobal::drumMap[curDrumPitch].port; + if(mport == -1) + mport = mt->outPort(); + mp = &MusEGlobal::midiPorts[mport]; cnum = (_cnum & ~0xff) | MusEGlobal::drumMap[curDrumPitch].anote; } else @@ -1736,7 +1753,11 @@ void CtrlCanvas::pdrawExtraDrumCtrlItems(QPainter& p, const QRect& rect, const M if(is_drum_ctl) { - mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[curDrumPitch].port]; + // Default to track port if -1 and track channel if -1. + int mport = MusEGlobal::drumMap[curDrumPitch].port; + if(mport == -1) + mport = mt->outPort(); + mp = &MusEGlobal::midiPorts[mport]; cnum = (_cnum & ~0xff) | MusEGlobal::drumMap[curDrumPitch].anote; } else @@ -1892,11 +1913,17 @@ void CtrlCanvas::pdraw(QPainter& p, const QRect& rect) if(curPart && curPart->track() && curPart->track()->type() == MusECore::Track::DRUM && curDrumPitch >= 0 && ((_cnum & 0xff) == 0xff)) { - int port = MusEGlobal::drumMap[curDrumPitch].port; + // Default to track port if -1 and track channel if -1. + int port = MusEGlobal::drumMap[curDrumPitch].port; + if(port == -1) + port = curPart->track()->outPort(); int anote = MusEGlobal::drumMap[curDrumPitch].anote; for(int i = 0; i < DRUM_MAPSIZE; ++i) { - if(i != curDrumPitch && MusEGlobal::drumMap[i].port == port && MusEGlobal::drumMap[i].anote == anote) + int iport = MusEGlobal::drumMap[i].port; + if(iport == -1) + iport = curPart->track()->outPort(); + if(i != curDrumPitch && iport == port && MusEGlobal::drumMap[i].anote == anote) pdrawExtraDrumCtrlItems(p, rect, curPart, anote); } } diff --git a/muse2/muse/ctrl/ctrlpanel.cpp b/muse2/muse/ctrl/ctrlpanel.cpp index 84d155ea..7856f51c 100644 --- a/muse2/muse/ctrl/ctrlpanel.cpp +++ b/muse2/muse/ctrl/ctrlpanel.cpp @@ -188,8 +188,13 @@ void CtrlPanel::heartBeat() int cdp = ctrlcanvas->getCurDrumPitch(); if(_track->type() == MusECore::Track::DRUM && _ctrl->isPerNoteController() && cdp != -1) { + // Default to track port if -1 and track channel if -1. outport = MusEGlobal::drumMap[cdp].port; + if(outport == -1) + outport = _track->outPort(); chan = MusEGlobal::drumMap[cdp].channel; + if(chan == -1) + chan = _track->outChannel(); } else { @@ -284,8 +289,13 @@ void CtrlPanel::labelDoubleClicked() int cdp = ctrlcanvas->getCurDrumPitch(); if(_track->type() == MusECore::Track::DRUM && _ctrl->isPerNoteController() && cdp != -1) { + // Default to track port if -1 and track channel if -1. outport = MusEGlobal::drumMap[cdp].port; + if(outport == -1) + outport = _track->outPort(); chan = MusEGlobal::drumMap[cdp].channel; + if(chan == -1) + chan = _track->outChannel(); } else { @@ -389,8 +399,13 @@ void CtrlPanel::ctrlChanged(double val) int cdp = ctrlcanvas->getCurDrumPitch(); if(_track->type() == MusECore::Track::DRUM && _ctrl->isPerNoteController() && cdp != -1) { + // Default to track port if -1 and track channel if -1. outport = MusEGlobal::drumMap[cdp].port; + if(outport == -1) + outport = _track->outPort(); chan = MusEGlobal::drumMap[cdp].channel; + if(chan == -1) + chan = _track->outChannel(); } else { @@ -465,8 +480,14 @@ void CtrlPanel::setHWController(MusECore::MidiTrack* t, MusECore::MidiController if(_track->type() == MusECore::Track::DRUM && _ctrl->isPerNoteController() && cdp != -1) { _dnum = (_dnum & ~0xff) | MusEGlobal::drumMap[cdp].anote; - mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[cdp].port]; + int mport = MusEGlobal::drumMap[cdp].port; + // Default to track port if -1 and track channel if -1. + if(mport == -1) + mport = _track->outPort(); + mp = &MusEGlobal::midiPorts[mport]; ch = MusEGlobal::drumMap[cdp].channel; + if(ch == -1) + ch = _track->outChannel(); } else if((_track->type() == MusECore::Track::NEW_DRUM || _track->type() == MusECore::Track::MIDI) && _ctrl->isPerNoteController() && cdp != -1) { diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp index ab743572..ac7c50a6 100644 --- a/muse2/muse/gconfig.cpp +++ b/muse2/muse/gconfig.cpp @@ -102,13 +102,13 @@ GlobalConfigValues config = { QColor(0x00, 0x00, 0x00), // selected track Fg; QColor(74, 150, 194), // midiTrackLabelBg; // Med blue - QColor(74, 150, 194), // drumTrackLabelBg; // Med blue - QColor(74, 150, 194), // newDrumTrackLabelBg; // Med blue + QColor(150, 177, 189), // drumTrackLabelBg; // Pale pastel blue + QColor(116, 232, 242), // newDrumTrackLabelBg; // Light blue QColor(213, 128, 202), // waveTrackLabelBg; // magenta QColor(84, 185, 58), // outputTrackLabelBg; // green QColor(199, 75, 64), // inputTrackLabelBg; // red QColor(236, 214, 90), // groupTrackLabelBg; // yellow - QColor(161, 234, 242), // auxTrackLabelBg; // Light blue + QColor(142, 157, 6), // auxTrackLabelBg; // Med olive QColor(229, 157, 101), // synthTrackLabelBg; // Med orange QColor(215, 220, 230), // midiTrackBg; diff --git a/muse2/muse/helper.cpp b/muse2/muse/helper.cpp index 0d9b74bd..2a6992fc 100644 --- a/muse2/muse/helper.cpp +++ b/muse2/muse/helper.cpp @@ -457,7 +457,7 @@ QActionGroup* populateAddTrack(QMenu* addTrack, bool populateAll, bool evenIgnor if (!evenIgnoreDrumPreference && (MusEGlobal::config.drumTrackPreference==MusEGlobal::PREFER_NEW || MusEGlobal::config.drumTrackPreference==MusEGlobal::ONLY_NEW)) { - QAction* newdrum = addTrack->addAction(QIcon(*addtrack_drumtrackIcon), + QAction* newdrum = addTrack->addAction(QIcon(*addtrack_newDrumtrackIcon), qApp->translate("@default", QT_TRANSLATE_NOOP("@default", "Add Drum Track"))); newdrum->setData(MusECore::Track::NEW_DRUM); grp->addAction(newdrum); @@ -472,7 +472,7 @@ QActionGroup* populateAddTrack(QMenu* addTrack, bool populateAll, bool evenIgnor } if (evenIgnoreDrumPreference || MusEGlobal::config.drumTrackPreference==MusEGlobal::PREFER_OLD) { - QAction* newdrum = addTrack->addAction(QIcon(*addtrack_drumtrackIcon), + QAction* newdrum = addTrack->addAction(QIcon(*addtrack_newDrumtrackIcon), qApp->translate("@default", QT_TRANSLATE_NOOP("@default", "Add New Style Drum Track"))); newdrum->setData(MusECore::Track::NEW_DRUM); grp->addAction(newdrum); diff --git a/muse2/muse/icons.cpp b/muse2/muse/icons.cpp index 9a36b11b..2c48bcab 100644 --- a/muse2/muse/icons.cpp +++ b/muse2/muse/icons.cpp @@ -220,12 +220,13 @@ #include "xpm/velo_all.xpm" #include "xpm/velo_per_note.xpm" -#include "xpm/addtrack_addmiditrack.xpm" +#include "xpm/addtrack_addmiditrack_2.xpm" #include "xpm/addtrack_audiogroup.xpm" #include "xpm/addtrack_audioinput.xpm" #include "xpm/addtrack_audiooutput.xpm" -#include "xpm/addtrack_auxsend.xpm" -#include "xpm/addtrack_drumtrack.xpm" +#include "xpm/addtrack_auxsend_2.xpm" +#include "xpm/addtrack_old_drumtrack.xpm" +#include "xpm/addtrack_drumtrack_2.xpm" #include "xpm/addtrack_wavetrack.xpm" #include "xpm/edit_drumms.xpm" #include "xpm/edit_list.xpm" @@ -453,6 +454,7 @@ QPixmap* addtrack_audioinputIcon; QPixmap* addtrack_audiooutputIcon; QPixmap* addtrack_auxsendIcon; QPixmap* addtrack_drumtrackIcon; +QPixmap* addtrack_newDrumtrackIcon; QPixmap* addtrack_wavetrackIcon; QPixmap* edit_drummsIcon; QPixmap* edit_listIcon; @@ -700,12 +702,13 @@ void initIcons() veloPerNote_OnIcon = new MPIXMAP(velo_per_note_xpm, NULL); veloPerNote_OffIcon = new MPIXMAP(velo_all_xpm, NULL); - addtrack_addmiditrackIcon = new MPIXMAP(addtrack_addmiditrack_xpm, NULL); + addtrack_addmiditrackIcon = new MPIXMAP(addtrack_addmiditrack_2_xpm, NULL); addtrack_audiogroupIcon = new MPIXMAP(addtrack_audiogroup_xpm, NULL); addtrack_audioinputIcon = new MPIXMAP(addtrack_audioinput_xpm, NULL); addtrack_audiooutputIcon = new MPIXMAP(addtrack_audiooutput_xpm, NULL); - addtrack_auxsendIcon = new MPIXMAP(addtrack_auxsend_xpm, NULL); - addtrack_drumtrackIcon = new MPIXMAP(addtrack_drumtrack_xpm, NULL); + addtrack_auxsendIcon = new MPIXMAP(addtrack_auxsend_2_xpm, NULL); + addtrack_drumtrackIcon = new MPIXMAP(addtrack_old_drumtrack_xpm, NULL); + addtrack_newDrumtrackIcon = new MPIXMAP(addtrack_drumtrack_2_xpm, NULL); addtrack_wavetrackIcon = new MPIXMAP(addtrack_wavetrack_xpm, NULL); edit_drummsIcon = new MPIXMAP(edit_drumms_xpm, NULL); edit_listIcon = new MPIXMAP(edit_list_xpm, NULL); @@ -948,6 +951,7 @@ void deleteIcons() delete addtrack_audiooutputIcon; delete addtrack_auxsendIcon; delete addtrack_drumtrackIcon; + delete addtrack_newDrumtrackIcon; delete addtrack_wavetrackIcon; delete edit_drummsIcon; delete edit_listIcon; diff --git a/muse2/muse/icons.h b/muse2/muse/icons.h index 673392da..2bba40cd 100644 --- a/muse2/muse/icons.h +++ b/muse2/muse/icons.h @@ -209,6 +209,7 @@ extern QPixmap* addtrack_audioinputIcon; extern QPixmap* addtrack_audiooutputIcon; extern QPixmap* addtrack_auxsendIcon; extern QPixmap* addtrack_drumtrackIcon; +extern QPixmap* addtrack_newDrumtrackIcon; extern QPixmap* addtrack_wavetrackIcon; extern QPixmap* edit_drummsIcon; extern QPixmap* edit_listIcon; diff --git a/muse2/muse/liste/editevent.cpp b/muse2/muse/liste/editevent.cpp index e75a7359..14bd0d8a 100644 --- a/muse2/muse/liste/editevent.cpp +++ b/muse2/muse/liste/editevent.cpp @@ -456,8 +456,11 @@ MusECore::Event EditCtrlDialog::event() { MusECore::DrumMap* dm = &MusEGlobal::drumMap[noteSpinBox->value() & 0x7f]; num = (cnum & ~0xff) | dm->anote; - port = &MusEGlobal::midiPorts[dm->port]; - channel = dm->channel; + // Default to track port if -1 and track channel if -1. + if(dm->port != -1) + port = &MusEGlobal::midiPorts[dm->port]; + if(dm->channel != -1) + channel = dm->channel; } } diff --git a/muse2/muse/midi.cpp b/muse2/muse/midi.cpp index 61053739..2751d562 100644 --- a/muse2/muse/midi.cpp +++ b/muse2/muse/midi.cpp @@ -679,8 +679,13 @@ void Audio::collectEvents(MusECore::MidiTrack* track, unsigned int cts, unsigned // Map drum-notes to the drum-map values int instr = ev.pitch(); pitch = MusEGlobal::drumMap[instr].anote; + // Default to track port if -1 and track channel if -1. port = MusEGlobal::drumMap[instr].port; //This changes to non-default port + if(port == -1) + port = track->outPort(); channel = MusEGlobal::drumMap[instr].channel; + if(channel == -1) + channel = track->outChannel(); velo = int(double(velo) * (double(MusEGlobal::drumMap[instr].vol) / 100.0)) ; } else if (track->type() != Track::NEW_DRUM) { @@ -744,8 +749,13 @@ void Audio::collectEvents(MusECore::MidiTrack* track, unsigned int cts, unsigned int instr = ctl & 0x7f; ctl &= ~0xff; int pitch = MusEGlobal::drumMap[instr].anote & 0x7f; + // Default to track port if -1 and track channel if -1. port = MusEGlobal::drumMap[instr].port; //This changes to non-default port + if(port == -1) + port = track->outPort(); channel = MusEGlobal::drumMap[instr].channel; + if(channel == -1) + channel = track->outChannel(); MidiDevice* mdAlt = MusEGlobal::midiPorts[port].device(); if(mdAlt) { @@ -1044,11 +1054,15 @@ void Audio::processMidi() int pitch = event.dataA(); //Map note that is played according to MusEGlobal::drumInmap drumRecPitch = MusEGlobal::drumMap[(unsigned int)MusEGlobal::drumInmap[pitch]].enote; + // Default to track port if -1 and track channel if -1. devport = MusEGlobal::drumMap[(unsigned int)MusEGlobal::drumInmap[pitch]].port; + if(devport == -1) + devport = track->outPort(); event.setPort(devport); - channel = MusEGlobal::drumMap[(unsigned int)MusEGlobal::drumInmap[pitch]].channel; + int mapchan = MusEGlobal::drumMap[(unsigned int)MusEGlobal::drumInmap[pitch]].channel; + if(mapchan != -1) + event.setChannel(mapchan); event.setA(MusEGlobal::drumMap[(unsigned int)MusEGlobal::drumInmap[pitch]].anote); - event.setChannel(channel); } else if (track->type() == Track::NEW_DRUM) { @@ -1100,11 +1114,15 @@ void Audio::processMidi() int dmindex = MusEGlobal::drumInmap[pitch] & 0x7f; //Map note that is played according to MusEGlobal::drumInmap drumRecPitch = MusEGlobal::drumMap[dmindex].enote; + // Default to track port if -1 and track channel if -1. devport = MusEGlobal::drumMap[dmindex].port; + if(devport == -1) + devport = track->outPort(); event.setPort(devport); - channel = MusEGlobal::drumMap[dmindex].channel; + int mapchan = MusEGlobal::drumMap[dmindex].channel; + if(mapchan != -1) + event.setChannel(mapchan); event.setA(ctl | MusEGlobal::drumMap[dmindex].anote); - event.setChannel(channel); } } else if (track->type() == Track::NEW_DRUM) //FINDMICHJETZT TEST @@ -1197,10 +1215,9 @@ void Audio::processMidi() MusECore::MidiPlayEvent drumRecEvent = event; drumRecEvent.setA(drumRecPitch); drumRecEvent.setB(preVelo); - // Tested: Events were not being recorded for a drum map entry pointing to a - // different port. This must have been wrong - buildMidiEventList would ignore this. Tim. + // Changed to 'port'. Events were not being recorded for a drum map entry pointing to a + // different port. That must have been wrong - buildMidiEventList would ignore that. Tim. drumRecEvent.setPort(port); //rec-event to current port - drumRecEvent.setChannel(track->outChannel()); //rec-event to current channel rl->add(drumRecEvent); } diff --git a/muse2/muse/mididev.cpp b/muse2/muse/mididev.cpp index 46db236a..8657991f 100644 --- a/muse2/muse/mididev.cpp +++ b/muse2/muse/mididev.cpp @@ -730,9 +730,16 @@ void MidiDevice::handleSeek() drum_found = true; for(int i = 0; i < DRUM_MAPSIZE; ++i) { - if(MusEGlobal::drumMap[i].port != _port || usedChans[MusEGlobal::drumMap[i].channel]) + // Default to track port if -1 and track channel if -1. + int mport = MusEGlobal::drumMap[i].port; + if(mport == -1) + mport = (*imt)->outPort(); + int mchan = MusEGlobal::drumMap[i].channel; + if(mchan == -1) + mchan = (*imt)->outChannel(); + if(mport != _port || usedChans[mchan]) continue; - usedChans[MusEGlobal::drumMap[i].channel] = true; + usedChans[mchan] = true; ++usedChanCount; if(usedChanCount >= MIDI_CHANNELS) break; // All are used, done searching. diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index 300f6927..7984d904 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -420,8 +420,23 @@ CItem* DrumCanvas::newItem(int tick, int instrument, int velocity) int port, channel; if(old_style_drummap_mode) { + // Default to track port if -1 and track channel if -1. port = ourDrumMap[instrument].port; + if(port == -1) + { + if(!curPart || !curPart->track() || !curPart->track()->isMidiTrack()) + return 0; + MidiTrack* mt = static_cast<MidiTrack*>(curPart->track()); + port = mt->outPort(); + } channel = ourDrumMap[instrument].channel; + if(channel == -1) + { + if(!curPart || !curPart->track() || !curPart->track()->isMidiTrack()) + return 0; + MidiTrack* mt = static_cast<MidiTrack*>(curPart->track()); + channel = mt->outChannel(); + } } else { @@ -649,8 +664,23 @@ void DrumCanvas::drawMoving(QPainter& p, const CItem* item, const QRect& rect) if (pitch != playedPitch && _playEvents) { keyReleased(playedPitch, true); // kinda backwards but this should pick the right port, stopPlayEvent does not know. if (moving.size() == 1) { + // Default to track port if -1 and track channel if -1. int port = old_style_drummap_mode ? ourDrumMap[instrument].port : dynamic_cast<MidiTrack*>(*instrument_map[instrument].tracks.begin())->outPort(); + if(port == -1) + { + if(!curPart || !curPart->track() || !curPart->track()->isMidiTrack()) + return; + MidiTrack* mt = static_cast<MidiTrack*>(curPart->track()); + port = mt->outPort(); + } int channel = old_style_drummap_mode ? ourDrumMap[instrument].channel : dynamic_cast<MidiTrack*>(*instrument_map[instrument].tracks.begin())->outChannel(); + if(channel == -1) + { + if(!curPart || !curPart->track() || !curPart->track()->isMidiTrack()) + return; + MidiTrack* mt = static_cast<MidiTrack*>(curPart->track()); + channel = mt->outChannel(); + } startPlayEvent(pitch, e.velo(), port, channel); } } @@ -930,8 +960,23 @@ void DrumCanvas::keyPressed(int index, int velocity) return; // called from DList - play event + // Default to track port if -1 and track channel if -1. int port = old_style_drummap_mode ? ourDrumMap[index].port : dynamic_cast<MidiTrack*>(*instrument_map[index].tracks.begin())->outPort(); + if(port == -1) + { + if(!curPart || !curPart->track() || !curPart->track()->isMidiTrack()) + return; + MidiTrack* mt = static_cast<MidiTrack*>(curPart->track()); + port = mt->outPort(); + } int channel = old_style_drummap_mode ? ourDrumMap[index].channel : dynamic_cast<MidiTrack*>(*instrument_map[index].tracks.begin())->outChannel(); + if(channel == -1) + { + if(!curPart || !curPart->track() || !curPart->track()->isMidiTrack()) + return; + MidiTrack* mt = static_cast<MidiTrack*>(curPart->track()); + channel = mt->outChannel(); + } int pitch = old_style_drummap_mode ? ourDrumMap[index].anote : instrument_map[index].pitch; // play note: if(_playEvents) @@ -966,8 +1011,23 @@ void DrumCanvas::keyReleased(int index, bool) return; // called from DList - silence playing event + // Default to track port if -1 and track channel if -1. int port = old_style_drummap_mode ? ourDrumMap[index].port : dynamic_cast<MidiTrack*>(*instrument_map[index].tracks.begin())->outPort(); + if(port == -1) + { + if(!curPart || !curPart->track() || !curPart->track()->isMidiTrack()) + return; + MidiTrack* mt = static_cast<MidiTrack*>(curPart->track()); + port = mt->outPort(); + } int channel = old_style_drummap_mode ? ourDrumMap[index].channel : dynamic_cast<MidiTrack*>(*instrument_map[index].tracks.begin())->outChannel(); + if(channel == -1) + { + if(!curPart || !curPart->track() || !curPart->track()->isMidiTrack()) + return; + MidiTrack* mt = static_cast<MidiTrack*>(curPart->track()); + channel = mt->outChannel(); + } int pitch = old_style_drummap_mode ? ourDrumMap[index].anote : instrument_map[index].pitch; // release note: diff --git a/muse2/muse/midiedit/dlist.cpp b/muse2/muse/midiedit/dlist.cpp index de89834f..a8555cc9 100644 --- a/muse2/muse/midiedit/dlist.cpp +++ b/muse2/muse/midiedit/dlist.cpp @@ -30,6 +30,7 @@ #include <stdio.h> #include "globals.h" +#include "globaldefs.h" #include "app.h" #include "audio.h" #include "pitchedit.h" @@ -178,8 +179,14 @@ void DList::draw(QPainter& p, const QRect& rect) if(old_style_drummap_mode) { - int channel = dm->channel; - MusECore::MidiPort* mp = &MusEGlobal::midiPorts[dm->port]; + // Default to track port if -1 and track channel if -1. + int channel = dm->channel; + if(channel == -1) + channel = cur_channel; + int mport = dm->port; + if(mport == -1) + mport = cur_track->outPort(); + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[mport]; int instr_pitch = dm->anote; MusECore::MidiCtrlValListList* cll = mp->controller(); const int min = channel << 24; @@ -351,11 +358,15 @@ void DList::draw(QPainter& p, const QRect& rect) p.drawText(r.x() + 8, r.y(), r.width() - 8, r.height(), align, str); } break; + + // Default to track port if -1 and track channel if -1. case COL_OUTCHANNEL: - s.setNum(dm->channel+1); + if(dm->channel != -1) + s.setNum(dm->channel+1); break; case COL_OUTPORT: - s.sprintf("%d:%s", dm->port+1, MusEGlobal::midiPorts[dm->port].portname().toLatin1().constData()); + if(dm->port != -1) + s.sprintf("%d:%s", dm->port+1, MusEGlobal::midiPorts[dm->port].portname().toLatin1().constData()); align = Qt::AlignVCenter | Qt::AlignLeft; break; } @@ -411,7 +422,7 @@ void DList::devicesPopupMenu(MusECore::DrumMap* t, int x, int y, bool changeAll) return; } - QMenu* p = MusECore::midiPortsPopup(this, t->port); + QMenu* p = MusECore::midiPortsPopup(this, t->port, true); // Include a "<Default>" entry. QAction* act = p->exec(mapToGlobal(QPoint(x, y)), 0); bool doemit = false; if(!act) @@ -423,23 +434,41 @@ void DList::devicesPopupMenu(MusECore::DrumMap* t, int x, int y, bool changeAll) int n = act->data().toInt(); delete p; - if(n < 0) // Invalid item. + const int openConfigId = MIDI_PORTS; + const int defaultId = MIDI_PORTS + 1; + + if(n < 0 || n > defaultId) // Invalid item. return; - - if(n >= MIDI_PORTS) // Show port config dialog. + + if(n == openConfigId) // Show port config dialog. { MusEGlobal::muse->configMidiPorts(); return; } - + + if(n == defaultId) // Means the <default> -1 + n = -1; + if (!changeAll) { if(n != t->port) { + int mport = n; + // Default to track port if -1 and track channel if -1. + if(mport == -1) + { + if(!dcanvas || !dcanvas->part()) + return; + MusECore::Part* cur_part = dcanvas->part(); + if(!cur_part->track() || !cur_part->track()->isMidiTrack()) + return; + MusECore::MidiTrack* cur_track = static_cast<MusECore::MidiTrack*>(cur_part->track()); + mport = cur_track->outPort(); + } MusEGlobal::audio->msgIdle(true); - MusEGlobal::song->remapPortDrumCtrlEvents(getSelectedInstrument(), -1, -1, n); + MusEGlobal::song->remapPortDrumCtrlEvents(getSelectedInstrument(), -1, -1, mport); MusEGlobal::audio->msgIdle(false); - t->port = n; + t->port = n; // -1 is allowed doemit = true; } } @@ -631,8 +660,9 @@ void DList::viewMousePressEvent(QMouseEvent* ev) break; case COL_OUTCHANNEL: // this column isn't visible in new style drum mode val = dm->channel + incVal; - if (val < 0) - val = 0; + // Default to track port if -1 and track channel if -1. + if (val < -1) + val = -1; else if (val > 127) val = 127; @@ -653,7 +683,11 @@ void DList::viewMousePressEvent(QMouseEvent* ev) if(val != dm->channel) { MusEGlobal::audio->msgIdle(true); - MusEGlobal::song->remapPortDrumCtrlEvents(instrument, -1, val, -1); + int mchan = val; + if(mchan == -1 && dcanvas && dcanvas->part() && dcanvas->part()->track() && dcanvas->part()->track()->isMidiTrack()) + mchan = static_cast<MusECore::MidiTrack*>(dcanvas->part()->track())->outChannel(); + if(val != -1) + MusEGlobal::song->remapPortDrumCtrlEvents(instrument, -1, val, -1); MusEGlobal::audio->msgIdle(false); dm->channel = val; MusEGlobal::song->update(SC_DRUMMAP); @@ -836,7 +870,9 @@ void DList::lineEdit(int line, int section) break; case COL_OUTCHANNEL: - editor->setText(QString::number(dm->channel+1)); + // Default to track port if -1 and track channel if -1. + if(dm->channel != -1) + editor->setText(QString::number(dm->channel+1)); break; } @@ -970,11 +1006,13 @@ void DList::returnPressed() break; case COL_OUTCHANNEL: - val--; - if (val >= 16) - val = 15; - if (val < 0) - val = 0; + // Default to track port if -1 and track channel if -1. + if(val <= 0) + val = -1; + else + val--; + if (val >= MIDI_CHANNELS) + val = MIDI_CHANNELS - 1; break; default: break; @@ -1016,7 +1054,7 @@ void DList::returnPressed() break; case COL_OUTCHANNEL: - editEntry->channel = val; + editEntry->channel = val; break; default: diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index c64641e9..fd28d8ea 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -96,8 +96,8 @@ void DrumEdit::setHeaderWhatsThis() header->setWhatsThis(COL_INPUTTRIGGER, tr("this input note triggers the sound")); header->setWhatsThis(COL_NOTELENGTH, tr("note length")); header->setWhatsThis(COL_NOTE, tr("this is the note which is played")); - header->setWhatsThis(COL_OUTCHANNEL, tr("output channel (hold ctl to affect all rows)")); - header->setWhatsThis(COL_OUTPORT, tr("output port (hold ctl to affect all rows)")); + header->setWhatsThis(COL_OUTCHANNEL, tr("override track output channel (hold ctl to affect all rows)")); + header->setWhatsThis(COL_OUTPORT, tr("override track output port (hold ctl to affect all rows)")); header->setWhatsThis(COL_LEVEL1, tr("shift + control key: draw velocity level 1")); header->setWhatsThis(COL_LEVEL2, tr("control key: draw velocity level 2")); header->setWhatsThis(COL_LEVEL3, tr("shift key: draw velocity level 3")); @@ -118,8 +118,8 @@ void DrumEdit::setHeaderToolTips() header->setToolTip(COL_INPUTTRIGGER, tr("this input note triggers the sound")); header->setToolTip(COL_NOTELENGTH, tr("note length")); header->setToolTip(COL_NOTE, tr("this is the note which is played")); - header->setToolTip(COL_OUTCHANNEL, tr("output channel (ctl: affect all rows)")); - header->setToolTip(COL_OUTPORT, tr("output port (ctl: affect all rows)")); + header->setToolTip(COL_OUTCHANNEL, tr("override track output channel (ctl: affect all rows)")); + header->setToolTip(COL_OUTPORT, tr("override track output port (ctl: affect all rows)")); header->setToolTip(COL_LEVEL1, tr("shift + control key: draw velocity level 1")); header->setToolTip(COL_LEVEL2, tr("control key: draw velocity level 2")); header->setToolTip(COL_LEVEL3, tr("shift key: draw velocity level 3")); diff --git a/muse2/muse/midiedit/drummap.cpp b/muse2/muse/midiedit/drummap.cpp index 477b2f9d..6853a3e5 100644 --- a/muse2/muse/midiedit/drummap.cpp +++ b/muse2/muse/midiedit/drummap.cpp @@ -41,7 +41,8 @@ namespace MusECore { // GM default drum map //--------------------------------------------------------- -const DrumMap blankdm = { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 127, 127, false }; +// Default to track port if -1 and track channel if -1. (These used to say 9, 0 for chan, port). +const DrumMap blankdm = { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 127, 127, false }; // this map should have 128 entries, as it's used for initalising iNewDrumMap as well. // iNewDrumMap only has 128 entries. also, the every "out-note" ("anote") should be @@ -51,141 +52,141 @@ const DrumMap blankdm = { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 127, // iNewDrumMap[ idrumMap[i].anote ] = idrumMap[i] // if you ever want to change this, you will need to fix the initNewDrumMap() function. const DrumMap idrumMap[DRUM_MAPSIZE] = { - { QString("Acoustic Bass Drum"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 35, 35, false }, - { QString("Bass Drum 1"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 36, 36, false }, - { QString("Side Stick"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 37, 37, false }, - { QString("Acoustic Snare"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 38, 38, false }, - { QString("Hand Clap"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 39, 39, false }, - { QString("Electric Snare"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 40, 40, false }, - { QString("Low Floor Tom"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 41, 41, false }, - { QString("Closed Hi-Hat"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 42, 42, false }, - { QString("High Floor Tom"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 43, 43, false }, - { QString("Pedal Hi-Hat"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 44, 44, false }, - { QString("Low Tom"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 45, 45, false }, - { QString("Open Hi-Hat"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 46, 46, false }, - { QString("Low-Mid Tom"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 47, 47, false }, - { QString("Hi-Mid Tom"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 48, 48, false }, - { QString("Crash Cymbal 1"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 49, 49, false }, - { QString("High Tom"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 50, 50, false }, - - { QString("Ride Cymbal 1"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 51, 51, false }, - { QString("Chinese Cymbal"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 52, 52, false }, - { QString("Ride Bell"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 53, 53, false }, - { QString("Tambourine"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 54, 54, false }, - { QString("Splash Cymbal"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 55, 55, false }, - { QString("Cowbell"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 56, 56, false }, - { QString("Crash Cymbal 2"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 57, 57, false }, - { QString("Vibraslap"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 58, 58, false }, - { QString("Ride Cymbal 2"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 59, 59, false }, - { QString("Hi Bongo"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 60, 60, false }, - { QString("Low Bongo"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 61, 61, false }, - { QString("Mute Hi Conga"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 62, 62, false }, - { QString("Open Hi Conga"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 63, 63, false }, - { QString("Low Conga"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 64, 64, false }, - { QString("High Timbale"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 65, 65, false }, - { QString("Low Timbale"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 66, 66, false }, - - { QString("High Agogo"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 67, 67, false }, - { QString("Low Agogo"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 68, 68, false }, - { QString("Cabasa"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 69, 69, false }, - { QString("Maracas"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 70, 70, false }, - { QString("Short Whistle"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 71, 71, false }, - { QString("Long Whistle"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 72, 72, false }, - { QString("Short Guiro"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 73, 73, false }, - { QString("Long Guiro"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 74, 74, false }, - { QString("Claves"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 75, 75, false }, - { QString("Hi Wood Block"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 76, 76, false }, - { QString("Low Wood Block"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 77, 77, false }, - { QString("Mute Cuica"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 78, 78, false }, - { QString("Open Cuica"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 79, 79, false }, - { QString("Mute Triangle"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 80, 80, false }, - { QString("Open Triangle"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 81, 81, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 82, 82, false }, - - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 83, 83, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 84, 84, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 85, 85, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 86, 86, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 87, 87, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 88, 88, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 89, 89, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 90, 90, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 91, 91, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 92, 92, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 93, 93, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 94, 94, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 95, 95, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 96, 96, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 97, 97, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 98, 98, false }, - - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 99, 99, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 100, 100, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 101, 101, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 102, 102, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 103, 103, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 104, 104, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 105, 105, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 106, 106, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 107, 107, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 108, 108, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 109, 109, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 110, 110, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 111, 111, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 112, 112, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 113, 113, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 114, 114, false }, - - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 115, 115, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 116, 116, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 117, 117, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 118, 118, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 119, 119, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 120, 120, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 121, 121, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 122, 122, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 123, 123, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 124, 124, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 125, 125, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 126, 126, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 127, 127, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 0, 0, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 1, 1, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 2, 2, false }, - - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 3, 3, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 4, 4, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 5, 5, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 6, 6, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 7, 7, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 8, 8, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 9, 9, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 10, 10, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 11, 11, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 12, 12, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 13, 13, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 14, 14, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 15, 15, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 16, 16, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 17, 17, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 18, 18, false }, - - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 19, 19, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 20, 20, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 21, 21, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 22, 22, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 23, 23, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 24, 24, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 25, 25, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 26, 26, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 27, 27, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 28, 28, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 29, 29, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 30, 30, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 31, 31, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 32, 32, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 33, 33, false }, - { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 34, 34, false } + { QString("Acoustic Bass Drum"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 35, 35, false }, + { QString("Bass Drum 1"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 36, 36, false }, + { QString("Side Stick"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 37, 37, false }, + { QString("Acoustic Snare"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 38, 38, false }, + { QString("Hand Clap"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 39, 39, false }, + { QString("Electric Snare"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 40, 40, false }, + { QString("Low Floor Tom"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 41, 41, false }, + { QString("Closed Hi-Hat"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 42, 42, false }, + { QString("High Floor Tom"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 43, 43, false }, + { QString("Pedal Hi-Hat"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 44, 44, false }, + { QString("Low Tom"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 45, 45, false }, + { QString("Open Hi-Hat"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 46, 46, false }, + { QString("Low-Mid Tom"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 47, 47, false }, + { QString("Hi-Mid Tom"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 48, 48, false }, + { QString("Crash Cymbal 1"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 49, 49, false }, + { QString("High Tom"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 50, 50, false }, + + { QString("Ride Cymbal 1"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 51, 51, false }, + { QString("Chinese Cymbal"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 52, 52, false }, + { QString("Ride Bell"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 53, 53, false }, + { QString("Tambourine"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 54, 54, false }, + { QString("Splash Cymbal"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 55, 55, false }, + { QString("Cowbell"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 56, 56, false }, + { QString("Crash Cymbal 2"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 57, 57, false }, + { QString("Vibraslap"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 58, 58, false }, + { QString("Ride Cymbal 2"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 59, 59, false }, + { QString("Hi Bongo"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 60, 60, false }, + { QString("Low Bongo"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 61, 61, false }, + { QString("Mute Hi Conga"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 62, 62, false }, + { QString("Open Hi Conga"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 63, 63, false }, + { QString("Low Conga"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 64, 64, false }, + { QString("High Timbale"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 65, 65, false }, + { QString("Low Timbale"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 66, 66, false }, + + { QString("High Agogo"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 67, 67, false }, + { QString("Low Agogo"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 68, 68, false }, + { QString("Cabasa"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 69, 69, false }, + { QString("Maracas"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 70, 70, false }, + { QString("Short Whistle"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 71, 71, false }, + { QString("Long Whistle"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 72, 72, false }, + { QString("Short Guiro"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 73, 73, false }, + { QString("Long Guiro"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 74, 74, false }, + { QString("Claves"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 75, 75, false }, + { QString("Hi Wood Block"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 76, 76, false }, + { QString("Low Wood Block"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 77, 77, false }, + { QString("Mute Cuica"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 78, 78, false }, + { QString("Open Cuica"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 79, 79, false }, + { QString("Mute Triangle"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 80, 80, false }, + { QString("Open Triangle"), 100, 16, 32, -1, -1, 70, 90, 127, 110, 81, 81, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 82, 82, false }, + + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 83, 83, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 84, 84, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 85, 85, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 86, 86, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 87, 87, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 88, 88, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 89, 89, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 90, 90, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 91, 91, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 92, 92, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 93, 93, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 94, 94, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 95, 95, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 96, 96, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 97, 97, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 98, 98, false }, + + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 99, 99, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 100, 100, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 101, 101, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 102, 102, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 103, 103, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 104, 104, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 105, 105, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 106, 106, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 107, 107, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 108, 108, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 109, 109, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 110, 110, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 111, 111, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 112, 112, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 113, 113, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 114, 114, false }, + + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 115, 115, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 116, 116, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 117, 117, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 118, 118, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 119, 119, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 120, 120, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 121, 121, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 122, 122, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 123, 123, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 124, 124, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 125, 125, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 126, 126, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 127, 127, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 0, 0, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 1, 1, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 2, 2, false }, + + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 3, 3, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 4, 4, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 5, 5, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 6, 6, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 7, 7, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 8, 8, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 9, 9, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 10, 10, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 11, 11, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 12, 12, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 13, 13, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 14, 14, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 15, 15, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 16, 16, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 17, 17, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 18, 18, false }, + + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 19, 19, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 20, 20, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 21, 21, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 22, 22, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 23, 23, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 24, 24, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 25, 25, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 26, 26, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 27, 27, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 28, 28, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 29, 29, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 30, 30, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 31, 31, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 32, 32, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 33, 33, false }, + { QString(""), 100, 16, 32, -1, -1, 70, 90, 127, 110, 34, 34, false } }; DrumMap iNewDrumMap[128]; @@ -237,7 +238,18 @@ void initNewDrumMap() } } +//--------------------------------------------------------- +// clearDrumMap +// One-time only early init +//--------------------------------------------------------- +void clearDrumMap() + { + for (int i = 0; i < DRUM_MAPSIZE; ++i) { + DrumMap& d = MusEGlobal::drumMap[i]; + d.vol = d.len = d.channel = d.port = d.lv1 = d.lv2 = d.lv3 = d.lv4 = d.enote = d.anote = d.mute = 0; + } + } //--------------------------------------------------------- // initDrumMap // populate Inmap and Outmap @@ -246,7 +258,7 @@ void initNewDrumMap() void initDrumMap() { for (int i = 0; i < DRUM_MAPSIZE; ++i) { - DrumMap d = MusEGlobal::drumMap[i]; + DrumMap& d = MusEGlobal::drumMap[i]; //Make sure we're not overwriting any values loaded //On init, all these values are zero. If so, just set the drummap entry to the initial drummap entry. if (!(d.vol || d.len || d.channel || d.port || d.lv1 || d.lv2 || d.lv3 || d.lv4 || d.enote || d.anote || d.mute)) diff --git a/muse2/muse/midiedit/drummap.h b/muse2/muse/midiedit/drummap.h index 2dca10d6..f8633b2f 100644 --- a/muse2/muse/midiedit/drummap.h +++ b/muse2/muse/midiedit/drummap.h @@ -40,8 +40,11 @@ struct DrumMap { unsigned char vol; // playback volume, percent. int quant; int len; // len of event in ticks + + // Default to track port if -1 and track channel if -1. int channel; // midi channel int port; // midi port + char lv1, lv2, lv3, lv4; // velocities char enote, anote; // input note - output note bool mute; @@ -57,6 +60,7 @@ struct DrumMap { extern DrumMap iNewDrumMap[128]; extern void initNewDrumMap(); +extern void clearDrumMap(); // One-time only early init extern void initDrumMap(); extern void writeDrumMap(int level, Xml& xml, bool external); extern void readDrumMap(Xml& xml, bool external); diff --git a/muse2/muse/midiport.cpp b/muse2/muse/midiport.cpp index e4759d31..758f577b 100644 --- a/muse2/muse/midiport.cpp +++ b/muse2/muse/midiport.cpp @@ -261,9 +261,16 @@ bool MidiPort::sendInitialControllers(unsigned start_time) drum_found = true; for(int i = 0; i < DRUM_MAPSIZE; ++i) { - if(MusEGlobal::drumMap[i].port != port || usedChans[MusEGlobal::drumMap[i].channel]) + // Default to track port if -1 and track channel if -1. + int mport = MusEGlobal::drumMap[i].port; + if(mport == -1) + mport = (*imt)->outPort(); + int mchan = MusEGlobal::drumMap[i].channel; + if(mchan == -1) + mchan = (*imt)->outChannel(); + if(mport != port || usedChans[mchan]) continue; - usedChans[MusEGlobal::drumMap[i].channel] = true; + usedChans[mchan] = true; ++usedChanCount; if(usedChanCount >= MIDI_CHANNELS) break; // All are used, done searching. @@ -383,13 +390,15 @@ int MidiPort::portno() const // midiPortsPopup //--------------------------------------------------------- -QMenu* midiPortsPopup(QWidget* parent, int checkPort) +QMenu* midiPortsPopup(QWidget* parent, int checkPort, bool includeDefaultEntry) { QMenu* p = new QMenu(parent); QMenu* subp = 0; QAction *act = 0; QString name; - + const int openConfigId = MIDI_PORTS; + const int defaultId = MIDI_PORTS + 1; + // Warn if no devices available. Add an item to open midi config. int pi = 0; for( ; pi < MIDI_PORTS; ++pi) @@ -407,11 +416,18 @@ QMenu* midiPortsPopup(QWidget* parent, int checkPort) } act = p->addAction(QIcon(*MusEGui::settings_midiport_softsynthsIcon), qApp->translate("@default", QT_TRANSLATE_NOOP("@default", "Open midi config..."))); act->setCheckable(false); - act->setData(MIDI_PORTS); + act->setData(openConfigId); p->addSeparator(); p->addAction(new MusEGui::MenuTitleItem(qApp->translate("@default", QT_TRANSLATE_NOOP("@default", "Output port/device")), p)); + if(includeDefaultEntry) + { + act = p->addAction(qApp->translate("@default", QT_TRANSLATE_NOOP("@default", "default"))); + act->setCheckable(false); + act->setData(defaultId); + } + for (int i = 0; i < MIDI_PORTS; ++i) { MidiPort* port = &MusEGlobal::midiPorts[i]; MusECore::MidiDevice* md = port->device(); diff --git a/muse2/muse/midiport.h b/muse2/muse/midiport.h index 71e36154..a8b09ed7 100644 --- a/muse2/muse/midiport.h +++ b/muse2/muse/midiport.h @@ -165,7 +165,7 @@ extern void initMidiPorts(); extern void setPortExclusiveDefOutChan(int /*port*/, int /*chan*/); #endif -extern QMenu* midiPortsPopup(QWidget* parent = 0, int checkPort = -1); +extern QMenu* midiPortsPopup(QWidget* parent = 0, int checkPort = -1, bool includeDefaultEntry = false); extern MidiControllerList defaultManagedMidiController; } // namespace MusECore diff --git a/muse2/muse/part.cpp b/muse2/muse/part.cpp index 3f9fbd62..5f3aa8ee 100644 --- a/muse2/muse/part.cpp +++ b/muse2/muse/part.cpp @@ -381,37 +381,39 @@ void addPortCtrlEvents(Event& event, Part* part, bool doClones) if(t && t->isMidiTrack()) { MidiTrack* mt = (MidiTrack*)t; - int port = mt->outPort(); + MidiPort* mp = &MusEGlobal::midiPorts[mt->outPort()]; + int ch = mt->outChannel(); unsigned len = p->lenTick(); - // Do not add events which are past the end of the part. - if(event.tick() >= len) - break; - - if(event.type() == Controller) + // Do not add events which are past the end of the part. + if(event.tick() >= len) + break; + + if(event.type() == Controller) + { + int tck = event.tick() + p->tick(); + int cntrl = event.dataA(); + int val = event.dataB(); + + // Is it a drum controller event, according to the track port's instrument? + if(mt->type() == Track::DRUM) { - int ch = mt->outChannel(); - int tck = event.tick() + p->tick(); - int cntrl = event.dataA(); - int val = event.dataB(); - MidiPort* mp = &MusEGlobal::midiPorts[port]; - - // Is it a drum controller event, according to the track port's instrument? - if(mt->type() == Track::DRUM) + MidiController* mc = mp->drumController(cntrl); + if(mc) { - MidiController* mc = mp->drumController(cntrl); - if(mc) - { - int note = cntrl & 0x7f; - cntrl &= ~0xff; + int note = cntrl & 0x7f; + cntrl &= ~0xff; + // Default to track port if -1 and track channel if -1. + if(MusEGlobal::drumMap[note].channel != -1) ch = MusEGlobal::drumMap[note].channel; + if(MusEGlobal::drumMap[note].port != -1) mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; - cntrl |= MusEGlobal::drumMap[note].anote; - } + cntrl |= MusEGlobal::drumMap[note].anote; } - - mp->setControllerVal(ch, tck, cntrl, val, p); } + + mp->setControllerVal(ch, tck, cntrl, val, p); + } } if(!doClones) @@ -441,7 +443,8 @@ void addPortCtrlEvents(Part* part, bool doClones) if(t && t->isMidiTrack()) { MidiTrack* mt = (MidiTrack*)t; - int port = mt->outPort(); + MidiPort* mp = &MusEGlobal::midiPorts[mt->outPort()]; + int ch = mt->outChannel(); const EventList* el = p->cevents(); unsigned len = p->lenTick(); for(ciEvent ie = el->begin(); ie != el->end(); ++ie) @@ -453,11 +456,9 @@ void addPortCtrlEvents(Part* part, bool doClones) if(ev.type() == Controller) { - int ch = mt->outChannel(); int tck = ev.tick() + p->tick(); int cntrl = ev.dataA(); int val = ev.dataB(); - MidiPort* mp = &MusEGlobal::midiPorts[port]; // Is it a drum controller event, according to the track port's instrument? if(mt->type() == Track::DRUM) @@ -467,8 +468,11 @@ void addPortCtrlEvents(Part* part, bool doClones) { int note = cntrl & 0x7f; cntrl &= ~0xff; - ch = MusEGlobal::drumMap[note].channel; - mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + // Default to track port if -1 and track channel if -1. + if(MusEGlobal::drumMap[note].channel != -1) + ch = MusEGlobal::drumMap[note].channel; + if(MusEGlobal::drumMap[note].port != -1) + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; cntrl |= MusEGlobal::drumMap[note].anote; } } @@ -504,32 +508,34 @@ void removePortCtrlEvents(Event& event, Part* part, bool doClones) if(t && t->isMidiTrack()) { MidiTrack* mt = (MidiTrack*)t; - int port = mt->outPort(); + MidiPort* mp = &MusEGlobal::midiPorts[mt->outPort()]; + int ch = mt->outChannel(); - if(event.type() == Controller) + if(event.type() == Controller) + { + int tck = event.tick() + p->tick(); + int cntrl = event.dataA(); + + // Is it a drum controller event, according to the track port's instrument? + if(mt->type() == Track::DRUM) { - int ch = mt->outChannel(); - int tck = event.tick() + p->tick(); - int cntrl = event.dataA(); - MidiPort* mp = &MusEGlobal::midiPorts[port]; - - // Is it a drum controller event, according to the track port's instrument? - if(mt->type() == Track::DRUM) + MidiController* mc = mp->drumController(cntrl); + if(mc) { - MidiController* mc = mp->drumController(cntrl); - if(mc) - { - int note = cntrl & 0x7f; - cntrl &= ~0xff; + int note = cntrl & 0x7f; + cntrl &= ~0xff; + // Default to track port if -1 and track channel if -1. + if(MusEGlobal::drumMap[note].channel != -1) ch = MusEGlobal::drumMap[note].channel; + if(MusEGlobal::drumMap[note].port != -1) mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; - cntrl |= MusEGlobal::drumMap[note].anote; - } + cntrl |= MusEGlobal::drumMap[note].anote; } - - mp->deleteController(ch, tck, cntrl, p); } - } + + mp->deleteController(ch, tck, cntrl, p); + } + } if(!doClones) break; @@ -558,7 +564,8 @@ void removePortCtrlEvents(Part* part, bool doClones) if(t && t->isMidiTrack()) { MidiTrack* mt = (MidiTrack*)t; - int port = mt->outPort(); + MidiPort* mp = &MusEGlobal::midiPorts[mt->outPort()]; + int ch = mt->outChannel(); const EventList* el = p->cevents(); //unsigned len = p->lenTick(); for(ciEvent ie = el->begin(); ie != el->end(); ++ie) @@ -572,10 +579,8 @@ void removePortCtrlEvents(Part* part, bool doClones) if(ev.type() == Controller) { - int ch = mt->outChannel(); int tck = ev.tick() + p->tick(); int cntrl = ev.dataA(); - MidiPort* mp = &MusEGlobal::midiPorts[port]; // Is it a drum controller event, according to the track port's instrument? if(mt->type() == Track::DRUM) @@ -585,8 +590,11 @@ void removePortCtrlEvents(Part* part, bool doClones) { int note = cntrl & 0x7f; cntrl &= ~0xff; - ch = MusEGlobal::drumMap[note].channel; - mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + // Default to track port if -1 and track channel if -1. + if(MusEGlobal::drumMap[note].channel != -1) + ch = MusEGlobal::drumMap[note].channel; + if(MusEGlobal::drumMap[note].port != -1) + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; cntrl |= MusEGlobal::drumMap[note].anote; } } diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp index 3349686b..1ef45cd1 100644 --- a/muse2/muse/song.cpp +++ b/muse2/muse/song.cpp @@ -93,6 +93,7 @@ Song::Song(const char* name) bounceTrack = NULL; bounceOutput = NULL; showSongInfo=true; + clearDrumMap(); // One-time only early init clear(false); } @@ -669,8 +670,13 @@ void Song::remapPortDrumCtrlEvents(int mapidx, int newnote, int newchan, int new if(note == mapidx) { int tick = ev.tick() + part->tick(); + // Default to track port if -1 and track channel if -1. int ch = MusEGlobal::drumMap[note].channel; + if(ch == -1) + ch = mt->outChannel(); int port = MusEGlobal::drumMap[note].port; + if(port == -1) + port = mt->outPort(); MidiPort* mp = &MusEGlobal::midiPorts[port]; cntrl = (cntrl & ~0xff) | MusEGlobal::drumMap[note].anote; @@ -738,8 +744,11 @@ void Song::changeAllPortDrumCtrlEvents(bool add, bool drumonly) if(trackmp->drumController(cntrl)) { int note = cntrl & 0x7f; - ch = MusEGlobal::drumMap[note].channel; - mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + // Default to track port if -1 and track channel if -1. + if(MusEGlobal::drumMap[note].channel != -1) + ch = MusEGlobal::drumMap[note].channel; + if(MusEGlobal::drumMap[note].port != -1) + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; cntrl = (cntrl & ~0xff) | MusEGlobal::drumMap[note].anote; } else @@ -2663,8 +2672,11 @@ int Song::execMidiAutomationCtlPopup(MidiTrack* track, MidiPart* part, const QPo // Change the controller event's index into the drum map to an instrument note. int note = ctlnum & 0x7f; dctl &= ~0xff; - channel = MusEGlobal::drumMap[note].channel; - mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + // Default to track port if -1 and track channel if -1. + if(MusEGlobal::drumMap[note].channel != -1) + channel = MusEGlobal::drumMap[note].channel; + if(MusEGlobal::drumMap[note].port != -1) + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; dctl |= MusEGlobal::drumMap[note].anote; } diff --git a/muse2/muse/track.cpp b/muse2/muse/track.cpp index cbe8fd8c..25f93804 100644 --- a/muse2/muse/track.cpp +++ b/muse2/muse/track.cpp @@ -90,8 +90,11 @@ void addPortCtrlEvents(MidiTrack* t) { int note = cntrl & 0x7f; cntrl &= ~0xff; - ch = MusEGlobal::drumMap[note].channel; - mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + // Default to track port if -1 and track channel if -1. + if(MusEGlobal::drumMap[note].channel != -1) + ch = MusEGlobal::drumMap[note].channel; + if(MusEGlobal::drumMap[note].port != -1) + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; cntrl |= MusEGlobal::drumMap[note].anote; } } @@ -132,8 +135,11 @@ void removePortCtrlEvents(MidiTrack* t) { int note = cntrl & 0x7f; cntrl &= ~0xff; - ch = MusEGlobal::drumMap[note].channel; - mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + // Default to track port if -1 and track channel if -1. + if(MusEGlobal::drumMap[note].channel != -1) + ch = MusEGlobal::drumMap[note].channel; + if(MusEGlobal::drumMap[note].port != -1) + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; cntrl |= MusEGlobal::drumMap[note].anote; } } diff --git a/muse2/muse/widgets/musewidgetsplug.cpp b/muse2/muse/widgets/musewidgetsplug.cpp index 967ab9ac..90eec237 100644 --- a/muse2/muse/widgets/musewidgetsplug.cpp +++ b/muse2/muse/widgets/musewidgetsplug.cpp @@ -130,13 +130,13 @@ MusEGlobal::GlobalConfigValues config = { QColor(0x00, 0x00, 0x00), // selected track Fg; QColor(0, 160, 255), // midiTrackLabelBg; // Med blue - QColor(0, 160, 255), // drumTrackLabelBg; // Med blue - QColor(0, 160, 255), // newDrumTrackLabelBg; // Med blue + QColor(150, 177, 189), // drumTrackLabelBg; // Pale pastel blue + QColor(116, 232, 242), // newDrumTrackLabelBg; // Light blue Qt::magenta, // waveTrackLabelBg; Qt::green, // outputTrackLabelBg; Qt::red, // inputTrackLabelBg; Qt::yellow, // groupTrackLabelBg; - QColor(120, 255, 255), // auxTrackLabelBg; // Light blue + QColor(142, 157, 6), // auxTrackLabelBg; // Med olive QColor(255, 130, 0), // synthTrackLabelBg; // Med orange QColor(220, 220, 220), // midiTrackBg; |