From 09dc291bba8d2421a1898366864a3690638e9d39 Mon Sep 17 00:00:00 2001 From: "Tim E. Real" Date: Tue, 15 Jun 2010 20:44:31 +0000 Subject: See ChangeLog --- muse/ChangeLog | 8 +++++++ muse/muse/ctrl/ctrlcanvas.cpp | 7 +++++- muse/muse/ctrl/ctrlpanel.cpp | 2 +- muse/muse/driver/jackmidi.cpp | 53 ++++++++++++++++++++++++++++++++++++++--- muse/muse/midiedit/drumedit.cpp | 8 +++++++ 5 files changed, 73 insertions(+), 5 deletions(-) diff --git a/muse/ChangeLog b/muse/ChangeLog index a49ca8dd..88bfdbf8 100644 --- a/muse/ChangeLog +++ b/muse/ChangeLog @@ -1,3 +1,11 @@ +15.06.2010 + * Fixed: Jack midi output: Sent pitch bend and program values were incorrect, if coming from midi keyboard. (T356) + - Reported by Pieter while using Hurdy Gurdy vst under fst. Tests OK now, here. + * Fixed: Drum editor: Controller graph not in current tool mode (pencil, eraser etc.), when first opened. (T356) + - Call setTool() in DrumEdit::addCtrl(). + * Fixing: Drum editor: Velocity controller graph showing incorrect for selected drum, or showing for all drums, when first opened. (T356) + - WIP. Still not quite correct, but at least now it doesn't show all drum velocities when first opened. + (This is interesting! I will try to allow 'no drum' list selection, to show all drum velocities at once, just like piano roll.) 13.06.2010 * Fixed: More fixes to marker list, selected item was still not right. (T356) 03.06.2010 diff --git a/muse/muse/ctrl/ctrlcanvas.cpp b/muse/muse/ctrl/ctrlcanvas.cpp index 97d87406..f5bcfce0 100644 --- a/muse/muse/ctrl/ctrlcanvas.cpp +++ b/muse/muse/ctrl/ctrlcanvas.cpp @@ -138,7 +138,8 @@ CtrlCanvas::CtrlCanvas(MidiEditor* e, QWidget* parent, int xmag, connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); curDrumInstrument = editor->curDrumInstrument(); - + //printf("CtrlCanvas::CtrlCanvas curDrumInstrument:%d\n", curDrumInstrument); + connect(editor, SIGNAL(curDrumInstrumentChanged(int)), SLOT(setCurDrumInstrument(int))); updateItems(); } @@ -567,8 +568,11 @@ void CtrlCanvas::updateItems() if(_cnum == CTRL_VELOCITY && e.type() == Note) { + //printf("CtrlCanvas::updateItems CTRL_VELOCITY curDrumInstrument:%d\n", curDrumInstrument); if(curDrumInstrument == -1) { + // This is interesting - it would allow ALL drum note velocities to be shown. + // But currently the drum list ALWAYS has a selected item so this is not supposed to happen. items.add(new CEvent(e, part, e.velo())); } else if (e.dataA() == curDrumInstrument) //same note @@ -1507,6 +1511,7 @@ void CtrlCanvas::draw(QPainter& p, const QRect& rect) void CtrlCanvas::setCurDrumInstrument(int di) { curDrumInstrument = di; + //printf("CtrlCanvas::setCurDrumInstrument curDrumInstrument:%d\n", curDrumInstrument); // // check if current controller is only valid for diff --git a/muse/muse/ctrl/ctrlpanel.cpp b/muse/muse/ctrl/ctrlpanel.cpp index e55890ee..95cdf45d 100644 --- a/muse/muse/ctrl/ctrlpanel.cpp +++ b/muse/muse/ctrl/ctrlpanel.cpp @@ -345,7 +345,7 @@ void CtrlPanel::ctrlChanged(double val) } else // Shouldn't happen, but... - if(ival < _ctrl->minVal() || ival > _ctrl->maxVal()) + if((ival < _ctrl->minVal()) || (ival > _ctrl->maxVal())) { //if(mp->hwCtrlState(chan, _dnum) != CTRL_VAL_UNKNOWN) if(curval != CTRL_VAL_UNKNOWN) diff --git a/muse/muse/driver/jackmidi.cpp b/muse/muse/driver/jackmidi.cpp index e465a491..0cdc1393 100644 --- a/muse/muse/driver/jackmidi.cpp +++ b/muse/muse/driver/jackmidi.cpp @@ -1100,6 +1100,11 @@ void MidiJackDevice::processEvent(const MidiPlayEvent& event) int chn = event.channel(); unsigned t = event.time(); + int a = event.dataA(); + int b = event.dataB(); + // Perhaps we can find use for this value later, together with the Jack midi MusE port(s). + // No big deal if not. Not used for now. + int port = event.port(); // TODO: No sub-tick playback resolution yet, with external sync. // Just do this 'standard midi 64T timing thing' for now until we figure out more precise external timings. @@ -1113,13 +1118,42 @@ void MidiJackDevice::processEvent(const MidiPlayEvent& event) printf("MidiJackDevice::processEvent time:%d type:%d ch:%d A:%d B:%d\n", event.time(), event.type(), event.channel(), event.dataA(), event.dataB()); #endif + if(event.type() == ME_PROGRAM) + { + // don't output program changes for GM drum channel + //if (!(song->mtype() == MT_GM && chn == 9)) { + int hb = (a >> 16) & 0xff; + int lb = (a >> 8) & 0xff; + int pr = a & 0x7f; + + // p3.3.44 + //printf("MidiJackDevice::processEvent ME_PROGRAM time:%d type:%d ch:%d A:%d B:%d hb:%d lb:%d pr:%d\n", + // event.time(), event.type(), event.channel(), event.dataA(), event.dataB(), hb, lb, pr); + + if (hb != 0xff) + queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, CTRL_HBANK, hb)); + if (lb != 0xff) + queueEvent(MidiPlayEvent(t+1, port, chn, ME_CONTROLLER, CTRL_LBANK, lb)); + queueEvent(MidiPlayEvent(t+2, port, chn, ME_PROGRAM, pr, 0)); + // } + } + else + if(event.type() == ME_PITCHBEND) + { + int v = a + 8192; + // p3.3.44 + //printf("MidiJackDevice::processEvent ME_PITCHBEND v:%d time:%d type:%d ch:%d A:%d B:%d\n", v, event.time(), event.type(), event.channel(), event.dataA(), event.dataB()); + + queueEvent(MidiPlayEvent(t, port, chn, ME_PITCHBEND, v & 0x7f, (v >> 7) & 0x7f)); + } + else if(event.type() == ME_CONTROLLER) { - int a = event.dataA(); - int b = event.dataB(); + //int a = event.dataA(); + //int b = event.dataB(); // Perhaps we can find use for this value later, together with the Jack midi MusE port(s). // No big deal if not. Not used for now. - int port = event.port(); + //int port = event.port(); int nvh = 0xff; int nvl = 0xff; @@ -1136,6 +1170,9 @@ void MidiJackDevice::processEvent(const MidiPlayEvent& event) if(a == CTRL_PITCH) { int v = b + 8192; + // p3.3.44 + //printf("MidiJackDevice::processEvent CTRL_PITCH v:%d time:%d type:%d ch:%d A:%d B:%d\n", v, event.time(), event.type(), event.channel(), event.dataA(), event.dataB()); + queueEvent(MidiPlayEvent(t, port, chn, ME_PITCHBEND, v & 0x7f, (v >> 7) & 0x7f)); } else if (a == CTRL_PROGRAM) @@ -1145,6 +1182,11 @@ void MidiJackDevice::processEvent(const MidiPlayEvent& event) int hb = (b >> 16) & 0xff; int lb = (b >> 8) & 0xff; int pr = b & 0x7f; + + // p3.3.44 + //printf("MidiJackDevice::processEvent CTRL_PROGRAM time:%d type:%d ch:%d A:%d B:%d hb:%d lb:%d pr:%d\n", + // event.time(), event.type(), event.channel(), event.dataA(), event.dataB(), hb, lb, pr); + if (hb != 0xff) queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, CTRL_HBANK, hb)); if (lb != 0xff) @@ -1326,10 +1368,15 @@ void MidiJackDevice::processMidi() else if(i->type() == ME_PITCHBEND) { + // p3.3.44 + //printf("MidiJackDevice::processMidi playEvents ME_PITCHBEND time:%d type:%d ch:%d A:%d B:%d\n", (*i).time(), (*i).type(), (*i).channel(), (*i).dataA(), (*i).dataB()); + int da = mp->limitValToInstrCtlRange(CTRL_PITCH, i->dataA()); if(!mp->setHwCtrlState(i->channel(), CTRL_PITCH, da)) continue; //mp->setHwCtrlState(i->channel(), CTRL_PITCH, da); + + //(MidiPlayEvent(t, port, chn, ME_PITCHBEND, v & 0x7f, (v >> 7) & 0x7f)); } else if(i->type() == ME_PROGRAM) diff --git a/muse/muse/midiedit/drumedit.cpp b/muse/muse/midiedit/drumedit.cpp index c6204cfd..6f7cab59 100644 --- a/muse/muse/midiedit/drumedit.cpp +++ b/muse/muse/midiedit/drumedit.cpp @@ -325,6 +325,9 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini new DWhatsThis(header, header); dlist = new DList(header, split1w1, yscale); + // p3.3.44 + setCurDrumInstrument(dlist->getSelectedInstrument()); + connect(dlist, SIGNAL(keyPressed(int, bool)), canvas, SLOT(keyPressed(int, bool))); connect(dlist, SIGNAL(keyReleased(int, bool)), canvas, SLOT(keyReleased(int, bool))); connect(dlist, SIGNAL(mapChanged(int, int)), canvas, SLOT(mapChanged(int, int))); @@ -860,8 +863,13 @@ CtrlEdit* DrumEdit::addCtrl() connect(tools2, SIGNAL(toolChanged(int)), ctrlEdit, SLOT(setTool(int))); connect(dlist, SIGNAL(curDrumInstrumentChanged(int)), SLOT(setCurDrumInstrument(int))); + //printf("DrumEdit::addCtrl curDrumInstrument:%d\n", dlist->getSelectedInstrument()); + setCurDrumInstrument(dlist->getSelectedInstrument()); + // p3.3.44 + ctrlEdit->setTool(tools2->curTool()); + ctrlEdit->setXPos(hscroll->pos()); ctrlEdit->setXMag(hscroll->getScaleValue()); -- cgit v1.2.3