From 31f618e5461553bd7836677f944acfa233e5ae3c Mon Sep 17 00:00:00 2001 From: "Tim E. Real" Date: Sat, 3 Nov 2012 12:05:56 +0000 Subject: Improved: Instrument Editor, fFixed MANY bugs. Should be SOLID now. Improved: Midi controller graph 'Ctrl' popup menus. Improved: Aftertouch and PolyAftertouch (channel/key pressure) are true MusE controllers now. TODO: Still W.I.P. See ChangeLog --- muse2/ChangeLog | 9 + muse2/muse/app.cpp | 11 +- muse2/muse/app.h | 3 +- muse2/muse/ctrl/ctrlpanel.cpp | 149 +- muse2/muse/helper.cpp | 150 +- muse2/muse/icons.cpp | 4 + muse2/muse/icons.h | 1 + muse2/muse/importmidi.cpp | 2 +- muse2/muse/instruments/editinstrument.cpp | 939 +++++++--- muse2/muse/instruments/editinstrument.h | 15 +- muse2/muse/instruments/editinstrumentbase.ui | 2440 +++++++++++++------------- muse2/muse/liste/editctrlbase.ui | 124 +- muse2/muse/liste/editevent.cpp | 148 +- muse2/muse/midictrl.cpp | 55 +- muse2/muse/midictrl.h | 18 +- muse2/muse/mididev.cpp | 5 +- muse2/muse/midiedit/drumedit.cpp | 133 +- muse2/muse/midiedit/pianoroll.cpp | 133 +- muse2/muse/midiport.cpp | 4 +- muse2/muse/vst.cpp | 4 +- muse2/muse/vst.h | 4 +- muse2/muse/widgets/midi_audio_control.cpp | 8 +- muse2/muse/widgets/warn_bad_timing.ui | 2 +- muse2/share/instruments/Emu-4mbgsgmmt-sf.idf | 10 +- muse2/share/instruments/Roland-E28.idf | 10 +- muse2/share/instruments/Yamaha-CS1x.idf | 22 +- muse2/share/instruments/gs.idf | 12 +- muse2/share/instruments/xg.idf | 24 +- muse2/xpm/reddot.xpm | 36 +- 29 files changed, 2461 insertions(+), 2014 deletions(-) (limited to 'muse2') diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 6bdb943a..ca69853c 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,12 @@ +03.11.2012: + * Improved: Instrument Editor (controller tab): Redesigned. Fixed MANY bugs. Should be SOLID now. (Tim) + Two new columns: "Show in midi tracks" and "Show in drum tracks". + * Improved: Midi controller graph 'Ctrl' popup menus now unified (cascading). (Tim) + 'Edit Instrument' menu item now takes you right to the instrument and controllers tab. + * Improved: Aftertouch and PolyAftertouch (channel/key pressure) are true MusE controllers now. + Now FULLY supported in controller graphs AND in the improved Instrument Editor / Definition Files. + TODO: Still W.I.P. on Event List Editor, and recording these controllers, and other aftertouch places. + - Midi controller stuff: Fixed some bugs, added some methods and improvements. 28.10.2012: * Improved: Eliminated copious unrequired "controller" sections from songs and templates. (Tim) These controllers such as volume, pan are already always added, so it's useless to store them when "Off". diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 296b4eff..0286fc2c 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -2725,21 +2725,26 @@ again: // startEditInstrument //--------------------------------------------------------- -void MusE::startEditInstrument() +void MusE::startEditInstrument(const QString& find_instrument, EditInstrument::TabType show_tab) { if(editInstrument == 0) { editInstrument = new MusEGui::EditInstrument(this); editInstrument->show(); + editInstrument->findInstrument(find_instrument); + editInstrument->showTab(show_tab); } else { if(! editInstrument->isHidden()) editInstrument->hide(); - else + else + { editInstrument->show(); + editInstrument->findInstrument(find_instrument); + editInstrument->showTab(show_tab); + } } - } //--------------------------------------------------------- diff --git a/muse2/muse/app.h b/muse2/muse/app.h index 4831e61d..bdeaadf4 100644 --- a/muse2/muse/app.h +++ b/muse2/muse/app.h @@ -26,6 +26,7 @@ #include "config.h" #include "cobject.h" +#include #include #include @@ -336,7 +337,7 @@ class MusE : public QMainWindow void showArranger(bool); void importMidi(const QString &file); void showDidYouKnowDialog(); - void startEditInstrument(); + void startEditInstrument(const QString& find_instrument = QString(), EditInstrument::TabType show_tab = EditInstrument::Patches); void configMidiPorts(); void startEditor(MusECore::PartList*, int); diff --git a/muse2/muse/ctrl/ctrlpanel.cpp b/muse2/muse/ctrl/ctrlpanel.cpp index 8e380356..b4d089ff 100644 --- a/muse2/muse/ctrl/ctrlpanel.cpp +++ b/muse2/muse/ctrl/ctrlpanel.cpp @@ -39,6 +39,7 @@ #include "globals.h" #include "midictrl.h" #include "instruments/minstrument.h" +#include "editinstrument.h" #include "midiport.h" #include "mididev.h" #include "xml.h" @@ -184,7 +185,7 @@ void CtrlPanel::heartBeat() int outport; int chan; int cdp = ctrlcanvas->getCurDrumPitch(); - if(_track->type() == MusECore::Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdp != -1) + if(_track->type() == MusECore::Track::DRUM && _ctrl->isPerNoteController() && cdp != -1) { outport = MusEGlobal::drumMap[cdp].port; chan = MusEGlobal::drumMap[cdp].channel; @@ -280,7 +281,7 @@ void CtrlPanel::labelDoubleClicked() int outport; int chan; int cdp = ctrlcanvas->getCurDrumPitch(); - if(_track->type() == MusECore::Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdp != -1) + if(_track->type() == MusECore::Track::DRUM && _ctrl->isPerNoteController() && cdp != -1) { outport = MusEGlobal::drumMap[cdp].port; chan = MusEGlobal::drumMap[cdp].channel; @@ -385,7 +386,7 @@ void CtrlPanel::ctrlChanged(double val) int outport; int chan; int cdp = ctrlcanvas->getCurDrumPitch(); - if(_track->type() == MusECore::Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdp != -1) + if(_track->type() == MusECore::Track::DRUM && _ctrl->isPerNoteController() && cdp != -1) { outport = MusEGlobal::drumMap[cdp].port; chan = MusEGlobal::drumMap[cdp].channel; @@ -460,13 +461,13 @@ void CtrlPanel::setHWController(MusECore::MidiTrack* t, MusECore::MidiController int ch; int cdp = ctrlcanvas->getCurDrumPitch(); _dnum = _ctrl->num(); - if(_track->type() == MusECore::Track::DRUM && ((_dnum & 0xff) == 0xff) && cdp != -1) + if(_track->type() == MusECore::Track::DRUM && _ctrl->isPerNoteController() && cdp != -1) { _dnum = (_dnum & ~0xff) | MusEGlobal::drumMap[cdp].anote; mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[cdp].port]; ch = MusEGlobal::drumMap[cdp].channel; } - else if((_track->type() == MusECore::Track::NEW_DRUM || _track->type() == MusECore::Track::MIDI) && ((_dnum & 0xff) == 0xff) && cdp != -1) + else if((_track->type() == MusECore::Track::NEW_DRUM || _track->type() == MusECore::Track::MIDI) && _ctrl->isPerNoteController() && cdp != -1) { _dnum = (_dnum & ~0xff) | cdp; //FINDMICHJETZT does that work? mp = &MusEGlobal::midiPorts[_track->outPort()]; @@ -617,142 +618,32 @@ void CtrlPanel::ctrlPopupTriggered(QAction* act) MusECore::MidiTrack* track = (MusECore::MidiTrack*)(part->track()); int channel = track->outChannel(); MusECore::MidiPort* port = &MusEGlobal::midiPorts[track->outPort()]; - int curDrumPitch = ctrlcanvas->getCurDrumPitch(); - bool isDrum = track->type() == MusECore::Track::DRUM; - bool isNewDrum = (track->type() == MusECore::Track::NEW_DRUM) || (track->type() == MusECore::Track::MIDI); - MusECore::MidiInstrument* instr = port->instrument(); - MusECore::MidiControllerList* mcl = instr->controller(); - MusECore::MidiCtrlValListList* cll = port->controller(); const int min = channel << 24; const int max = min + 0x1000000; - - const int add_ins_def = max + 1; - const int add_other = max + 2; const int edit_ins = max + 3; - const int velo = max + 0x101; - int rv = act->data().toInt(); if (rv == velo) { // special case velocity emit controllerChanged(MusECore::CTRL_VELOCITY); } - else if (rv == add_ins_def) { // add new instrument controller - - PopupMenu * ctrlSubPop = new PopupMenu(this, true); // true = enable stay open - ctrlSubPop->addAction(new MenuTitleItem(tr("Instrument-defined"), ctrlSubPop)); - - // - // populate popup with all controllers available for - // current instrument - // - - for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) - { - int num = ci->second->num(); - if((num & 0xff) == 0xff) - { - if (isDrum && curDrumPitch!=-1) - num = (num & ~0xff) + MusEGlobal::drumMap[curDrumPitch].anote; - else if (isNewDrum && curDrumPitch!=-1) - num = (num & ~0xff) + curDrumPitch; //FINDMICH does this work? - else // dont show drum specific controller if not a drum track - continue; - } - - if(cll->find(channel, num) == cll->end()) - ctrlSubPop->addAction(MusECore::midiCtrlNumString(num, true) + ci->second->name())->setData(num); - } - - // Don't allow editing instrument if it's a synth - if(!port->device() || port->device()->deviceType() != MusECore::MidiDevice::SYNTH_MIDI) - ctrlSubPop->addAction(QIcon(*midi_edit_instrumentIcon), tr("Edit instrument ..."))->setData(edit_ins); - - QAction *act2 = ctrlSubPop->exec(selCtrl->mapToGlobal(QPoint(0,0))); - if (act2) - { - int rv2 = act2->data().toInt(); - - if (rv2 == edit_ins) // edit instrument - MusEGlobal::muse->startEditInstrument(); - else // select new instrument control - { - MusECore::MidiController* c; - for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) - { - c = ci->second; - int num = c->num(); - if (isDrum && ((num & 0xff) == 0xff) && curDrumPitch!=-1) - num = (num & ~0xff) + MusEGlobal::drumMap[curDrumPitch].anote; - else if (isNewDrum && ((num & 0xff) == 0xff) && curDrumPitch!=-1) - num = (num & ~0xff) + curDrumPitch; //FINDMICHJETZT does this work? - - if(num != rv2) - continue; - - if(cll->find(channel, num) == cll->end()) - { - MusECore::MidiCtrlValList* vl = new MusECore::MidiCtrlValList(num); - - cll->add(channel, vl); - emit controllerChanged(c->num()); - } - else - emit controllerChanged(c->num()); - break; - } - } - } - delete ctrlSubPop; - } - - //else if (rv == edit_ins) // edit instrument - // MusEGlobal::muse->startEditInstrument(); - - else if (rv == add_other) { // add new other controller - PopupMenu* ctrlSubPop = new PopupMenu(this, true); // true = enable stay open - ctrlSubPop->addAction(new MenuTitleItem(tr("Common Controls"), ctrlSubPop)); - - for(int num = 0; num < 127; ++num) - if(cll->find(channel, num) == cll->end()) - ctrlSubPop->addAction(MusECore::midiCtrlName(num, true))->setData(num); - QAction *act2 = ctrlSubPop->exec(selCtrl->mapToGlobal(QPoint(0,0))); - if (act2) { - int rv2 = act2->data().toInt(); - int num = rv2; - if (isDrum && ((num & 0xff) == 0xff) && curDrumPitch!=-1) - num = (num & ~0xff) + MusEGlobal::drumMap[curDrumPitch].anote; - if (isNewDrum && ((num & 0xff) == 0xff) && curDrumPitch!=-1) - num = (num & ~0xff) + curDrumPitch; //FINDMICHJETZT does this work? - - if(cll->find(channel, num) == cll->end()) - { - MusECore::MidiCtrlValList* vl = new MusECore::MidiCtrlValList(num); - - cll->add(channel, vl); - emit controllerChanged(rv2); - } - else - emit controllerChanged(rv2); - } - delete ctrlSubPop; + else if (rv == edit_ins) { // edit instrument + MusECore::MidiInstrument* instr = port->instrument(); + MusEGlobal::muse->startEditInstrument(instr ? instr->iname() : QString(), EditInstrument::Controllers); } else { // Select a control - MusECore::iMidiCtrlValList i = cll->begin(); - for (; i != cll->end(); ++i) { - MusECore::MidiCtrlValList* cl = i->second; - MusECore::MidiController* c = port->midiController(cl->num()); - if (c->num() == rv) { - emit controllerChanged(c->num()); - break; - } - } - if (i == cll->end()) { - printf("CtrlPanel: controller number %d not found!", rv); - } + MusECore::iMidiCtrlValList i = cll->find(channel, rv); + if(i == cll->end()) + { + MusECore::MidiCtrlValList* vl = new MusECore::MidiCtrlValList(rv); + cll->add(channel, vl); } - + int num = rv; + if(port->drumController(rv)) + num |= 0xff; + emit controllerChanged(num); + } } //--------------------------------------------------------- @@ -766,7 +657,7 @@ void CtrlPanel::ctrlRightClicked(const QPoint& p, int /*id*/) int cdp = ctrlcanvas->getCurDrumPitch(); int ctlnum = _ctrl->num(); - if(_track->type() == MusECore::Track::DRUM && ((ctlnum & 0xff) == 0xff) && cdp != -1) + if(_track->type() == MusECore::Track::DRUM && _ctrl->isPerNoteController() && cdp != -1) //ctlnum = (ctlnum & ~0xff) | MusEGlobal::drumMap[cdp].enote; DELETETHIS or which of them is correct? ctlnum = (ctlnum & ~0xff) | cdp; diff --git a/muse2/muse/helper.cpp b/muse2/muse/helper.cpp index e2186af9..1c4db8c7 100644 --- a/muse2/muse/helper.cpp +++ b/muse2/muse/helper.cpp @@ -888,43 +888,38 @@ int populateMidiCtrlMenu(PopupMenu* menu, MusECore::PartList* part_list, MusECor int channel = track->outChannel(); MusECore::MidiPort* port = &MusEGlobal::midiPorts[track->outPort()]; bool isDrum = track->type() == MusECore::Track::DRUM; - bool isNewDrum = (track->type() == MusECore::Track::NEW_DRUM) || (track->type() == MusECore::Track::MIDI); + bool isNewDrum = track->type() == MusECore::Track::NEW_DRUM; + bool isMidi = track->type() == MusECore::Track::MIDI; MusECore::MidiInstrument* instr = port->instrument(); MusECore::MidiControllerList* mcl = instr->controller(); - MusECore::MidiCtrlValListList* cll = port->controller(); const int min = channel << 24; const int max = min + 0x1000000; - - const int add_ins_def = max + 1; - const int add_other = max + 2; - + const int edit_ins = max + 3; const int velo = max + 0x101; -// const int polyafter = max + 0x102; -// const int after = max + 0x103; - int est_width = 0; std::list sList; typedef std::list::iterator isList; + std::set already_added_nums; for (MusECore::iMidiCtrlValList it = cll->lower_bound(min); it != cll->lower_bound(max); ++it) { MusECore::MidiCtrlValList* cl = it->second; MusECore::MidiController* c = port->midiController(cl->num()); - bool isDrumCtrl = ((c->num() & 0xff) == 0xff); - - // dont show drum specific controller if not a drum track + bool isDrumCtrl = (c->isPerNoteController()); + int show = c->showInTracks(); + int cnum = c->num(); + int num = cl->num(); if (isDrumCtrl) { + // Only show controller for current pitch: if (isDrum) { - // only show controller for curDrumPitch: - if ((curDrumPitch == -1) || ((cl->num() & 0xff) != MusEGlobal::drumMap[curDrumPitch].anote)) + if ((curDrumPitch == -1) || ((num & 0xff) != MusEGlobal::drumMap[curDrumPitch].anote)) continue; } - else if (isNewDrum) + else if (isNewDrum || isMidi) { - // only show controller for curDrumPitch: FINDMICH does this work? - if ((curDrumPitch == -1) || ((cl->num() & 0xff) != curDrumPitch)) + if ((curDrumPitch == -1) || ((num & 0xff) != curDrumPitch)) // FINDMICH does this work? continue; } else @@ -932,14 +927,11 @@ int populateMidiCtrlMenu(PopupMenu* menu, MusECore::PartList* part_list, MusECor } isList i = sList.begin(); for (; i != sList.end(); ++i) { - //if (i->s == c->name()) - if (i->num == c->num()) + if (i->num == num) break; } - //printf("\n** c->num():%d cl->num:%d\n", c->num(), cl->num()); if (i == sList.end()) { - bool off = cl->hwVal() == MusECore::CTRL_VAL_UNKNOWN; // Does it have a value or is it 'off' bool used = false; for (MusECore::iPart ip = part_list->begin(); ip != part_list->end(); ++ip) { MusECore::EventList* el = ip->second->events(); @@ -947,21 +939,17 @@ int populateMidiCtrlMenu(PopupMenu* menu, MusECore::PartList* part_list, MusECor MusECore::Event e = ie->second; if(e.type() != MusECore::Controller) continue; - //e.dump(); int ctl_num = e.dataA(); - if(!isNewDrum) + // Is it a drum controller event, according to the track port's instrument? + MusECore::MidiController *mc = port->drumController(ctl_num); + if(mc) { - // Is it a drum controller event, according to the track port's instrument? - MusECore::MidiController *mc = port->drumController(ctl_num); - if(mc) - { - if((ctl_num & 0xff) != curDrumPitch) - continue; - // Change the controller event's index into the drum map to an instrument note. + if((ctl_num & 0xff) != curDrumPitch) + continue; + if(isDrum) ctl_num = (ctl_num & ~0xff) | MusEGlobal::drumMap[ctl_num & 0x7f].anote; - } } - if(ctl_num == cl->num()) + if(ctl_num == num) { used = true; break; @@ -971,15 +959,21 @@ int populateMidiCtrlMenu(PopupMenu* menu, MusECore::PartList* part_list, MusECor if (used) break; } - bool isinstr = ( mcl->find(c->num()) != mcl->end() ); - int cnum = c->num(); + bool off = cl->hwVal() == MusECore::CTRL_VAL_UNKNOWN; // Does it have a value or is it 'off'? + // Filter if not used and off. But if there's something there, we must show it. + if(!used && off && + (((isDrumCtrl || isNewDrum) && !(show & MusECore::MidiController::ShowInDrum)) || + (isMidi && !(show & MusECore::MidiController::ShowInMidi)))) + continue; + bool isinstr = mcl->find(cnum) != mcl->end(); // Need to distinguish between global default controllers and // instrument defined controllers. Instrument takes priority over global // ie they 'overtake' definition of a global controller such that the // global def is no longer available. - sList.push_back(CI(cnum, + sList.push_back(CI(num, isinstr ? MusECore::midiCtrlNumString(cnum, true) + c->name() : MusECore::midiCtrlName(cnum, true), used, off, isinstr)); + already_added_nums.insert(num); } } @@ -987,19 +981,69 @@ int populateMidiCtrlMenu(PopupMenu* menu, MusECore::PartList* part_list, MusECor int fmw = menu->fontMetrics().width(stext); if(fmw > est_width) est_width = fmw; - menu->addAction(new MenuTitleItem(stext, menu)); - // Add instrument-defined controllers. - for (isList i = sList.begin(); i != sList.end(); ++i) + // Don't allow editing instrument if it's a synth + if(!port->device() || port->device()->deviceType() != MusECore::MidiDevice::SYNTH_MIDI) + { + stext = QWidget::tr("Edit instrument ..."); + fmw = menu->fontMetrics().width(stext); + if(fmw > est_width) + est_width = fmw; + menu->addAction(QIcon(*midi_edit_instrumentIcon), QWidget::tr("Edit instrument ..."))->setData(edit_ins); + menu->addSeparator(); + } + + // + // populate popup with all controllers available for + // current instrument + // + + stext = QWidget::tr("Add"); + fmw = menu->fontMetrics().width(stext); + if(fmw > est_width) + est_width = fmw; + PopupMenu * ctrlSubPop = new PopupMenu(stext, menu, true); // true = enable stay open + for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) + { + int show = ci->second->showInTracks(); + if(((isDrum || isNewDrum) && !(show & MusECore::MidiController::ShowInDrum)) || + (isMidi && !(show & MusECore::MidiController::ShowInMidi))) + continue; + int cnum = ci->second->num(); + int num = cnum; + if(ci->second->isPerNoteController()) + { + if (isDrum && curDrumPitch!=-1) + num = (cnum & ~0xff) | MusEGlobal::drumMap[curDrumPitch].anote; + else if ((isNewDrum || isMidi) && curDrumPitch!=-1) + num = (cnum & ~0xff) | curDrumPitch; //FINDMICH does this work? + else + continue; + } + + // If it's not already in the parent menu... + if(cll->find(channel, num) == cll->end()) + { + ctrlSubPop->addAction(MusECore::midiCtrlNumString(cnum, true) + ci->second->name())->setData(num); + already_added_nums.insert(num); //cnum); + } + } + + menu->addMenu(ctrlSubPop); + + menu->addSeparator(); + + // Add instrument-defined controllers: + for (isList i = sList.begin(); i != sList.end(); ++i) { if(!i->instrument) continue; - + fmw = menu->fontMetrics().width(i->s); if(fmw > est_width) est_width = fmw; - + if (i->used && !i->off) menu->addAction(QIcon(*orangedotIcon), i->s)->setData(i->num); else if (i->used) @@ -1010,20 +1054,28 @@ int populateMidiCtrlMenu(PopupMenu* menu, MusECore::PartList* part_list, MusECor menu->addAction(i->s)->setData(i->num); } - stext = QWidget::tr("Add ..."); + stext = QWidget::tr("Others"); fmw = menu->fontMetrics().width(stext); if(fmw > est_width) est_width = fmw; - menu->addAction(QIcon(*configureIcon), stext)->setData(add_ins_def); + menu->addAction(new MenuTitleItem(stext, menu)); - menu->addSeparator(); - - stext = QWidget::tr("Others"); + // Add a.k.a. Common Controls not found in instrument: + stext = QWidget::tr("Common Controls"); fmw = menu->fontMetrics().width(stext); if(fmw > est_width) est_width = fmw; - menu->addAction(new MenuTitleItem(stext, menu)); + PopupMenu* ccSubPop = new PopupMenu(stext, menu, true); // true = enable stay open + for(int num = 0; num < 127; ++num) + // If it's not already in the parent menu... + if(already_added_nums.find(num) == already_added_nums.end()) + ccSubPop->addAction(MusECore::midiCtrlName(num, true))->setData(num); + + menu->addMenu(ccSubPop); + + menu->addSeparator(); + // Add the special case velocity: stext = QWidget::tr("Velocity"); fmw = menu->fontMetrics().width(stext); if(fmw > est_width) @@ -1050,12 +1102,6 @@ int populateMidiCtrlMenu(PopupMenu* menu, MusECore::PartList* part_list, MusECor menu->addAction(i->s)->setData(i->num); } - stext = QWidget::tr("Add ..."); - fmw = menu->fontMetrics().width(stext); - if(fmw > est_width) - est_width = fmw; - menu->addAction(QIcon(*configureIcon), stext)->setData(add_other); - est_width += 60; // Add about 60 for the coloured lights on the left. return est_width; diff --git a/muse2/muse/icons.cpp b/muse2/muse/icons.cpp index a3dfbf50..45aff5ee 100644 --- a/muse2/muse/icons.cpp +++ b/muse2/muse/icons.cpp @@ -186,6 +186,7 @@ #include "xpm/redled.xpm" #include "xpm/darkredled.xpm" #include "xpm/greendot.xpm" +#include "xpm/reddot.xpm" //#include "xpm/darkgreendot.xpm" #include "xpm/bluedot.xpm" #include "xpm/graydot.xpm" @@ -428,6 +429,7 @@ QPixmap* toggle_small_Icon; QPixmap* redLedIcon; QPixmap* darkRedLedIcon; QPixmap* greendotIcon; +QPixmap* reddotIcon; //QPixmap* darkgreendotIcon; QPixmap* graydotIcon; QPixmap* bluedotIcon; @@ -653,6 +655,7 @@ void initIcons() redLedIcon = new MPIXMAP(redled_xpm, NULL); darkRedLedIcon = new MPIXMAP(darkredled_xpm, NULL); greendotIcon = new MPIXMAP(greendot_xpm, NULL); + reddotIcon = new MPIXMAP(reddot_xpm, NULL); //darkgreendotIcon = new MPIXMAP(darkgreendot_xpm, NULL); bluedotIcon = new MPIXMAP(bluedot_xpm, NULL); graydotIcon = new MPIXMAP(graydot_xpm, NULL); @@ -894,6 +897,7 @@ void deleteIcons() delete redLedIcon; delete darkRedLedIcon; delete greendotIcon; + delete reddotIcon; //delete darkgreendotIcon; delete bluedotIcon; delete graydotIcon; diff --git a/muse2/muse/icons.h b/muse2/muse/icons.h index 36a780ae..04a8df26 100644 --- a/muse2/muse/icons.h +++ b/muse2/muse/icons.h @@ -167,6 +167,7 @@ extern QPixmap* toggle_small_Icon; extern QPixmap* redLedIcon; extern QPixmap* darkRedLedIcon; extern QPixmap* greendotIcon; +extern QPixmap* reddotIcon; //extern QPixmap* darkgreendotIcon; extern QPixmap* graydotIcon; extern QPixmap* bluedotIcon; diff --git a/muse2/muse/importmidi.cpp b/muse2/muse/importmidi.cpp index 73f2e071..e22d865e 100644 --- a/muse2/muse/importmidi.cpp +++ b/muse2/muse/importmidi.cpp @@ -526,7 +526,7 @@ void MusE::importController(int channel, MusECore::MidiPort* mport, int n) break; } // wildcard? - if (((cn & 0xff) == 0xff) && ((cn & ~0xff) == (n & ~0xff))) { + if (mc->isPerNoteController() && ((cn & ~0xff) == (n & ~0xff))) { ctrl = i->second; break; } diff --git a/muse2/muse/instruments/editinstrument.cpp b/muse2/muse/instruments/editinstrument.cpp index 57c466b8..3dc4488d 100644 --- a/muse2/muse/instruments/editinstrument.cpp +++ b/muse2/muse/instruments/editinstrument.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include "editinstrument.h" @@ -45,7 +46,7 @@ #include "midictrl.h" #include "gconfig.h" #include "icons.h" - +#include "popupmenu.h" #include "dlist.h" #include "drummap.h" #include "header.h" @@ -59,7 +60,7 @@ namespace MusEGui { enum { COL_CNAME = 0, COL_TYPE, - COL_HNUM, COL_LNUM, COL_MIN, COL_MAX, COL_DEF + COL_HNUM, COL_LNUM, COL_MIN, COL_MAX, COL_DEF, COL_SHOW_MIDI, COL_SHOW_DRUM }; //--------------------------------------------------------- @@ -88,12 +89,6 @@ EditInstrument::EditInstrument(QWidget* parent, Qt::WFlags fl) checkBoxXG->setVisible(false); // populate instrument list - // Populate common controller list. - for(int i = 0; i < 128; ++i) - { - QListWidgetItem *lci = new QListWidgetItem(MusECore::midiCtrlName(i)); - listController->addItem(lci); - } oldMidiInstrument = 0; oldPatchItem = 0; for (MusECore::iMidiInstrument i = MusECore::midiInstruments.begin(); i != MusECore::midiInstruments.end(); ++i) { @@ -132,6 +127,7 @@ EditInstrument::EditInstrument(QWidget* parent, Qt::WFlags fl) dlist_header->hideSection(COL_MUTE); dlist_header->hide(); + ctrlValidLabel->setPixmap(*greendotIcon); connect(patchFromBox, SIGNAL(valueChanged(int)), this, SLOT(patchCollectionSpinboxChanged(int))); connect(patchToBox, SIGNAL(valueChanged(int)), this, SLOT(patchCollectionSpinboxChanged(int))); @@ -193,17 +189,18 @@ EditInstrument::EditInstrument(QWidget* parent, Qt::WFlags fl) connect(deleteController, SIGNAL(clicked()), SLOT(deleteControllerClicked())); connect(newController, SIGNAL(clicked()), SLOT(newControllerClicked())); connect(addController, SIGNAL(clicked()), SLOT(addControllerClicked())); - connect(listController, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(addControllerClicked())); - connect(ctrlType,SIGNAL(activated(int)), SLOT(ctrlTypeChanged(int))); + connect(ctrlType,SIGNAL(activated(int)), SLOT(ctrlTypeChanged())); connect(ctrlName, SIGNAL(returnPressed()), SLOT(ctrlNameReturn())); connect(ctrlName, SIGNAL(lostFocus()), SLOT(ctrlNameReturn())); - connect(spinBoxHCtrlNo, SIGNAL(valueChanged(int)), SLOT(ctrlHNumChanged(int))); - connect(spinBoxLCtrlNo, SIGNAL(valueChanged(int)), SLOT(ctrlLNumChanged(int))); + connect(spinBoxHCtrlNo, SIGNAL(valueChanged(int)), SLOT(ctrlNumChanged())); + connect(spinBoxLCtrlNo, SIGNAL(valueChanged(int)), SLOT(ctrlNumChanged())); connect(spinBoxMin, SIGNAL(valueChanged(int)), SLOT(ctrlMinChanged(int))); connect(spinBoxMax, SIGNAL(valueChanged(int)), SLOT(ctrlMaxChanged(int))); connect(spinBoxDefault, SIGNAL(valueChanged(int)), SLOT(ctrlDefaultChanged(int))); connect(nullParamSpinBoxH, SIGNAL(valueChanged(int)), SLOT(ctrlNullParamHChanged(int))); connect(nullParamSpinBoxL, SIGNAL(valueChanged(int)), SLOT(ctrlNullParamLChanged(int))); + connect(ctrlShowInMidi,SIGNAL(stateChanged(int)), SLOT(ctrlShowInMidiChanged(int))); + connect(ctrlShowInDrum,SIGNAL(stateChanged(int)), SLOT(ctrlShowInDrumChanged(int))); connect(tabWidget3, SIGNAL(currentChanged(QWidget*)), SLOT(tabChanged(QWidget*))); connect(sysexList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), @@ -212,7 +209,23 @@ EditInstrument::EditInstrument(QWidget* parent, Qt::WFlags fl) connect(newSysex, SIGNAL(clicked()), SLOT(newSysexClicked())); } +void EditInstrument::findInstrument(const QString& find_instrument) +{ + if(find_instrument.isEmpty()) + return; + QList found = instrumentList->findItems(find_instrument, Qt::MatchExactly); + if(!found.isEmpty()) + instrumentList->setCurrentItem(found.at(0)); +} + +void EditInstrument::showTab(TabType n) +{ + if(n >= tabWidget3->count()) + return; + tabWidget3->setCurrentIndex(n); +} + void EditInstrument::patchCollectionSpinboxChanged(int) { if (patchFromBox->value() > patchToBox->value()) @@ -1608,6 +1621,8 @@ QTreeWidgetItem* EditInstrument::addControllerToView(MusECore::MidiController* m def.setNum(defval); break; case MusECore::MidiController::Pitch: + case MusECore::MidiController::PolyAftertouch: + case MusECore::MidiController::Aftertouch: hnum = "---"; lnum = "---"; min.setNum(mctrl->minVal()); @@ -1634,7 +1649,17 @@ QTreeWidgetItem* EditInstrument::addControllerToView(MusECore::MidiController* m break; } - QTreeWidgetItem* ci = new QTreeWidgetItem(viewController, QStringList() << mctrl->name() << int2ctrlType(t) << hnum << lnum << min << max << def); + QString show_midi, show_drum; + if(mctrl->showInTracks() & MusECore::MidiController::ShowInMidi) + show_midi = "X"; + if(mctrl->showInTracks() & MusECore::MidiController::ShowInDrum) + show_drum = "X"; + QTreeWidgetItem* ci = new QTreeWidgetItem(viewController, + QStringList() << mctrl->name() << int2ctrlType(t) << hnum << lnum << min << max << def << show_midi << show_drum); + ci->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter); + ci->setTextAlignment(1, Qt::AlignLeft | Qt::AlignVCenter); + for(int i = 2; i < 9; ++i) + ci->setTextAlignment(i, Qt::AlignRight | Qt::AlignVCenter); QVariant v = qVariantFromValue((void*)(mctrl)); ci->setData(0, Qt::UserRole, v); @@ -1665,7 +1690,7 @@ void EditInstrument::controllerChanged() int ctrlH = (c->num() >> 8) & 0x7f; int ctrlL = c->num() & 0x7f; - if((c->num() & 0xff) == 0xff) + if(c->isPerNoteController()) ctrlL = -1; MusECore::MidiController::ControllerType type = MusECore::midiControllerType(c->num()); @@ -1673,6 +1698,9 @@ void EditInstrument::controllerChanged() ctrlType->blockSignals(true); ctrlType->setCurrentIndex(type); ctrlType->blockSignals(false); + + ctrlShowInMidi->setChecked(c->showInTracks() & MusECore::MidiController::ShowInMidi); + ctrlShowInDrum->setChecked(c->showInTracks() & MusECore::MidiController::ShowInDrum); spinBoxHCtrlNo->blockSignals(true); spinBoxLCtrlNo->blockSignals(true); @@ -1736,6 +1764,20 @@ void EditInstrument::controllerChanged() spinBoxMax->setValue(c->maxVal()); enableDefaultControls(true, false); break; + case MusECore::MidiController::PolyAftertouch: + case MusECore::MidiController::Aftertouch: + spinBoxHCtrlNo->setEnabled(false); + spinBoxLCtrlNo->setEnabled(false); + spinBoxHCtrlNo->setValue(0); + spinBoxLCtrlNo->setValue(0); + spinBoxMin->setEnabled(true); + spinBoxMax->setEnabled(true); + spinBoxMin->setRange(0, 127); + spinBoxMax->setRange(0, 127); + spinBoxMin->setValue(c->minVal()); + spinBoxMax->setValue(c->maxVal()); + enableDefaultControls(true, false); + break; case MusECore::MidiController::Program: spinBoxHCtrlNo->setEnabled(false); spinBoxLCtrlNo->setEnabled(false); @@ -1778,6 +1820,9 @@ void EditInstrument::controllerChanged() spinBoxMin->blockSignals(false); spinBoxMax->blockSignals(false); spinBoxDefault->blockSignals(false); + + ctrlValidLabel->setPixmap(*greendotIcon); + enableNonCtrlControls(true); } //--------------------------------------------------------- @@ -1794,9 +1839,6 @@ void EditInstrument::ctrlNameReturn() QString cName = ctrlName->text(); - if(c->name() == cName) - return; - MusECore::MidiControllerList* cl = workingInstrument.controller(); for(MusECore::ciMidiController ic = cl->begin(); ic != cl->end(); ++ic) { @@ -1818,6 +1860,9 @@ void EditInstrument::ctrlNameReturn() } } + if(c->name() == cName) + return; + c->setName(ctrlName->text()); item->setText(COL_CNAME, ctrlName->text()); workingInstrument.setDirty(true); @@ -1827,172 +1872,286 @@ void EditInstrument::ctrlNameReturn() // ctrlTypeChanged //--------------------------------------------------------- -void EditInstrument::ctrlTypeChanged(int idx) +void EditInstrument::ctrlTypeChanged() { QTreeWidgetItem* item = viewController->currentItem(); if (item == 0) return; - MusECore::MidiController::ControllerType t = (MusECore::MidiController::ControllerType)idx; + MusECore::MidiController::ControllerType t = MusECore::ctrlType2Int(ctrlType->currentText()); MusECore::MidiController* c = (MusECore::MidiController*)item->data(0, Qt::UserRole).value(); + //if(t == MusECore::midiControllerType(c->num())) + // return; + + // REMOVE Tim. + //if(c->showInTracks() & MusECore::MidiController::ShowInMidi) + // item->setText(COL_SHOW_MIDI, "Y"); + //if(c->showInTracks() & MusECore::MidiController::ShowInDrum) + // item->setText(COL_SHOW_DRUM, "Y"); + + int hnum = 0, lnum = 0; + +// spinBoxMin->blockSignals(true); +// spinBoxMax->blockSignals(true); +// spinBoxDefault->blockSignals(true); +// + switch (t) { + case MusECore::MidiController::Controller7: + spinBoxHCtrlNo->setEnabled(false); + spinBoxLCtrlNo->setEnabled(true); +// spinBoxMin->setEnabled(true); +// spinBoxMax->setEnabled(true); +// enableDefaultControls(true, false); +// spinBoxMin->setRange(-128, 127); +// spinBoxMax->setRange(-128, 127); +// spinBoxMin->setValue(0); +// spinBoxMax->setValue(127); +// spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); +// spinBoxDefault->setValue(spinBoxDefault->minimum()); + lnum = spinBoxLCtrlNo->value(); + break; + case MusECore::MidiController::RPN: + case MusECore::MidiController::NRPN: + spinBoxHCtrlNo->setEnabled(true); + spinBoxLCtrlNo->setEnabled(true); +// spinBoxMin->setEnabled(true); +// spinBoxMax->setEnabled(true); +// enableDefaultControls(true, false); +// spinBoxMin->setRange(-128, 127); +// spinBoxMax->setRange(-128, 127); +// spinBoxMin->setValue(0); +// spinBoxMax->setValue(127); +// spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); +// spinBoxDefault->setValue(spinBoxDefault->minimum()); + hnum = spinBoxHCtrlNo->value(); + lnum = spinBoxLCtrlNo->value(); + break; + case MusECore::MidiController::Controller14: + case MusECore::MidiController::RPN14: + case MusECore::MidiController::NRPN14: + spinBoxHCtrlNo->setEnabled(true); + spinBoxLCtrlNo->setEnabled(true); +// spinBoxMin->setEnabled(true); +// spinBoxMax->setEnabled(true); +// enableDefaultControls(true, false); +// spinBoxMin->setRange(-16384, 16383); +// spinBoxMax->setRange(-16384, 16383); +// spinBoxMin->setValue(0); +// spinBoxMax->setValue(16383); +// spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); +// spinBoxDefault->setValue(spinBoxDefault->minimum()); + hnum = spinBoxHCtrlNo->value(); + lnum = spinBoxLCtrlNo->value(); + break; + case MusECore::MidiController::Pitch: + spinBoxHCtrlNo->setEnabled(false); + spinBoxLCtrlNo->setEnabled(false); +// spinBoxMin->setEnabled(true); +// spinBoxMax->setEnabled(true); +// enableDefaultControls(true, false); +// spinBoxMin->setRange(-8192, 8191); +// spinBoxMax->setRange(-8192, 8191); +// spinBoxMin->setValue(-8192); +// spinBoxMax->setValue(8191); +// spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); +// spinBoxDefault->setValue(spinBoxDefault->minimum()); + break; + case MusECore::MidiController::PolyAftertouch: + case MusECore::MidiController::Aftertouch: + spinBoxHCtrlNo->setEnabled(false); + spinBoxLCtrlNo->setEnabled(false); +// spinBoxMin->setEnabled(true); +// spinBoxMax->setEnabled(true); +// enableDefaultControls(true, false); +// spinBoxMin->setRange(0, 127); +// spinBoxMax->setRange(0, 127); +// spinBoxMin->setValue(0); +// spinBoxMax->setValue(127); +// spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); +// spinBoxDefault->setValue(spinBoxDefault->minimum()); + break; + case MusECore::MidiController::Program: + spinBoxHCtrlNo->setEnabled(false); + spinBoxLCtrlNo->setEnabled(false); +// spinBoxMin->setEnabled(false); +// spinBoxMax->setEnabled(false); +// enableDefaultControls(false, true); +// spinBoxMin->setRange(0, 0); +// spinBoxMax->setRange(0, 0); +// spinBoxMin->setValue(0); +// spinBoxMax->setValue(0); +// spinBoxDefault->setRange(0, 0); +// spinBoxDefault->setValue(0); + break; + // Shouldn't happen... + default: + spinBoxHCtrlNo->setEnabled(false); + spinBoxLCtrlNo->setEnabled(false); + spinBoxMin->setEnabled(false); + spinBoxMax->setEnabled(false); + enableDefaultControls(false, false); + spinBoxMin->blockSignals(false); + spinBoxMax->blockSignals(false); + return; + break; + } + +// spinBoxMin->blockSignals(false); +// spinBoxMax->blockSignals(false); +// spinBoxDefault->blockSignals(false); +// + int new_num = MusECore::MidiController::genNum(t, hnum, lnum); + MusECore::MidiControllerList* cl = workingInstrument.controller(); + // Check if either a per-note controller, or else a regular controller already exists. + if(!cl->ctrlAvailable(new_num, c)) + { + ctrlValidLabel->setPixmap(*reddotIcon); + enableNonCtrlControls(false); + return; + } + + ctrlValidLabel->setPixmap(*greendotIcon); + if(t == MusECore::midiControllerType(c->num())) + { + enableNonCtrlControls(true); return; + } - item->setText(COL_TYPE, ctrlType->currentText()); + cl->erase(c->num()); + c->setNum(new_num); + cl->add(c); - int hnum = 0, lnum = 0; + enableNonCtrlControls(true); + item->setText(COL_TYPE, ctrlType->currentText()); + spinBoxMin->blockSignals(true); spinBoxMax->blockSignals(true); spinBoxDefault->blockSignals(true); - + switch (t) { case MusECore::MidiController::Controller7: - spinBoxHCtrlNo->setEnabled(false); - spinBoxLCtrlNo->setEnabled(true); - spinBoxMin->setEnabled(true); - spinBoxMax->setEnabled(true); - enableDefaultControls(true, false); + //spinBoxMin->setEnabled(true); + //spinBoxMax->setEnabled(true); + //enableDefaultControls(true, false); spinBoxMin->setRange(-128, 127); spinBoxMax->setRange(-128, 127); - spinBoxMin->setValue(0); spinBoxMax->setValue(127); spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); - spinBoxDefault->setValue(spinBoxDefault->minimum()); - lnum = spinBoxLCtrlNo->value(); - if(lnum == -1) item->setText(COL_LNUM, QString("*")); - else + else item->setText(COL_LNUM, QString().setNum(lnum)); item->setText(COL_HNUM, QString("---")); item->setText(COL_MIN, QString().setNum(spinBoxMin->value())); item->setText(COL_MAX, QString().setNum(spinBoxMax->value())); item->setText(COL_DEF, QString("---")); break; - case MusECore::MidiController::RPN: case MusECore::MidiController::NRPN: - spinBoxHCtrlNo->setEnabled(true); - spinBoxLCtrlNo->setEnabled(true); - spinBoxMin->setEnabled(true); - spinBoxMax->setEnabled(true); - enableDefaultControls(true, false); + //spinBoxMin->setEnabled(true); + //spinBoxMax->setEnabled(true); + //enableDefaultControls(true, false); spinBoxMin->setRange(-128, 127); spinBoxMax->setRange(-128, 127); - spinBoxMin->setValue(0); spinBoxMax->setValue(127); spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); spinBoxDefault->setValue(spinBoxDefault->minimum()); - - hnum = spinBoxHCtrlNo->value(); - lnum = spinBoxLCtrlNo->value(); - if(lnum == -1) item->setText(COL_LNUM, QString("*")); - else + else item->setText(COL_LNUM, QString().setNum(lnum)); item->setText(COL_HNUM, QString().setNum(hnum)); item->setText(COL_MIN, QString().setNum(spinBoxMin->value())); item->setText(COL_MAX, QString().setNum(spinBoxMax->value())); item->setText(COL_DEF, QString("---")); break; - case MusECore::MidiController::Controller14: case MusECore::MidiController::RPN14: case MusECore::MidiController::NRPN14: - spinBoxHCtrlNo->setEnabled(true); - spinBoxLCtrlNo->setEnabled(true); - spinBoxMin->setEnabled(true); - spinBoxMax->setEnabled(true); - enableDefaultControls(true, false); + //spinBoxMin->setEnabled(true); + //spinBoxMax->setEnabled(true); + //enableDefaultControls(true, false); spinBoxMin->setRange(-16384, 16383); spinBoxMax->setRange(-16384, 16383); - spinBoxMin->setValue(0); spinBoxMax->setValue(16383); spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); spinBoxDefault->setValue(spinBoxDefault->minimum()); - - hnum = spinBoxHCtrlNo->value(); - lnum = spinBoxLCtrlNo->value(); if(lnum == -1) item->setText(COL_LNUM, QString("*")); - else + else item->setText(COL_LNUM, QString().setNum(lnum)); item->setText(COL_HNUM, QString().setNum(hnum)); item->setText(COL_MIN, QString().setNum(spinBoxMin->value())); item->setText(COL_MAX, QString().setNum(spinBoxMax->value())); item->setText(COL_DEF, QString("---")); break; - case MusECore::MidiController::Pitch: - spinBoxHCtrlNo->setEnabled(false); - spinBoxLCtrlNo->setEnabled(false); - spinBoxMin->setEnabled(true); - spinBoxMax->setEnabled(true); - enableDefaultControls(true, false); + //spinBoxMin->setEnabled(true); + //spinBoxMax->setEnabled(true); + //enableDefaultControls(true, false); spinBoxMin->setRange(-8192, 8191); spinBoxMax->setRange(-8192, 8191); - spinBoxMin->setValue(-8192); spinBoxMax->setValue(8191); spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); spinBoxDefault->setValue(spinBoxDefault->minimum()); - - item->setText(COL_LNUM, QString("---")); - item->setText(COL_HNUM, QString("---")); - item->setText(COL_MIN, QString().setNum(spinBoxMin->value())); - item->setText(COL_MAX, QString().setNum(spinBoxMax->value())); - item->setText(COL_DEF, QString("---")); + item->setText(COL_LNUM, QString("---")); + item->setText(COL_HNUM, QString("---")); + item->setText(COL_MIN, QString().setNum(spinBoxMin->value())); + item->setText(COL_MAX, QString().setNum(spinBoxMax->value())); + item->setText(COL_DEF, QString("---")); + break; + case MusECore::MidiController::PolyAftertouch: + case MusECore::MidiController::Aftertouch: + //spinBoxMin->setEnabled(true); + //spinBoxMax->setEnabled(true); + //enableDefaultControls(true, false); + spinBoxMin->setRange(0, 127); + spinBoxMax->setRange(0, 127); + spinBoxMin->setValue(0); + spinBoxMax->setValue(127); + spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); + spinBoxDefault->setValue(spinBoxDefault->minimum()); + item->setText(COL_LNUM, QString("---")); + item->setText(COL_HNUM, QString("---")); + item->setText(COL_MIN, QString().setNum(spinBoxMin->value())); + item->setText(COL_MAX, QString().setNum(spinBoxMax->value())); + item->setText(COL_DEF, QString("---")); break; - case MusECore::MidiController::Program: - spinBoxHCtrlNo->setEnabled(false); - spinBoxLCtrlNo->setEnabled(false); - spinBoxMin->setEnabled(false); - spinBoxMax->setEnabled(false); - enableDefaultControls(false, true); + //spinBoxMin->setEnabled(false); + //spinBoxMax->setEnabled(false); + //enableDefaultControls(false, true); spinBoxMin->setRange(0, 0); spinBoxMax->setRange(0, 0); - spinBoxMin->setValue(0); spinBoxMax->setValue(0); spinBoxDefault->setRange(0, 0); spinBoxDefault->setValue(0); - - item->setText(COL_LNUM, QString("---")); - item->setText(COL_HNUM, QString("---")); - item->setText(COL_MIN, QString("---")); - item->setText(COL_MAX, QString("---")); - item->setText(COL_DEF, QString("---")); + item->setText(COL_LNUM, QString("---")); + item->setText(COL_HNUM, QString("---")); + item->setText(COL_MIN, QString("---")); + item->setText(COL_MAX, QString("---")); + item->setText(COL_DEF, QString("---")); break; - // Shouldn't happen... default: - spinBoxHCtrlNo->setEnabled(false); - spinBoxLCtrlNo->setEnabled(false); - spinBoxMin->setEnabled(false); - spinBoxMax->setEnabled(false); - enableDefaultControls(false, false); - - spinBoxMin->blockSignals(false); - spinBoxMax->blockSignals(false); return; - break; - } - + } + spinBoxMin->blockSignals(false); spinBoxMax->blockSignals(false); spinBoxDefault->blockSignals(false); - - c->setNum(MusECore::MidiController::genNum(t, hnum, lnum)); - + + setDefaultPatchControls(0xffffff); if(t == MusECore::MidiController::Program) { @@ -2013,6 +2172,60 @@ void EditInstrument::ctrlTypeChanged(int idx) workingInstrument.setDirty(true); } +//--------------------------------------------------------- +// ctrlShowInMidiChanged +//--------------------------------------------------------- + +void EditInstrument::ctrlShowInMidiChanged(int state) + { + QTreeWidgetItem* item = viewController->currentItem(); + if (item == 0) + return; + MusECore::MidiController* c = (MusECore::MidiController*)item->data(0, Qt::UserRole).value(); + int show = c->showInTracks(); + if((show & MusECore::MidiController::ShowInMidi) == (state == Qt::Checked)) + return; + if(state == Qt::Checked) + { + c->setShowInTracks(show | MusECore::MidiController::ShowInMidi); + item->setText(COL_SHOW_MIDI, "X"); + } + else + { + c->setShowInTracks(show & ~MusECore::MidiController::ShowInMidi); + item->setText(COL_SHOW_MIDI, ""); + } + workingInstrument.setDirty(true); + } + +//--------------------------------------------------------- +// ctrlShowInMidiChanged +//--------------------------------------------------------- + +void EditInstrument::ctrlShowInDrumChanged(int state) + { + QTreeWidgetItem* item = viewController->currentItem(); + if (item == 0) + return; + MusECore::MidiController* c = (MusECore::MidiController*)item->data(0, Qt::UserRole).value(); + int show = c->showInTracks(); + if((show & MusECore::MidiController::ShowInDrum) == (state == Qt::Checked)) + return; + if(state == Qt::Checked) + { + c->setShowInTracks(show | MusECore::MidiController::ShowInDrum); + item->setText(COL_SHOW_DRUM, "X"); + } + else + { + c->setShowInTracks(show & ~MusECore::MidiController::ShowInDrum); + item->setText(COL_SHOW_DRUM, ""); + } + workingInstrument.setDirty(true); + } + +// REMOVE Tim. +/* //--------------------------------------------------------- // ctrlHNumChanged //--------------------------------------------------------- @@ -2020,15 +2233,39 @@ void EditInstrument::ctrlTypeChanged(int idx) void EditInstrument::ctrlHNumChanged(int val) { QTreeWidgetItem* item = viewController->currentItem(); - if (item == 0) return; + MusECore::MidiController* c = (MusECore::MidiController*)item->data(0, Qt::UserRole).value(); + int n = spinBoxLCtrlNo->isEnabled() ? spinBoxLCtrlNo->value() & 0xff : c->num() & 0xff; + MusECore::MidiControllerList* cl = workingInstrument.controller(); + MusECore::MidiController::ControllerType t = MusECore::ctrlType2Int(ctrlType->currentText()); + int tn = MusECore::midiCtrlTerms2Number(t); + if((tn & 0xffff0000) == MusECore::CTRL_INTERNAL_OFFSET) // Error, should not happen. + return; + int new_num = tn | ((val & 0xff) << 8) | n; + // Check if either a per-note controller, or else a regular controller already exists. + if(!cl->ctrlAvailable(new_num, c)) + { + ctrlValidLabel->setPixmap(*reddotIcon); + enableNonCtrlControls(false); + return; + } + ctrlValidLabel->setPixmap(*greendotIcon); + enableNonCtrlControls(true); + cl->erase(c->num()); + c->setNum(new_num); + cl->add(c); QString s; + if(c->isPerNoteController()) + item->setText(COL_LNUM, QString("*")); + else + { + s.setNum(n); + item->setText(COL_LNUM, s); + } s.setNum(val); - MusECore::MidiController* c = (MusECore::MidiController*)item->data(0, Qt::UserRole).value(); - int n = c->num() & 0x7fff00ff; - c->setNum(n | ((val & 0xff) << 8)); item->setText(COL_HNUM, s); + item->setText(COL_TYPE, ctrlType->currentText()); workingInstrument.setDirty(true); } @@ -2039,20 +2276,136 @@ void EditInstrument::ctrlHNumChanged(int val) void EditInstrument::ctrlLNumChanged(int val) { QTreeWidgetItem* item = viewController->currentItem(); - if (item == 0) return; MusECore::MidiController* c = (MusECore::MidiController*)item->data(0, Qt::UserRole).value(); - int n = c->num() & ~0xff; - c->setNum(n | (val & 0xff)); - if(val == -1) + int n = spinBoxHCtrlNo->isEnabled() ? (spinBoxHCtrlNo->value() & 0x7f) << 8 : c->num() & 0x7f00; + MusECore::MidiControllerList* cl = workingInstrument.controller(); + MusECore::MidiController::ControllerType t = MusECore::ctrlType2Int(ctrlType->currentText()); + int tn = MusECore::midiCtrlTerms2Number(t); + if((tn & 0xffff0000) == MusECore::CTRL_INTERNAL_OFFSET) // Error, should not happen. + return; + int new_num = tn | n | (val & 0xff); + // Check if either a per-note controller, or else a regular controller already exists. + if(!cl->ctrlAvailable(new_num, c)) + { + ctrlValidLabel->setPixmap(*reddotIcon); + enableNonCtrlControls(false); + return; + } + ctrlValidLabel->setPixmap(*greendotIcon); + enableNonCtrlControls(true); + cl->erase(c->num()); + c->setNum(new_num); + cl->add(c); + QString s; + if(c->isPerNoteController()) item->setText(COL_LNUM, QString("*")); else { - QString s; s.setNum(val); item->setText(COL_LNUM, s); - } + } + if(t == MusECore::MidiController::Controller7) + item->setText(COL_HNUM, "---"); + else + { + s.setNum(n >> 8); + item->setText(COL_HNUM, s); + } + item->setText(COL_TYPE, ctrlType->currentText()); + workingInstrument.setDirty(true); + } +*/ + +//--------------------------------------------------------- +// ctrlNumChanged +//--------------------------------------------------------- + +void EditInstrument::ctrlNumChanged() + { + QTreeWidgetItem* item = viewController->currentItem(); + if (item == 0) + return; + MusECore::MidiController::ControllerType t = MusECore::ctrlType2Int(ctrlType->currentText()); + int hnum = 0, lnum = 0; + switch (t) { + case MusECore::MidiController::Controller7: + lnum = spinBoxLCtrlNo->value(); + break; + case MusECore::MidiController::Controller14: + case MusECore::MidiController::RPN: + case MusECore::MidiController::NRPN: + case MusECore::MidiController::RPN14: + case MusECore::MidiController::NRPN14: + hnum = spinBoxHCtrlNo->value(); + lnum = spinBoxLCtrlNo->value(); + break; + // Should not happen... + case MusECore::MidiController::Pitch: + case MusECore::MidiController::PolyAftertouch: + case MusECore::MidiController::Aftertouch: + case MusECore::MidiController::Program: + case MusECore::MidiController::Velo: + return; + default: + printf("EditInstrument::ctrlNumChanged Error: Unknown control type\n"); + return; + break; + } + + int new_num = MusECore::MidiController::genNum(t, hnum, lnum); + if(new_num == -1) + { + printf("EditInstrument::ctrlNumChanged Error: genNum returned -1\n"); + return; + } + + + //int n = spinBoxLCtrlNo->isEnabled() ? spinBoxLCtrlNo->value() & 0xff : c->num() & 0xff; + MusECore::MidiControllerList* cl = workingInstrument.controller(); + MusECore::MidiController* c = (MusECore::MidiController*)item->data(0, Qt::UserRole).value(); + + //int tn = MusECore::midiCtrlTerms2Number(t); + //if((tn & 0xffff0000) == MusECore::CTRL_INTERNAL_OFFSET) // Error, should not happen. + // return; + //int new_num = tn | ((val & 0xff) << 8) | n; + // Check if either a per-note controller, or else a regular controller already exists. + if(!cl->ctrlAvailable(new_num, c)) + { + ctrlValidLabel->setPixmap(*reddotIcon); + enableNonCtrlControls(false); + return; + } + ctrlValidLabel->setPixmap(*greendotIcon); + enableNonCtrlControls(true); + if(cl->erase(c->num()) == 0) + printf("EditInstrument::ctrlNumChanged Warning: Erase failed! Proceeding anyway.\n"); + c->setNum(new_num); + cl->add(c); + QString s; + if(c->isPerNoteController()) + item->setText(COL_LNUM, QString("*")); + else { + s.setNum(lnum); + item->setText(COL_LNUM, s); + } + switch (t) { + case MusECore::MidiController::Controller7: + item->setText(COL_HNUM, "---"); + break; + case MusECore::MidiController::Controller14: + case MusECore::MidiController::RPN: + case MusECore::MidiController::NRPN: + case MusECore::MidiController::RPN14: + case MusECore::MidiController::NRPN14: + s.setNum(hnum); + item->setText(COL_HNUM, s); + break; + default: + return; + } + item->setText(COL_TYPE, ctrlType->currentText()); workingInstrument.setDirty(true); } @@ -2080,6 +2433,8 @@ void EditInstrument::ctrlMinChanged(int val) case MusECore::MidiController::Controller7: case MusECore::MidiController::RPN: case MusECore::MidiController::NRPN: + case MusECore::MidiController::PolyAftertouch: + case MusECore::MidiController::Aftertouch: rng = 127; break; case MusECore::MidiController::Controller14: @@ -2164,6 +2519,8 @@ void EditInstrument::ctrlMaxChanged(int val) case MusECore::MidiController::Controller7: case MusECore::MidiController::RPN: case MusECore::MidiController::NRPN: + case MusECore::MidiController::PolyAftertouch: + case MusECore::MidiController::Aftertouch: rng = 127; break; case MusECore::MidiController::Controller14: @@ -2788,56 +3145,112 @@ void EditInstrument::newControllerClicked() ctrl->setInitVal(MusECore::CTRL_VAL_UNKNOWN); QTreeWidgetItem* ci = viewController->currentItem(); - + + int l = 0; + int h = 0; + int hmax = 0x100; // To allow for quick multiple successive controller creation. // If there's a current controller item selected, copy initial values from it. - bool found = false; if(ci) { MusECore::MidiController* selctl = (MusECore::MidiController*)ci->data(0, Qt::UserRole).value(); - - // Auto increment controller number. - int l = selctl->num() & 0x7f; - int h = selctl->num() & 0xffffff00; - // Ignore internal controllers and wild cards. - if(((h & 0xff0000) != 0x40000) && ((selctl->num() & 0xff) != 0xff)) + if(((selctl->num() & 0xff0000) != MusECore::CTRL_INTERNAL_OFFSET) && !selctl->isPerNoteController()) { - // Assign. - *ctrl = *selctl; - - for (int i = 1; i < 128; ++i) + switch(MusECore::midiControllerType(selctl->num())) { - int j = ((i + l) & 0x7f) | h; + case MusECore::MidiController::Controller7: + // Auto increment controller number. + l = selctl->num() & 0x7f; + *ctrl = *selctl; // Assign. + break; + case MusECore::MidiController::Controller14: + case MusECore::MidiController::RPN: + case MusECore::MidiController::NRPN: + case MusECore::MidiController::RPN14: + case MusECore::MidiController::NRPN14: + // Auto increment controller number. + l = selctl->num() & 0x7f; + h = selctl->num() & 0xffffff00; + *ctrl = *selctl; // Assign. + break; + // Don't duplicate these types. + case MusECore::MidiController::Pitch: + case MusECore::MidiController::Program: + case MusECore::MidiController::PolyAftertouch: + case MusECore::MidiController::Aftertouch: + case MusECore::MidiController::Velo: + break; + default: + printf("error: newControllerClicked: Unknown control type!\n"); + delete ctrl; + return; + } + } + } + + bool found = false; + for(int k = (h & 0xffff0000); k < MusECore::CTRL_NONE_OFFSET; k += 0x10000) + { + // Don't copy internal controllers. + if(k == MusECore::CTRL_INTERNAL_OFFSET) + { + found = true; + continue; + } + if(k == 0) + // We're currently within the Controller7 group, limit the hi-number loop to one go (j = 0). + hmax = 0x100; + else + // All other relevant controllers use hi and lo numbers. + hmax = 0x10000; + for(int j = 0; j < hmax; j += 0x100) + { + for(int i = 0; i < 128; ++i) + { + int num = ((i + l) & 0x7f) | ((h + j) & 0x7f00) | k; found = false; - for (MusECore::iMidiController ic = cl->begin(); ic != cl->end(); ++ic) + // First check if there's already a per-note controller for this control number. + if(cl->find(num | 0xff) != cl->end()) { - MusECore::MidiController* c = ic->second; - if(c->num() == j) - { - found = true; - break; - } + found = true; + break; // Next outer loop (hi-number) iteration... } - if(!found) + // Now check if the actual control number is NOT already taken. + if(cl->find(num) == cl->end()) { - ctrl->setNum(j); + ctrl->setNum(num); break; - } - } + } + // Actual number was also taken. Keep iterating lo-number... + found = true; + } + if(!found) + break; } - } + if(!found) + break; + } + + if(found) + { + QMessageBox::critical(this, tr("New controller: Error"), tr("Error! All control numbers are taken up!\nClean up the instrument!")); + delete ctrl; + return; + } ctrl->setName(cName); workingInstrument.controller()->add(ctrl); QTreeWidgetItem* item = addControllerToView(ctrl); - - viewController->blockSignals(true); - item->setSelected(true); - viewController->blockSignals(false); - - controllerChanged(); + + if(viewController->currentItem() != item) + { + viewController->blockSignals(true); + viewController->setCurrentItem(item); + viewController->blockSignals(false); + controllerChanged(); + } workingInstrument.setDirty(true); } @@ -2848,75 +3261,132 @@ void EditInstrument::newControllerClicked() void EditInstrument::addControllerClicked() { - QListWidgetItem* idx = listController->currentItem(); - if(idx == 0) - return; - - int lnum = -1; - QString name = listController->currentItem()->text(); - for(int i = 0; i < 128; i++) - { - if(MusECore::midiCtrlName(i) == name) - { - lnum = i; - break; - } - } - if(lnum == -1) + // Add Common Controls not already found in instrument: + PopupMenu* pup = new PopupMenu(true); // true = enable stay open. Don't bother with parent. + MusECore::MidiControllerList* cl = workingInstrument.controller(); + for(int num = 0; num < 127; ++num) { - printf("Add controller: Controller not found: %s\n", name.toLatin1().constData()); - return; + // If it's not already in the parent menu... + if(cl->find(num) == cl->end()) + pup->addAction(MusECore::midiCtrlName(num, true))->setData(num); } - int num = MusECore::MidiController::genNum(MusECore::MidiController::Controller7, 0, lnum); - + connect(pup, SIGNAL(triggered(QAction*)), SLOT(ctrlPopupTriggered(QAction*))); + pup->exec(mapToGlobal(QPoint(0,0))); + delete pup; + + + + + + +// REMOVE Tim. +// QListWidgetItem* idx = listController->currentItem(); +// if(idx == 0) +// return; + +// int lnum = -1; +// QString name = listController->currentItem()->text(); +// for(int i = 0; i < 128; i++) +// { +// if(MusECore::midiCtrlName(i) == name) +// { +// lnum = i; +// break; +// } +// } + +// if(lnum == -1) +// { +// printf("Add controller: Controller not found: %s\n", name.toLatin1().constData()); +// return; +// } +// +// int num = MusECore::MidiController::genNum(MusECore::MidiController::Controller7, 0, lnum); +// +// MusECore::MidiControllerList* cl = workingInstrument.controller(); +// for(MusECore::iMidiController ic = cl->begin(); ic != cl->end(); ++ic) +// { +// MusECore::MidiController* c = ic->second; +// if(c->name() == name) +// { +// QMessageBox::critical(this, +// tr("MusE: Cannot add common controller"), +// tr("A controller named '%1' already exists.").arg(name), +// QMessageBox::Ok, +// Qt::NoButton, +// Qt::NoButton); +// +// return; +// } +// +// if(c->num() == num) +// { +// QMessageBox::critical(this, +// tr("MusE: Cannot add common controller"), +// tr("A controller number %1 already exists.").arg(num), +// QMessageBox::Ok, +// Qt::NoButton, +// Qt::NoButton); +// +// return; +// } +// } +// +// MusECore::MidiController* ctrl = new MusECore::MidiController(); +// ctrl->setNum(num); +// ctrl->setMinVal(0); +// ctrl->setMaxVal(127); +// ctrl->setInitVal(MusECore::CTRL_VAL_UNKNOWN); +// ctrl->setName(name); +// +// workingInstrument.controller()->add(ctrl); +// +// QTreeWidgetItem* item = addControllerToView(ctrl); +// +// viewController->blockSignals(true); +// item->setSelected(true); +// viewController->blockSignals(false); +// +// controllerChanged(); +// +// workingInstrument.setDirty(true); +} + +//--------------------------------------------------------- +// ctrlPopupTriggered +//--------------------------------------------------------- + +void EditInstrument::ctrlPopupTriggered(QAction* act) +{ + if(!act || (act->data().toInt() == -1)) + return; + int rv = act->data().toInt(); MusECore::MidiControllerList* cl = workingInstrument.controller(); - for(MusECore::iMidiController ic = cl->begin(); ic != cl->end(); ++ic) + if(cl->find(rv) == cl->end()) { - MusECore::MidiController* c = ic->second; - if(c->name() == name) - { - QMessageBox::critical(this, - tr("MusE: Cannot add common controller"), - tr("A controller named '%1' already exists.").arg(name), - QMessageBox::Ok, - Qt::NoButton, - Qt::NoButton); - - return; - } + int num = rv; // = MusECore::MidiController::genNum(MusECore::MidiController::Controller7, 0, rv); + MusECore::MidiController* ctrl = new MusECore::MidiController(); + ctrl->setNum(num); + ctrl->setMinVal(0); + ctrl->setMaxVal(127); + ctrl->setInitVal(MusECore::CTRL_VAL_UNKNOWN); + ctrl->setName(MusECore::midiCtrlName(num, false)); - if(c->num() == num) + workingInstrument.controller()->add(ctrl); + + QTreeWidgetItem* item = addControllerToView(ctrl); + + if(viewController->currentItem() != item) { - QMessageBox::critical(this, - tr("MusE: Cannot add common controller"), - tr("A controller number %1 already exists.").arg(num), - QMessageBox::Ok, - Qt::NoButton, - Qt::NoButton); - - return; + viewController->blockSignals(true); + viewController->setCurrentItem(item); + viewController->blockSignals(false); + controllerChanged(); } + + workingInstrument.setDirty(true); } - - MusECore::MidiController* ctrl = new MusECore::MidiController(); - ctrl->setNum(num); - ctrl->setMinVal(0); - ctrl->setMaxVal(127); - ctrl->setInitVal(MusECore::CTRL_VAL_UNKNOWN); - ctrl->setName(name); - - workingInstrument.controller()->add(ctrl); - - QTreeWidgetItem* item = addControllerToView(ctrl); - - viewController->blockSignals(true); - item->setSelected(true); - viewController->blockSignals(false); - - controllerChanged(); - - workingInstrument.setDirty(true); } //--------------------------------------------------------- @@ -3104,6 +3574,81 @@ void EditInstrument::enableDefaultControls(bool enVal, bool enPatch) defPatchProg->setEnabled(enPatch); } +//--------------------------------------------------------- +// enableNonCtrlControls +//--------------------------------------------------------- + +void EditInstrument::enableNonCtrlControls(bool v) +{ + QTreeWidgetItem* sel = viewController->selectedItems().size() ? viewController->selectedItems()[0] : 0; + + if(!sel || !sel->data(0, Qt::UserRole).value()) + return; + MusECore::MidiController* c = (MusECore::MidiController*)sel->data(0, Qt::UserRole).value(); + MusECore::MidiController::ControllerType type = MusECore::midiControllerType(c->num()); + + if(v) + { + switch (type) { + case MusECore::MidiController::Controller7: + spinBoxMin->setEnabled(true); + spinBoxMax->setEnabled(true); + enableDefaultControls(true, false); + break; + case MusECore::MidiController::RPN: + case MusECore::MidiController::NRPN: + spinBoxMin->setEnabled(true); + spinBoxMax->setEnabled(true); + enableDefaultControls(true, false); + break; + case MusECore::MidiController::Controller14: + case MusECore::MidiController::RPN14: + case MusECore::MidiController::NRPN14: + spinBoxMin->setEnabled(true); + spinBoxMax->setEnabled(true); + enableDefaultControls(true, false); + break; + case MusECore::MidiController::Pitch: + spinBoxMin->setEnabled(true); + spinBoxMax->setEnabled(true); + enableDefaultControls(true, false); + break; + case MusECore::MidiController::PolyAftertouch: + case MusECore::MidiController::Aftertouch: + spinBoxMin->setEnabled(true); + spinBoxMax->setEnabled(true); + enableDefaultControls(true, false); + break; + case MusECore::MidiController::Program: + spinBoxMin->setEnabled(false); + spinBoxMax->setEnabled(false); + enableDefaultControls(false, true); + break; + default: + spinBoxMin->setEnabled(false); + spinBoxMax->setEnabled(false); + enableDefaultControls(false, false); + break; + } + } + else + { + spinBoxDefault->setEnabled(false); + patchButton->setEnabled(false); + defPatchH->setEnabled(false); + defPatchL->setEnabled(false); + defPatchProg->setEnabled(false); + + spinBoxMin->setEnabled(false); + spinBoxMax->setEnabled(false); + } + + ctrlShowInMidi->setEnabled(v); + ctrlShowInDrum->setEnabled(v); + + ctrlName->setEnabled(v); +} + //--------------------------------------------------------- // setDefaultPatchName //--------------------------------------------------------- diff --git a/muse2/muse/instruments/editinstrument.h b/muse2/muse/instruments/editinstrument.h index 90745301..ac4da064 100644 --- a/muse2/muse/instruments/editinstrument.h +++ b/muse2/muse/instruments/editinstrument.h @@ -33,6 +33,8 @@ class QMenu; class QCloseEvent; class QGridLayout; class QStringListModel; +class QString; +class QAction; namespace MusEGui { @@ -70,6 +72,7 @@ class EditInstrument : public QMainWindow, public Ui::EditInstrumentBase { QTreeWidgetItem* addControllerToView(MusECore::MidiController* mctrl); QString getPatchItemText(int); void enableDefaultControls(bool, bool); + void enableNonCtrlControls(bool); void setDefaultPatchName(int); int getDefaultPatchNumber(); void setDefaultPatchNumbers(int); @@ -98,13 +101,15 @@ class EditInstrument : public QMainWindow, public Ui::EditInstrumentBase { void deleteControllerClicked(); void newControllerClicked(); void addControllerClicked(); - void ctrlTypeChanged(int); + void ctrlPopupTriggered(QAction*); + void ctrlTypeChanged(); void ctrlNameReturn(); - void ctrlHNumChanged(int); - void ctrlLNumChanged(int); + void ctrlNumChanged(); void ctrlMinChanged(int); void ctrlMaxChanged(int); void ctrlDefaultChanged(int); + void ctrlShowInMidiChanged(int); + void ctrlShowInDrumChanged(int); void sysexChanged(QListWidgetItem*, QListWidgetItem*); void deleteSysexClicked(); void newSysexClicked(); @@ -124,7 +129,11 @@ class EditInstrument : public QMainWindow, public Ui::EditInstrumentBase { void fetchPatchCollection(); public: + enum TabType { Patches=0, DrumMaps=1, Controllers=2, Sysex=3 }; + EditInstrument(QWidget* parent = 0, Qt::WFlags fl = Qt::Window); + void findInstrument(const QString& find_instrument); + void showTab(TabType); }; } // namespace MusEGui diff --git a/muse2/muse/instruments/editinstrumentbase.ui b/muse2/muse/instruments/editinstrumentbase.ui index e1f935d5..8e3e7db0 100644 --- a/muse2/muse/instruments/editinstrumentbase.ui +++ b/muse2/muse/instruments/editinstrumentbase.ui @@ -6,14 +6,14 @@ 0 0 - 802 - 505 + 772 + 421 - 802 - 464 + 0 + 0 @@ -25,8 +25,8 @@ - 780 - 365 + 0 + 0 @@ -346,6 +346,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -444,662 +457,406 @@ - + - Contro&ller + Drum&maps - + - - - Qt::Horizontal - - - + + + - + - + 0 0 - Common: - - - false + Patch Collections: - - - - - - This is a list of commonly used midi controllers. -Note that in MusE pitch and program changes are -handled like normal controllers. + + + + 0 + 0 + - - - - - - - List of defined controllers - - - List of defined controllers. - - - QFrame::StyledPanel - - - QFrame::Sunken - - - true + + + 0 - - - Name - - - - - Type - - - - - H-Ctrl - - - - - L-Ctrl - - - - - Min - - - - - Max - - - - - Def - - - + + + + + + + 0 + 0 + + + + &Add + + + + + + + false + + + + 0 + 0 + + + + &Copy + + + + + + + false + + + + 0 + 0 + + + + &Remove + + + + + + + + + + + false + + + + 0 + 0 + + + + &Up + + + + + + + false + + + + 0 + 0 + + + + &Down + + + + + + - - - - 0 - 0 - - - - Properties + + + false - - - - - - - Name: + + + 0 + + + + + + + + 0 + 0 + - - false + + Patch: - - - - + + + + false - - Midi controller name + + + 0 + 0 + - - - - - - - - - Type: - - - false - - - - - - - Midi controller type + from - - Midi controller type - - - - Control7 - - - - - Control14 - - - - - RPN - - - - - NRPN - - - - - RPN14 - - - - - NRPN14 - - - - - Pitch - - - - - Program - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - H-Ctrl - - + + + false - - 10 - - - - - - + 0 0 - - Midi controller number high byte - - - Midi controller number high byte + + false - 0 + 1 - 127 - - - 0 + 128 - - - - Qt::Horizontal - - - QSizePolicy::Expanding + + + + false - - - 40 - 20 - + + + 0 + 0 + - - - - - L-Ctrl - - - false - - - 10 + to - - + + + + false + - + 0 0 - - Midi controller number low byte (* means drum controller) - - - Midi controller number low byte. -If low byte is * then the controller is a - 'drum controller'. For drum tracks and - GS/XG type songs and instruments. -Allows controllers for each instrument in - Muse's drum map. The low byte will be - replaced by the 'ANote' in the drum map. -Examples: The GS and XG instruments' - Drum controllers. - - - * + + false - -1 + 1 - 127 - - - 0 + 128 - - - - - - - - Range: + + + + + 0 + 0 + - - false + + Bank Hi: - - - - Qt::Horizontal - - - QSizePolicy::Expanding + + + + false - - - 40 - 20 - + + + 0 + 0 + - - - - - Min - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - false - - - 10 + from - - + + + + false + - + 0 0 - - Minimum value. If negative, auto-translate. - - - Minimum value. If the minimum value - is negative, the range will automatically - be translated to a positive range. - -Useful for controllers which should be - displayed with zero bias. For example, -'Pan': Minimum: -64 Maximum: 63 -True range: Min: 0 Max: 127 (bias = 64) -'CoarseTuning': Min: -24 Max: 23 -True range: Min: 40 Max: 87 (bias = 64) - -Bias is determined from controller type: -7-bit Controller7 / RPN: Bias = 64 -14-bit Controller14 / RPN14: Bias = 8192 - -Type 'Pitch' is the exception. It is biased - at zero, even with a negative minimum: -'Pitch': Min: -8192 Max: 8191 -True range: Min: -8192 Max: 8191 (bias 0) + + false - -16384 + 1 - 16383 + 128 - - - - Qt::Horizontal - - - QSizePolicy::Expanding + + + + false - - - 40 - 20 - + + + 0 + 0 + - - - - - Max - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - false - - - 10 + to - - + + + + false + - + 0 0 - - Maximum value - - - Maximum value + + false - -16384 + 1 - 16383 - - - 127 + 128 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding + + + + + 0 + 0 + - - - 40 - 20 - + + Bank Lo: - + - - - - Default: + + + + false - - Qt::AlignVCenter + + + 0 + 0 + - - false + + from - - - - L-Bank - - + + + false - - - - - - off + + + 0 + 0 + + + + false - 0 + 1 128 - - 0 + + + + + + false + + + + 0 + 0 + + + + to - - - - off + + + + false + + + + 0 + 0 + + + + false - 0 + 1 128 - - 0 - - - - - - - Progr. - - - false - - - - - - - off - - - 0 - - - 128 - - - 0 - - - - - - - true - - - - 210 - 0 - - - - ??? - - - - - - - - - - H-Bank - - - false - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 85 - 32767 - - - - Default value. Off: No default. - - - Default (initial) value. Off means no default. - -If a default value is chosen, the value will be sent - to the controller when the controller is added to - the song (in piano roll or event editor). When - the song is re-loaded, the value is sent again. -Otherwise the controller remains at its last value. -Controllers are also automatically added to a - song upon reception of a midi controller event. - -Caution! Watch out for controllers such as - 'Sustain' and 'ResetAllController' with default - values. You should probably turn 'off' their - default (in piano roll or drum edit, and - instrument editor). - - - off - - - -1 - - - 16383 - - - -1 - @@ -1107,692 +864,988 @@ Caution! Watch out for controllers such as - - - - - - Add common controller - - - &Add - - - Alt+A - - - - - - - Delete controller - - - &Delete - - - Alt+D - - - - - - - Create a new controller - - - New &Controller - - - Alt+C - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 200 - 20 - - - - - - - - Null Param Hi: - - - false - - - - - - - Null parameter number High byte - - - If set, these 'null' parameter numbers will + + + + + + + + + + + + Contro&llers + + + + + + + + Null Parameters: Hi: + + + false + + + + + + + + 0 + 0 + + + + Null parameter number High byte + + + If set, these 'null' parameter numbers will be sent after each RPN/NRPN event. This prevents subsequent 'data' events from corrupting the RPN/NRPN controller. Typically, set to 127/127, or an unused RPN/NRPN controller number. - - - off - - - -1 - - - 127 - - - 127 - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 200 - 20 - - - - - - - - Lo: - - - false - - - - - - - Null parameter number Low byte - - - If set, these 'null' parameter numbers will + + + off + + + -1 + + + 127 + + + 127 + + + + + + + Lo: + + + false + + + + + + + + 0 + 0 + + + + Null parameter number Low byte + + + If set, these 'null' parameter numbers will be sent after each RPN/NRPN event. This prevents subsequent 'data' events from corrupting the RPN/NRPN controller. Typically, set to 127/127, or an unused RPN/NRPN controller number. - - - off - - - -1 - - - 127 - - - 127 - - - - - - - - + + + off + + + -1 + + + 127 + + + 127 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - - S&ysEx - - - - - Qt::Horizontal + + + List of defined controllers - - - - - - SysEx List: - - - false - - - - - - - - 0 - 0 - - - - - - - - - - - - Name: - - - false - - - - - - - - - - Comment: - - - - - - - - - - Hex Entry: - - - false - - - - - - - - - - + + List of defined controllers. + + + QFrame::StyledPanel + + + QFrame::Sunken + + + true + + + 60 + + + 30 + + + false + + + + Name + + + AlignLeft|AlignVCenter + + + + + Type + + + AlignLeft|AlignVCenter + + + + + H-Ctrl + + + AlignRight|AlignVCenter + + + + + L-Ctrl + + + AlignRight|AlignVCenter + + + + + Min + + + AlignRight|AlignVCenter + + + + + Max + + + AlignRight|AlignVCenter + + + + + Def + + + AlignRight|AlignVCenter + + + + + Midi + + + AlignRight|AlignVCenter + + + + + Drum + + + AlignRight|AlignVCenter + + + + + + + + + 0 + 0 + + + + Properties + + + + 2 + + + 2 + + + + + + + Name: + + + false + + + + + + + + + + Midi controller name + + + + + + + + 0 + 0 + + + + Create a new controller + + + New &Controller + + + Alt+C + + + + + + + + 0 + 0 + + + + Add common controller + + + &Add Common... + + + Alt+A + + + + + + + + 0 + 0 + + + + Delete controller + + + &Delete + + + Alt+D + + + + + + + + + + + Type: + + + false + + + + + + + + 0 + 0 + + + + Midi controller type + + + Midi controller type + + - &Delete + Control7 - - Alt+D + + + + Control14 - - - - + + - New SysE&x + RPN - - Alt+X + + + + NRPN - - - - - - Qt::Horizontal + + + + RPN14 - - QSizePolicy::Expanding + + + + NRPN14 - - - 60 - 20 - + + + + Pitch - - - - - - - - - - - - - Drummaps - - - - - - - - - - - 0 - 0 - - - - Patch Collections: - - - - - - - - 0 - 0 - - - - - - - - 0 - - - - - - - - 0 - 0 - - - - &Add - - - - - - - false - - - - 0 - 0 - - - - &Copy - - - - - - - false - - - - 0 - 0 - - - - &Remove - - - - - - - - - - - false - - - - 0 - 0 - - - - &Up - - - - - - - false - - - - 0 - 0 - - - - &Down - - - - - - + + + + Program + + + + + PolyAftertouch + + + + + Aftertouch + + + + + + + + H-Ctrl + + + false + + + 10 + + + + + + + + 0 + 0 + + + + Midi controller number high byte + + + Midi controller number high byte + + + 0 + + + 127 + + + 0 + + + + + + + L-Ctrl + + + false + + + 10 + + + + + + + + 0 + 0 + + + + Midi controller number low byte (* means drum controller) + + + Midi controller number low byte. +If low byte is * then the controller is a + 'drum controller'. For drum tracks and + GS/XG type songs and instruments. +Allows controllers for each instrument in + Muse's drum map. The low byte will be + replaced by the 'ANote' in the drum map. +Examples: The GS and XG instruments' + Drum controllers. + + + * + + + -1 + + + 127 + + + 0 + + + + + + + W + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 0 + 20 + + + + + + + + + + + + Range: + + + false + + + + + + + Min + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + 10 + + + + + + + + 0 + 0 + + + + Minimum value. If negative, auto-translate. + + + Minimum value. If the minimum value + is negative, the range will automatically + be translated to a positive range. + +Useful for controllers which should be + displayed with zero bias. For example, +'Pan': Minimum: -64 Maximum: 63 +True range: Min: 0 Max: 127 (bias = 64) +'CoarseTuning': Min: -24 Max: 23 +True range: Min: 40 Max: 87 (bias = 64) + +Bias is determined from controller type: +7-bit Controller7 / RPN: Bias = 64 +14-bit Controller14 / RPN14: Bias = 8192 + +Type 'Pitch' is the exception. It is biased + at zero, even with a negative minimum: +'Pitch': Min: -8192 Max: 8191 +True range: Min: -8192 Max: 8191 (bias 0) + + + -16384 + + + 16383 + + + + + + + Max + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + 10 + + + + + + + + 0 + 0 + + + + Maximum value + + + Maximum value + + + -16384 + + + 16383 + + + 127 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 22 + 20 + + + + + + + + Show in tracks: + + + + + + + Midi + + + true + + + + + + + Drum + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 0 + 20 + + + + + + + + + + + + Default: + + + Qt::AlignVCenter + + + false + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Default value. Off: No default. + + + Default (initial) value. Off means no default. + +If a default value is chosen, the value will be sent + to the controller when the controller is added to + the song (in piano roll or event editor). When + the song is re-loaded, the value is sent again. +Otherwise the controller remains at its last value. +Controllers are also automatically added to a + song upon reception of a midi controller event. + +Caution! Watch out for controllers such as + 'Sustain' and 'ResetAllController' with default + values. You should probably turn 'off' their + default (in piano roll or drum edit, and + instrument editor). + + + off + + + -1 + + + 16383 + + + -1 + + + + + + + H-Bank + + + false + + + + + + + + 0 + 0 + + + + off + + + 0 + + + 128 + + + 0 + + + + + + + L-Bank + + + false + + + + + + + + 0 + 0 + + + + off + + + 0 + + + 128 + + + 0 + + + + + + + Progr. + + + false + + + + + + + + 0 + 0 + + + + off + + + 0 + + + 128 + + + 0 + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + ??? + + + + + + + + + + + + + + + + S&ysEx + + + + + + Qt::Horizontal + + + + + + + SysEx List: + + + false + + - - + + + + 0 + 0 + + + + + + + + + + + + Name: + + + false + + + + + + + + + + Comment: + + + + + + + + + + Hex Entry: + + false - - - 0 - - - - - - - - 0 - 0 - - - - Patch: - - - - - - - false - - - - 0 - 0 - - - - from - - - - - - - false - - - - 0 - 0 - - - - false - - - 1 - - - 128 - - - - - - - false - - - - 0 - 0 - - - - to - - - - - - - false - - - - 0 - 0 - - - - false - - - 1 - - - 128 - - - - - - - - 0 - 0 - - - - Bank Hi: - - - - - - - false - - - - 0 - 0 - - - - from - - - - - - - false - - - - 0 - 0 - - - - false - - - 1 - - - 128 - - - - - - - false - - - - 0 - 0 - - - - to - - - - - - - false - - - - 0 - 0 - - - - false - - - 1 - - - 128 - - - - - - - - 0 - 0 - - - - Bank Lo: - - - - - - - false - - - - 0 - 0 - - - - from - - - - - - - false - - - - 0 - 0 - - - - false - - - 1 - - - 128 - - - - - - - false - - - - 0 - 0 - - - - to - - - - - - - false - - - - 0 - 0 - - - - false - - - 1 - - - 128 - - - - - - + + + + + + + + + &Delete + + + Alt+D + + + + + + + New SysE&x + + + Alt+X + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 60 + 20 + + + + + + - - - - - + + @@ -1821,8 +1874,8 @@ Typically, set to 127/127, or an unused 0 0 - 802 - 21 + 772 + 23 @@ -1960,14 +2013,11 @@ Typically, set to 127/127, or an unused checkBoxGM checkBoxGS checkBoxXG - listController - viewController ctrlName ctrlType spinBoxHCtrlNo spinBoxLCtrlNo spinBoxMin - spinBoxMax spinBoxDefault sysexList sysexName diff --git a/muse2/muse/liste/editctrlbase.ui b/muse2/muse/liste/editctrlbase.ui index 7b4d68ec..036b4525 100644 --- a/muse2/muse/liste/editctrlbase.ui +++ b/muse2/muse/liste/editctrlbase.ui @@ -500,23 +500,34 @@ + + 0 + - - - 0 - 0 - 140 - 349 - - - - - - - 127 - + + + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 40 + + + + + + + + Controller + + + false @@ -534,59 +545,52 @@ - + - Value + Note false - - + + + + 127 + + + + + - Controller + Value false - + 127 - - - - Qt::Vertical - - - QSizePolicy::Expanding + + + + 127 - - - 20 - 40 - + + Qt::Horizontal - + - - - 0 - 0 - 100 - 30 - - @@ -759,8 +763,7 @@ - - + @@ -802,43 +805,10 @@ Awl::PosEdit QWidget
awl/posedit.h
- 0 - - buttonOk - clicked() - MyDialog - accept() - - - 20 - 20 - - - 20 - 20 - - - - - buttonCancel - clicked() - MyDialog - reject() - - - 20 - 20 - - - 20 - 20 - - - valSlider valueChanged(int) diff --git a/muse2/muse/liste/editevent.cpp b/muse2/muse/liste/editevent.cpp index 415c6385..fac6866d 100644 --- a/muse2/muse/liste/editevent.cpp +++ b/muse2/muse/liste/editevent.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -602,22 +603,32 @@ EditCtrlDialog::EditCtrlDialog(int tick, const MusECore::Event& event, { setupUi(this); widgetStack->setAutoFillBackground(true); + + MusECore::MidiTrack* track = part->track(); + int portn = track->outPort(); + MusECore::MidiPort* port = &MusEGlobal::midiPorts[portn]; + bool isDrum = track->type() == MusECore::Track::DRUM; + bool isNewDrum = track->type() == MusECore::Track::NEW_DRUM; + bool isMidi = track->type() == MusECore::Track::MIDI; + MusECore::MidiCtrlValListList* cll = port->controller(); + val = 0; num = 0; + int note = -1; if (!event.empty()) { num = event.dataA(); val = event.dataB(); + if(port->drumController(num)) + { + if(isDrum) + num = (num & ~0xff) | MusEGlobal::drumMap[num & 0xff].anote; + note = num & 0xff; } + } ///pop = new QMenu(this); //pop->setCheckable(false); //not necessary in Qt4 - MusECore::MidiTrack* track = part->track(); - int portn = track->outPort(); - MusECore::MidiPort* port = &MusEGlobal::midiPorts[portn]; - bool isDrum = track->isDrumTrack(); - MusECore::MidiCtrlValListList* cll = port->controller(); - ctrlList->clear(); ctrlList->setSelectionMode(QAbstractItemView::SingleSelection); @@ -630,14 +641,34 @@ EditCtrlDialog::EditCtrlDialog(int tick, const MusECore::Event& event, for (MusECore::iMidiCtrlValList it = cll->begin(); it != cll->end(); ++it) { MusECore::MidiCtrlValList* cl = it->second; - int num = cl->num(); + int clnum = cl->num(); // dont show drum specific controller if not a drum track - if ((num & 0xff) == 0xff) { - if (!isDrum) - continue; - } - MusECore::MidiController* c = port->midiController(num); + //if ((num & 0xff) == 0xff) { // REMOVE Tim. Or keep. + // if (!isDrum) + // continue; + // } +// int rnum = num; +// if(port->drumController(num)) +// { +// rnum |= 0xff; +// if() +// continue; +// } + + +// FIXME: TODO: Finish this stuff off. Use items' data member for control number. + + MusECore::MidiController* c = port->midiController(clnum); + //int cnum = c->num(); + //if(c->isPerNoteController()) + //{ + if(((isDrum || isNewDrum) && !(c->showInTracks() & MusECore::MidiController::ShowInDrum)) || + (isMidi && !(c->showInTracks() & MusECore::MidiController::ShowInMidi))) + continue; + //} + + { isList i = sList.begin(); for (; i != sList.end(); ++i) { @@ -674,10 +705,27 @@ EditCtrlDialog::EditCtrlDialog(int tick, const MusECore::Event& event, { widgetStack->setCurrentIndex(0); valSlider->setValue(val - mc->bias()); + + if(mc->isPerNoteController()) + { + noteSpinBox->setVisible(true); + noteSpinBox->setEnabled(true); + if(note != -1) + noteSpinBox->setValue(note); + } + else + { + noteSpinBox->setEnabled(false); + noteSpinBox->setVisible(false); + } } } else + { + noteSpinBox->setEnabled(false); + noteSpinBox->setVisible(false); ctrlListClicked(ctrlList->selectedItems()[0]); + } connect(ctrlList, SIGNAL(itemClicked(QListWidgetItem*)), SLOT(ctrlListClicked(QListWidgetItem*))); connect(buttonNewController, SIGNAL(clicked()), SLOT(newController())); connect(hbank, SIGNAL(valueChanged(int)), SLOT(programChanged())); @@ -703,36 +751,77 @@ void EditCtrlDialog::newController() MusECore::MidiTrack* track = part->track(); int portn = track->outPort(); MusECore::MidiPort* port = &MusEGlobal::midiPorts[portn]; + bool isDrum = track->type() == MusECore::Track::DRUM; + bool isNewDrum = track->type() == MusECore::Track::NEW_DRUM; + bool isMidi = track->type() == MusECore::Track::MIDI; MusECore::MidiInstrument* instr = port->instrument(); MusECore::MidiControllerList* mcl = instr->controller(); MusECore::MidiCtrlValListList* cll = port->controller(); int channel = track->outChannel(); - int nn = 0; + //int nn = 0; for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) { - if(cll->find(channel, ci->second->num()) == cll->end()) - { - QAction* act = pup->addAction(ci->second->name()); - act->setData(nn); - ++nn; - } + + MusECore::MidiController* c = ci->second; + int num = c->num(); + int show = c->showInTracks(); + + if(((isDrum || isNewDrum) && !(show & MusECore::MidiController::ShowInDrum)) || + (isMidi && !(show & MusECore::MidiController::ShowInMidi))) + continue; + if(c->isPerNoteController()) + { + if (isDrum) + num = (num & ~0xff) | MusEGlobal::drumMap[noteSpinBox->value()].anote; + else if ((isNewDrum || isMidi)) + num = (num & ~0xff) | noteSpinBox->value(); + else // dont show drum specific controller if not a drum track + continue; + } + + // If it's not already in the parent menu... + if(cll->find(channel, num) == cll->end()) + { + //ctrlSubPop->addAction(MusECore::midiCtrlNumString(num, true) + ci->second->name())->setData(num); + QAction* act = pup->addAction(MusECore::midiCtrlNumString(num, true) + c->name()); + act->setData(num); + } + +// REMOVE Tim. +// if(cll->find(channel, ci->second->num()) == cll->end()) +// { +// QAction* act = pup->addAction(ci->second->name()); +// act->setData(nn); +// ++nn; +// } } - QAction* rv = pup->exec(buttonNewController->mapToGlobal(QPoint(0,0))); - if (rv) { - QString s = rv->text(); + +// QAction* rv = pup->exec(buttonNewController->mapToGlobal(QPoint(0,0))); + QAction* act = pup->exec(buttonNewController->mapToGlobal(QPoint(0,0))); + if (act && act->data().toInt() != -1) { + //QString s = rv->text(); // REMOVE Tim. + int rv = act->data().toInt(); + int num = rv; + if(port->drumController(rv)) + num |= 0xff; for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) { MusECore::MidiController* mc = ci->second; - if (mc->name() == s) { - if(cll->find(channel, mc->num()) == cll->end()) + //if (mc->name() == s) { // REMOVE Tim. + if (mc->num() == num) { + //if(cll->find(channel, mc->num()) == cll->end()) // REMOVE Tim. + if(cll->find(channel, rv) == cll->end()) { - MusECore::MidiCtrlValList* vl = new MusECore::MidiCtrlValList(mc->num()); + //MusECore::MidiCtrlValList* vl = new MusECore::MidiCtrlValList(mc->num()); // REMOVE Tim. + MusECore::MidiCtrlValList* vl = new MusECore::MidiCtrlValList(rv); cll->add(channel, vl); } int idx = 0; for (; idx < ctrlList->count() ;++idx) { // p4.0.25 Fix segfault - QString str = ctrlList->item(idx)->text(); - if (s == str) + //QString str = ctrlList->item(idx)->text(); // REMOVE Tim. + int item_data = ctrlList->item(idx)->data(Qt::UserRole).toInt(); + //if (s == str) + if (item_data == num) { ctrlList->item(idx)->setSelected(true); ctrlListClicked(ctrlList->item(idx)); @@ -740,7 +829,10 @@ void EditCtrlDialog::newController() } } if (idx >= ctrlList->count()) { // p4.0.25 Fix segfault - ctrlList->addItem(s); + //ctrlList->addItem(s); // REMOVE Tim. + QListWidgetItem* new_item = new QListWidgetItem(act->text(), ctrlList); + new_item->setData(Qt::UserRole, num); + //ctrlList->addItem(new_item); ctrlList->item(idx)->setSelected(true); ctrlListClicked(ctrlList->item(idx)); break; diff --git a/muse2/muse/midictrl.cpp b/muse2/muse/midictrl.cpp index 56b1b2a8..14dd666e 100644 --- a/muse2/muse/midictrl.cpp +++ b/muse2/muse/midictrl.cpp @@ -250,11 +250,12 @@ MidiController::MidiController() _minVal = 0; _maxVal = 127; _initVal = 0; + _showInTracks = ShowInDrum | ShowInMidi; updateBias(); } -MidiController::MidiController(const QString& s, int n, int min, int max, int init) - : _name(s), _num(n), _minVal(min), _maxVal(max), _initVal(init) +MidiController::MidiController(const QString& s, int n, int min, int max, int init, int show_in_track) + : _name(s), _num(n), _minVal(min), _maxVal(max), _initVal(init), _showInTracks(show_in_track) { updateBias(); } @@ -276,6 +277,7 @@ void MidiController::copy(const MidiController &mc) _maxVal = mc._maxVal; _initVal = mc._initVal; _bias = mc._bias; + _showInTracks = mc._showInTracks; } //--------------------------------------------------------- @@ -308,7 +310,7 @@ MidiController::ControllerType midiControllerType(int num) return MidiController::Program; if (num == CTRL_VELOCITY) return MidiController::Velo; - if (num == CTRL_POLYAFTER) + if ((num | 0xff) == CTRL_POLYAFTER) return MidiController::PolyAftertouch; if (num == CTRL_AFTERTOUCH) return MidiController::Aftertouch; @@ -323,10 +325,10 @@ MidiController::ControllerType midiControllerType(int num) // midiCtrlTerms2Number //--------------------------------------------------------- -int midiCtrlTerms2Number(int type_num, int ctrl) +int midiCtrlTerms2Number(MidiController::ControllerType type, int ctrl) { ctrl &= 0xffff; - switch(type_num) + switch(type) { case MidiController::Controller7: return ctrl & 0xff; @@ -442,7 +444,7 @@ void MidiController::write(int level, Xml& xml) const int l = _num & 0x7f; QString sl; - if ((_num & 0xff) == 0xff) + if (isPerNoteController()) sl = "pitch"; else sl.setNum(l); @@ -504,6 +506,10 @@ void MidiController::write(int level, Xml& xml) const if(_initVal != CTRL_VAL_UNKNOWN) xml.nput(" init=\"%d\"", _initVal); } + + if(_showInTracks != (ShowInDrum | ShowInMidi)) + xml.nput(" showType=\"%d\"", _showInTracks); + xml.put(" />"); } @@ -542,9 +548,7 @@ void MidiController::read(Xml& xml) else if (tag == "h") h = xml.s2().toInt(&ok, base); else if (tag == "l") { - // By T356 08/16/08. Changed wildcard to '*'. - // Changed back to 'pitch' again. - // Support instrument files with '*' as wildcard. + // Support instrument files with '*' or 'pitch' as wildcard. if ((xml.s2() == "*") || (xml.s2() == "pitch")) l = 0xff; else @@ -556,6 +560,8 @@ void MidiController::read(Xml& xml) _maxVal = xml.s2().toInt(&ok, base); else if (tag == "init") _initVal = xml.s2().toInt(&ok, base); + else if (tag == "showType") + _showInTracks = xml.s2().toInt(&ok, base); } break; case Xml::TagStart: @@ -625,7 +631,6 @@ void MidiController::read(Xml& xml) } if (_minVal == NOT_SET) _minVal = 0; - updateBias(); return; } @@ -641,10 +646,10 @@ void MidiController::read(Xml& xml) int MidiController::genNum(MidiController::ControllerType t, int h, int l) { - int val = (h << 8) + l; + int val = (h << 8) | (l & 0xff); switch(t) { case Controller7: - return l; + return l & 0xff; case Controller14: return val + CTRL_14_OFFSET; case RPN: @@ -881,4 +886,30 @@ MidiControllerList::MidiControllerList(const MidiControllerList& mcl) : std::map } } +//--------------------------------------------------------- +// ctrlAvailable (static) +// Check if either a per-note controller, or else a regular controller already exists. +//--------------------------------------------------------- + +bool MidiControllerList::ctrlAvailable(int find_num, MidiController* ignore_this) +{ + MusECore::ciMidiController imc; + for(imc = begin(); imc != end(); ++ imc) + { + // Ignore this controller. + if(ignore_this && imc->second == ignore_this) + continue; + int n = imc->second->num(); + if(((find_num & 0xff) == 0xff) && ((n | 0xff) == find_num)) + break; + if(imc->second->isPerNoteController() && ((find_num | 0xff) == n)) + break; + if(find_num == n) + break; + } + return imc == end(); +} + + + } // namespace MusECore diff --git a/muse2/muse/midictrl.h b/muse2/muse/midictrl.h index d4cd1079..1431d5e5 100644 --- a/muse2/muse/midictrl.h +++ b/muse2/muse/midictrl.h @@ -117,10 +117,13 @@ class MidiController { NRPN14, // non registered parameter 0x60000 - Pitch, // num value = CTRL_PITCH Program, // num value = CTRL_PROGRAM - Velo, // not assigned - PolyAftertouch, // num value = CTRL_POLYAFTER - Aftertouch // num value = CTRL_AFTERTOUCH + PolyAftertouch, // num value = CTRL_POLYAFTER + Aftertouch, // num value = CTRL_AFTERTOUCH + Velo // not assigned }; + + enum ShowInTrackType { ShowInDrum=1, ShowInMidi=2 }; + private: QString _name; int _num; // Controller Number @@ -128,11 +131,12 @@ class MidiController { int _maxVal; int _initVal; int _bias; + int _showInTracks; void updateBias(); public: MidiController(); - MidiController(const QString& n, int num, int min, int max, int init); + MidiController(const QString& n, int num, int min, int max, int init, int show_in_track = (ShowInDrum | ShowInMidi)); MidiController(const MidiController& mc); void copy(const MidiController &mc); MidiController& operator= (const MidiController &mc); @@ -150,6 +154,9 @@ class MidiController { void setMinVal(int val) { _minVal = val; updateBias(); } void setMaxVal(int val) { _maxVal = val; updateBias(); } int bias() const { return _bias; } + int showInTracks() const { return _showInTracks; } + void setShowInTracks(int i) { _showInTracks = i; } + bool isPerNoteController() const { return (_num & 0xff) == 0xff; } static int genNum(ControllerType, int, int); }; @@ -239,6 +246,7 @@ class MidiControllerList : public std::map MidiControllerList(const MidiControllerList& mcl); void add(MidiController* mc) { insert(std::pair(mc->num(), mc)); } + bool ctrlAvailable(int find_num, MidiController* ignore_this = 0); }; typedef MidiControllerList::iterator iMidiController; @@ -248,7 +256,7 @@ typedef MidiControllerList MidiControllerList; extern MidiControllerList defaultMidiController; extern void initMidiController(); extern MidiController::ControllerType midiControllerType(int num); -extern int midiCtrlTerms2Number(int type_num, int ctrl); +extern int midiCtrlTerms2Number(MidiController::ControllerType type, int ctrl = 0); extern const QString& int2ctrlType(int n); diff --git a/muse2/muse/mididev.cpp b/muse2/muse/mididev.cpp index 3703def2..2459f72a 100644 --- a/muse2/muse/mididev.cpp +++ b/muse2/muse/mididev.cpp @@ -775,7 +775,10 @@ void MidiDevice::handleSeek() { //_playEvents.add(MidiPlayEvent(0, _port, chan, ME_CONTROLLER, ctlnum, imcv->second.val)); // Use sendEvent to get the optimizations and limiting. But force if there's a value at this exact position. - mp->sendEvent(MidiPlayEvent(0, _port, chan, ME_CONTROLLER, ctlnum, imcv->second.val), imcv->first == pos); + // NOTE: Why again was this forced? There was a reason. Think it was RJ in response to bug rep, then I modded. + // A reason not to force: If a straight line is drawn on graph, multiple identical events are stored + // (which must be allowed). So seeking through them here sends them all redundantly, not good. // REMOVE Tim. + mp->sendEvent(MidiPlayEvent(0, _port, chan, ME_CONTROLLER, ctlnum, imcv->second.val), false); //, imcv->first == pos); //mp->sendEvent(MidiPlayEvent(0, _port, chan, ME_CONTROLLER, ctlnum, imcv->second.val), pos == 0 || imcv->first == pos); //done = true; } diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index 03f246cf..5126180f 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -64,6 +64,7 @@ #include "popupmenu.h" #include "menutitleitem.h" #include "widgets/function_dialogs/quantize.h" +#include "editinstrument.h" namespace MusEGui { @@ -1253,141 +1254,27 @@ void DrumEdit::ctrlPopupTriggered(QAction* act) MusECore::MidiTrack* track = (MusECore::MidiTrack*)(part->track()); int channel = track->outChannel(); MusECore::MidiPort* port = &MusEGlobal::midiPorts[track->outPort()]; - int curDrumPitch = curDrumInstrument(); - bool isDrum = track->type() == MusECore::Track::DRUM; - bool isNewDrum = track->type() == MusECore::Track::NEW_DRUM; - MusECore::MidiInstrument* instr = port->instrument(); - MusECore::MidiControllerList* mcl = instr->controller(); - MusECore::MidiCtrlValListList* cll = port->controller(); const int min = channel << 24; const int max = min + 0x1000000; - - const int add_ins_def = max + 1; - const int add_other = max + 2; const int edit_ins = max + 3; - const int velo = max + 0x101; - int rv = act->data().toInt(); if (rv == velo) { // special case velocity newCtlNum = MusECore::CTRL_VELOCITY; } - else if (rv == add_ins_def) { // add new instrument controller - - PopupMenu * ctrlSubPop = new PopupMenu(this, true); // true = enable stay open - ctrlSubPop->addAction(new MenuTitleItem(tr("Instrument-defined"), ctrlSubPop)); - - // - // populate popup with all controllers available for - // current instrument - // - - for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) - { - int num = ci->second->num(); - if((num & 0xff) == 0xff) - { - if (isDrum && curDrumPitch!=-1) - num = (num & ~0xff) + MusEGlobal::drumMap[curDrumPitch].anote; - else if (isNewDrum && curDrumPitch!=-1) - num = (num & ~0xff) + curDrumPitch; //FINDMICH does this work? - else // dont show drum specific controller if not a drum track - continue; - } - - if(cll->find(channel, num) == cll->end()) - ctrlSubPop->addAction(MusECore::midiCtrlNumString(num, true) + ci->second->name())->setData(num); - } - - // Don't allow editing instrument if it's a synth - if(!port->device() || port->device()->deviceType() != MusECore::MidiDevice::SYNTH_MIDI) - ctrlSubPop->addAction(QIcon(*midi_edit_instrumentIcon), tr("Edit instrument ..."))->setData(edit_ins); - - QAction *act2 = ctrlSubPop->exec(ctrl->mapToGlobal(QPoint(0,0))); - if (act2) - { - int rv2 = act2->data().toInt(); - - if (rv2 == edit_ins) // edit instrument - MusEGlobal::muse->startEditInstrument(); - else // select new instrument control - { - MusECore::MidiController* c; - for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) - { - c = ci->second; - int num = c->num(); - if (isDrum && ((num & 0xff) == 0xff) && curDrumPitch!=-1) - num = (num & ~0xff) + MusEGlobal::drumMap[curDrumPitch].anote; - else if (isNewDrum && ((num & 0xff) == 0xff) && curDrumPitch!=-1) - num = (num & ~0xff) + curDrumPitch; //FINDMICHJETZT does this work? - - if(num != rv2) - continue; - - if(cll->find(channel, num) == cll->end()) - { - MusECore::MidiCtrlValList* vl = new MusECore::MidiCtrlValList(num); - - cll->add(channel, vl); - newCtlNum = c->num(); - } - else - newCtlNum = c->num(); - break; - } - } - } - delete ctrlSubPop; - } - - //else if (rv == edit_ins) // edit instrument - // MusEGlobal::muse->startEditInstrument(); - - else if (rv == add_other) { // add new other controller - PopupMenu* ctrlSubPop = new PopupMenu(this, true); // true = enable stay open - ctrlSubPop->addAction(new MenuTitleItem(tr("Common Controls"), ctrlSubPop)); - - for(int num = 0; num < 127; ++num) - if(cll->find(channel, num) == cll->end()) - ctrlSubPop->addAction(MusECore::midiCtrlName(num, true))->setData(num); - QAction *act2 = ctrlSubPop->exec(ctrl->mapToGlobal(QPoint(0,0))); - if (act2) { - int rv2 = act2->data().toInt(); - int num = rv2; - if (isDrum && ((num & 0xff) == 0xff) && curDrumPitch!=-1) - num = (num & ~0xff) + MusEGlobal::drumMap[curDrumPitch].anote; - if (isNewDrum && ((num & 0xff) == 0xff) && curDrumPitch!=-1) - num = (num & ~0xff) + curDrumPitch; //FINDMICHJETZT does this work? - - if(cll->find(channel, num) == cll->end()) - { - MusECore::MidiCtrlValList* vl = new MusECore::MidiCtrlValList(num); - - cll->add(channel, vl); - newCtlNum = rv2; - } - else - newCtlNum = rv2; - } - delete ctrlSubPop; + else if (rv == edit_ins) { // edit instrument + MusECore::MidiInstrument* instr = port->instrument(); + MusEGlobal::muse->startEditInstrument(instr ? instr->iname() : QString(), EditInstrument::Controllers); } else { // Select a control - MusECore::iMidiCtrlValList i = cll->begin(); - for (; i != cll->end(); ++i) { - MusECore::MidiCtrlValList* cl = i->second; - MusECore::MidiController* c = port->midiController(cl->num()); - if (c->num() == rv) { - newCtlNum = c->num(); - break; - } - } - if (i == cll->end()) { - printf("DrumEdit: controller number %d not found!", rv); - } - } + if(cll->find(channel, rv) == cll->end()) + cll->add(channel, new MusECore::MidiCtrlValList(rv)); + newCtlNum = rv; + if(port->drumController(rv)) + newCtlNum |= 0xff; + } if(newCtlNum != -1) { diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index 97c5ecc3..e4064bd9 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -64,6 +64,7 @@ #include "helper.h" #include "popupmenu.h" #include "menutitleitem.h" +#include "editinstrument.h" #include "cmd.h" @@ -813,141 +814,27 @@ void PianoRoll::ctrlPopupTriggered(QAction* act) MusECore::MidiTrack* track = (MusECore::MidiTrack*)(part->track()); int channel = track->outChannel(); MusECore::MidiPort* port = &MusEGlobal::midiPorts[track->outPort()]; - int curPitch = curDrumInstrument(); - MusECore::MidiInstrument* instr = port->instrument(); - MusECore::MidiControllerList* mcl = instr->controller(); - MusECore::MidiCtrlValListList* cll = port->controller(); const int min = channel << 24; const int max = min + 0x1000000; - - const int add_ins_def = max + 1; - const int add_other = max + 2; const int edit_ins = max + 3; - const int velo = max + 0x101; - int rv = act->data().toInt(); if (rv == velo) { // special case velocity newCtlNum = MusECore::CTRL_VELOCITY; } - else if (rv == add_ins_def) { // add new instrument controller - - PopupMenu * ctrlSubPop = new PopupMenu(this, true); // true = enable stay open - ctrlSubPop->addAction(new MenuTitleItem(tr("Instrument-defined"), ctrlSubPop)); - - // - // populate popup with all controllers available for - // current instrument - // - - for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) - { - int num = ci->second->num(); - if((num & 0xff) == 0xff) - { - //if (curPitch!=-1) - // num = (num & ~0xff) + MusEGlobal::drumMap[curPitch].anote; - //else - if(curPitch!=-1) - num = (num & ~0xff) + curPitch; //FINDMICH does this work? - else // dont show drum specific controller if not a drum track - continue; - } - - if(cll->find(channel, num) == cll->end()) - ctrlSubPop->addAction(MusECore::midiCtrlNumString(num, true) + ci->second->name())->setData(num); - } - - // Don't allow editing instrument if it's a synth - if(!port->device() || port->device()->deviceType() != MusECore::MidiDevice::SYNTH_MIDI) - ctrlSubPop->addAction(QIcon(*midi_edit_instrumentIcon), tr("Edit instrument ..."))->setData(edit_ins); - - QAction *act2 = ctrlSubPop->exec(ctrl->mapToGlobal(QPoint(0,0))); - if (act2) - { - int rv2 = act2->data().toInt(); - - if (rv2 == edit_ins) // edit instrument - MusEGlobal::muse->startEditInstrument(); - else // select new instrument control - { - MusECore::MidiController* c; - for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) - { - c = ci->second; - int num = c->num(); - //if (((num & 0xff) == 0xff) && curPitch!=-1) - // num = (num & ~0xff) + MusEGlobal::drumMap[curPitch].anote; - //else - if (((num & 0xff) == 0xff) && curPitch!=-1) - num = (num & ~0xff) + curPitch; //FINDMICHJETZT does this work? - - if(num != rv2) - continue; - - if(cll->find(channel, num) == cll->end()) - { - MusECore::MidiCtrlValList* vl = new MusECore::MidiCtrlValList(num); - - cll->add(channel, vl); - newCtlNum = c->num(); - } - else - newCtlNum = c->num(); - break; - } - } - } - delete ctrlSubPop; - } - - //else if (rv == edit_ins) // edit instrument - // MusEGlobal::muse->startEditInstrument(); - - else if (rv == add_other) { // add new other controller - PopupMenu* ctrlSubPop = new PopupMenu(this, true); // true = enable stay open - ctrlSubPop->addAction(new MenuTitleItem(tr("Common Controls"), ctrlSubPop)); - - for(int num = 0; num < 127; ++num) - if(cll->find(channel, num) == cll->end()) - ctrlSubPop->addAction(MusECore::midiCtrlName(num, true))->setData(num); - QAction *act2 = ctrlSubPop->exec(ctrl->mapToGlobal(QPoint(0,0))); - if (act2) { - int rv2 = act2->data().toInt(); - int num = rv2; - //if (((num & 0xff) == 0xff) && curPitch!=-1) - // num = (num & ~0xff) + MusEGlobal::drumMap[curPitch].anote; - if (((num & 0xff) == 0xff) && curPitch!=-1) - num = (num & ~0xff) + curPitch; //FINDMICHJETZT does this work? - - if(cll->find(channel, num) == cll->end()) - { - MusECore::MidiCtrlValList* vl = new MusECore::MidiCtrlValList(num); - - cll->add(channel, vl); - newCtlNum = rv2; - } - else - newCtlNum = rv2; - } - delete ctrlSubPop; + else if (rv == edit_ins) { // edit instrument + MusECore::MidiInstrument* instr = port->instrument(); + MusEGlobal::muse->startEditInstrument(instr ? instr->iname() : QString(), EditInstrument::Controllers); } else { // Select a control - MusECore::iMidiCtrlValList i = cll->begin(); - for (; i != cll->end(); ++i) { - MusECore::MidiCtrlValList* cl = i->second; - MusECore::MidiController* c = port->midiController(cl->num()); - if (c->num() == rv) { - newCtlNum = c->num(); - break; - } - } - if (i == cll->end()) { - printf("PianoRoll: controller number %d not found!", rv); - } - } + if(cll->find(channel, rv) == cll->end()) + cll->add(channel, new MusECore::MidiCtrlValList(rv)); + newCtlNum = rv; + if(port->drumController(rv)) + newCtlNum |= 0xff; + } if(newCtlNum != -1) { diff --git a/muse2/muse/midiport.cpp b/muse2/muse/midiport.cpp index f7a3d5e3..36b38ae0 100644 --- a/muse2/muse/midiport.cpp +++ b/muse2/muse/midiport.cpp @@ -1020,7 +1020,7 @@ MidiController* MidiPort::midiController(int num) const if (cn == num) return i->second; // wildcard? - if (((cn & 0xff) == 0xff) && ((cn & ~0xff) == (num & ~0xff))) + if (i->second->isPerNoteController() && ((cn & ~0xff) == (num & ~0xff))) return i->second; } } @@ -1030,7 +1030,7 @@ MidiController* MidiPort::midiController(int num) const if (cn == num) return i->second; // wildcard? - if (((cn & 0xff) == 0xff) && ((cn & ~0xff) == (num & ~0xff))) + if (i->second->isPerNoteController() && ((cn & ~0xff) == (num & ~0xff))) return i->second; } diff --git a/muse2/muse/vst.cpp b/muse2/muse/vst.cpp index 1f03e0ac..60b1983d 100644 --- a/muse2/muse/vst.cpp +++ b/muse2/muse/vst.cpp @@ -342,12 +342,12 @@ void jfst_reserve_mem (int bufsize) void initVST() { jfst_reserve_mem(1000000); - + if (fst_init(fstSignalHandler)) { printf("initVST failed\n"); return; } - + char* vstPath = getenv("VST_PATH"); if (vstPath == 0) vstPath = "/usr/lib/vst:/usr/local/lib/vst"; diff --git a/muse2/muse/vst.h b/muse2/muse/vst.h index 52c45f16..7e693863 100644 --- a/muse2/muse/vst.h +++ b/muse2/muse/vst.h @@ -47,7 +47,7 @@ class VstSynth : public Synth { VstSynth(const QFileInfo& fi) : Synth(fi, fi->baseName()) { fstHandle = 0; } - + virtual ~VstSynth() {} virtual Type synthType() const { return VST_SYNTH; } virtual void incInstances(int val); @@ -70,7 +70,7 @@ class VstSynthIF : public SynthIF _fst = 0; _guiVisible = false; } - + virtual bool initGui() { return true; }; virtual void guiHeartBeat() { } virtual bool guiVisible() const { return false; } diff --git a/muse2/muse/widgets/midi_audio_control.cpp b/muse2/muse/widgets/midi_audio_control.cpp index 78c8de3c..17d724ac 100644 --- a/muse2/muse/widgets/midi_audio_control.cpp +++ b/muse2/muse/widgets/midi_audio_control.cpp @@ -88,7 +88,7 @@ void MidiAudioControl::heartbeat() if(MusEGlobal::midiLearnCtrl != -1) { - int type = MusECore::midiControllerType(MusEGlobal::midiLearnCtrl); + MusECore::MidiController::ControllerType type = MusECore::midiControllerType(MusEGlobal::midiLearnCtrl); if(type < controlTypeComboBox->count() && type != controlTypeComboBox->currentIndex()) { controlTypeComboBox->blockSignals(true); @@ -223,7 +223,7 @@ void MidiAudioControl::ctrlTypeChanged(int idx) updateCtrlBoxes(); _ctrl = (ctrlHiSpinBox->value() << 8) + ctrlLoSpinBox->value(); - _ctrl = MusECore::midiCtrlTerms2Number(idx, _ctrl); + _ctrl = MusECore::midiCtrlTerms2Number(MusECore::MidiController::ControllerType(idx), _ctrl); resetLearn(); } @@ -233,7 +233,7 @@ void MidiAudioControl::ctrlHChanged() if(controlTypeComboBox->currentIndex() == -1) return; _ctrl = (ctrlHiSpinBox->value() << 8) + ctrlLoSpinBox->value(); - _ctrl = MusECore::midiCtrlTerms2Number(controlTypeComboBox->currentIndex(), _ctrl); + _ctrl = MusECore::midiCtrlTerms2Number(MusECore::MidiController::ControllerType(controlTypeComboBox->currentIndex()), _ctrl); resetLearn(); } @@ -243,7 +243,7 @@ void MidiAudioControl::ctrlLChanged() if(controlTypeComboBox->currentIndex() == -1) return; _ctrl = (ctrlHiSpinBox->value() << 8) + ctrlLoSpinBox->value(); - _ctrl = MusECore::midiCtrlTerms2Number(controlTypeComboBox->currentIndex(), _ctrl); + _ctrl = MusECore::midiCtrlTerms2Number(MusECore::MidiController::ControllerType(controlTypeComboBox->currentIndex()), _ctrl); resetLearn(); } diff --git a/muse2/muse/widgets/warn_bad_timing.ui b/muse2/muse/widgets/warn_bad_timing.ui index 7c92850f..6f183f37 100644 --- a/muse2/muse/widgets/warn_bad_timing.ui +++ b/muse2/muse/widgets/warn_bad_timing.ui @@ -48,7 +48,7 @@ - Don't ask me again + Don't warn me again
diff --git a/muse2/share/instruments/Emu-4mbgsgmmt-sf.idf b/muse2/share/instruments/Emu-4mbgsgmmt-sf.idf index b8b312c9..39aa1be5 100644 --- a/muse2/share/instruments/Emu-4mbgsgmmt-sf.idf +++ b/muse2/share/instruments/Emu-4mbgsgmmt-sf.idf @@ -429,11 +429,11 @@ - - - - - + + + + + diff --git a/muse2/share/instruments/Roland-E28.idf b/muse2/share/instruments/Roland-E28.idf index dd96fdd7..5d6d62d8 100644 --- a/muse2/share/instruments/Roland-E28.idf +++ b/muse2/share/instruments/Roland-E28.idf @@ -298,11 +298,11 @@ - - - - - + + + + + diff --git a/muse2/share/instruments/Yamaha-CS1x.idf b/muse2/share/instruments/Yamaha-CS1x.idf index 41e8e16a..1c05f5be 100644 --- a/muse2/share/instruments/Yamaha-CS1x.idf +++ b/muse2/share/instruments/Yamaha-CS1x.idf @@ -1565,17 +1565,17 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/muse2/share/instruments/gs.idf b/muse2/share/instruments/gs.idf index 873cbd18..0e0bca78 100644 --- a/muse2/share/instruments/gs.idf +++ b/muse2/share/instruments/gs.idf @@ -223,13 +223,15 @@ - - - - - + + + + + + + diff --git a/muse2/share/instruments/xg.idf b/muse2/share/instruments/xg.idf index 6d597d38..4d169a94 100644 --- a/muse2/share/instruments/xg.idf +++ b/muse2/share/instruments/xg.idf @@ -605,19 +605,21 @@ - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/muse2/xpm/reddot.xpm b/muse2/xpm/reddot.xpm index c094934a..eae182d0 100644 --- a/muse2/xpm/reddot.xpm +++ b/muse2/xpm/reddot.xpm @@ -1,17 +1,21 @@ /* XPM */ -static const char *reddot_xpm[]={ -"12 12 2 1", -". c None", -"# c #ff5600", -"...#####....", -"..#######...", -".#########..", -"###########.", -"###########.", -"###########.", -"###########.", -"###########.", -".#########..", -"..#######...", -"...#####....", -"............"}; +static const char * reddot_xpm[] = { +"12 16 2 1", +" c None", +". c #FF0000", +" ", +" ", +" ", +" .. ", +" .... ", +" ...... ", +" ........ ", +" ........ ", +" ........ ", +" ...... ", +" .... ", +" .. ", +" ", +" ", +" ", +" "}; -- cgit v1.2.3