From fde27296b934fde533cdc47a8db7f7db50290922 Mon Sep 17 00:00:00 2001 From: Nil Geisweiller Date: Wed, 27 Dec 2006 18:39:21 +0000 Subject: see ChangeLog --- muse/ChangeLog | 3 ++ muse/muse/arranger/canvas.cpp | 28 +++++++++----- muse/muse/synth.cpp | 35 +++-------------- muse/synti/deicsonze/deicsonze.cpp | 29 +------------- muse/synti/deicsonze/deicsonze.h | 1 - muse/synti/libsynti/mess.h | 1 - muse/synti/zynaddsubfx/main.cpp | 79 ++++++++++++++++++++++++-------------- 7 files changed, 77 insertions(+), 99 deletions(-) diff --git a/muse/ChangeLog b/muse/ChangeLog index 125af619..3d124340 100644 --- a/muse/ChangeLog +++ b/muse/ChangeLog @@ -1,3 +1,6 @@ +27.12 (ng) + - deleted getBankName and getPatchInfo of zynaddsubfx + - add gradient color for the tracks 26.12 (ng) - changed MessSynthIF::populatePatchPopup to make is work with banks - added getPatchInfo of DeicsOnze diff --git a/muse/muse/arranger/canvas.cpp b/muse/muse/arranger/canvas.cpp index 655607fc..a5a75058 100644 --- a/muse/muse/arranger/canvas.cpp +++ b/muse/muse/arranger/canvas.cpp @@ -161,7 +161,7 @@ void PartCanvas::drawWavePart(QPainter& p, Part* wp, int y0, int th, int from, i void PartCanvas::paint(QPainter& p, QRect r) { -// printf("canvas paint %d %d %d %d\n", r.x(), r.y(), r.width(), r.height()); + //printf("canvas paint %d %d %d %d\n", r.x(), r.y(), r.width(), r.height()); QFont f = font(); f.setPointSize(8); p.setFont(f); @@ -193,23 +193,31 @@ void PartCanvas::paint(QPainter& p, QRect r) break; QRect pr(x1, y, len, h - partBorderWidth); - bool clone = part->isClone(); + bool clone = part->isClone(); QPen pen(Qt::black, partBorderWidth, clone ? Qt::DashLine : Qt::SolidLine); - QBrush brush(Qt::SolidPattern); - if (part->mute()) { - pen.setColor(Qt::red); - brush.setColor(Qt::gray); - } - else if (part->selected()) { + QBrush brush(Qt::SolidPattern); + QLinearGradient lg(0, pr.y() - wpos.y()-r.y(), + 0, pr.y()+ 2*pr.height() -wpos.y()-r.y()); + lg.setColorAt(0, part->selected()?Qt::gray + :config.partColors[part->colorIndex()]); + lg.setColorAt(1, Qt::white); + QBrush brushLG(lg); + if (part->selected()) { pen.setColor(config.partColors[part->colorIndex()]); brush.setColor(config.selectPartBg); + p.setBrush(brushLG); + } + else if (part->mute()) { + pen.setColor(Qt::red); + brush.setColor(Qt::gray); + p.setBrush(brush); } else { - brush.setColor(config.partColors[part->colorIndex()]); + //brush.setColor(config.partColors[part->colorIndex()]); + p.setBrush(brushLG); } p.setPen(pen); - p.setBrush(brush); // // we want to draw the rectangle without transformation // to get equal border width horizontal and vertical diff --git a/muse/muse/synth.cpp b/muse/muse/synth.cpp index e9650209..bf309877 100644 --- a/muse/muse/synth.cpp +++ b/muse/muse/synth.cpp @@ -473,35 +473,10 @@ QString MessSynthIF::getPatchName(int channel, int prog) void MessSynthIF::populatePatchPopup(QMenu* menu, int ch) { menu->clear(); - const char* bank = _mess->getBankName(0); - int idx = 0; - if (bank) { - while (bank) { - // synthesizer has banks - QMenu* a = menu->addMenu(QString(bank)); - - MidiPatch patch; - patch.typ = 0; - patch.hbank = idx << 8; - patch.lbank = idx; - patch.prog = 0; - const MidiPatch* mp = _mess->getPatchInfo(ch, &patch); - while (mp) { - int id = ((mp->hbank & 0xff) << 16) - + ((mp->lbank & 0xff) << 8) + mp->prog; - QAction* aa = a->addAction(QString(mp->name)); - aa->setData(id); - mp = _mess->getPatchInfo(ch, mp); - } - ++idx; - bank = _mess->getBankName(idx); - } - } - else { - const MidiPatch* mp = _mess->getPatchInfo(ch, 0); - QMenu *hm = NULL, *lm = NULL; - while (mp) { - switch(mp->typ) { + const MidiPatch* mp = _mess->getPatchInfo(ch, 0); + QMenu *hm = NULL, *lm = NULL; + while (mp) { + switch(mp->typ) { case MP_TYPE_HBANK : hm = menu->addMenu(QString(mp->name)); break; @@ -520,10 +495,10 @@ void MessSynthIF::populatePatchPopup(QMenu* menu, int ch) } mp = _mess->getPatchInfo(ch, mp); } - } } + //--------------------------------------------------------- // getData //--------------------------------------------------------- diff --git a/muse/synti/deicsonze/deicsonze.cpp b/muse/synti/deicsonze/deicsonze.cpp index a615a1bd..d6620bec 100644 --- a/muse/synti/deicsonze/deicsonze.cpp +++ b/muse/synti/deicsonze/deicsonze.cpp @@ -3402,34 +3402,6 @@ const char* DeicsOnze::getPatchName(int ch, int val, int) const { return " "; } -//--------------------------------------------------------- -// getBankName -//--------------------------------------------------------- -const char* DeicsOnze::getBankName(int /*val*/) const { - /*QString catstr, substr, retstr; - Category* c; - Subcategory* s; - int hbank = (val & 0xff00) >> 8; - int lbank = val & 0x7f; - if (hbank > 127) // map "dont care" to 0 - hbank = 0; - if (lbank > 127) - lbank = 0; - c = _set->findCategory(hbank); - if(c) { - catstr = QString(c->_categoryName.c_str()); - s = c->findSubcategory(lbank); - if(s) { - substr = QString(s->_subcategoryName.c_str()); - retstr = catstr + QString("->") + substr; - return retstr.toAscii().data(); - } - else return NULL; - } - else*/ - return NULL; -} - //--------------------------------------------------------- // getPatchInfo //--------------------------------------------------------- @@ -3515,6 +3487,7 @@ const MidiPatch* DeicsOnze::getPatchInfo(int /*ch*/, const MidiPatch* p) const { return &_patch; } else { + _patch.hbank++; return getPatchInfo(0, &_patch); } } diff --git a/muse/synti/deicsonze/deicsonze.h b/muse/synti/deicsonze/deicsonze.h index 48b2c7f6..6102eb34 100644 --- a/muse/synti/deicsonze/deicsonze.h +++ b/muse/synti/deicsonze/deicsonze.h @@ -538,7 +538,6 @@ class DeicsOnze : public Mess { virtual const char* getPatchName(int ch, int number, int) const; virtual const MidiPatch* getPatchInfo(int, const MidiPatch *) const; - virtual const char* getBankName(int) const; virtual int getControllerInfo(int arg1, const char** arg2, int* arg3, int* arg4, int* arg5); diff --git a/muse/synti/libsynti/mess.h b/muse/synti/libsynti/mess.h index 7f96db18..c407d17e 100644 --- a/muse/synti/libsynti/mess.h +++ b/muse/synti/libsynti/mess.h @@ -68,7 +68,6 @@ class Mess { virtual int getControllerInfo(int, const char**, int*, int*, int*) {return 0;} virtual const char* getPatchName(int, int, int) const { return "?"; } virtual const MidiPatch* getPatchInfo(int, const MidiPatch*) const { return 0; } - virtual const char* getBankName(int) const { return 0; } // synthesizer -> host communication void sendEvent(MidiEvent); // called from synti diff --git a/muse/synti/zynaddsubfx/main.cpp b/muse/synti/zynaddsubfx/main.cpp index ebe18274..10f968bd 100644 --- a/muse/synti/zynaddsubfx/main.cpp +++ b/muse/synti/zynaddsubfx/main.cpp @@ -48,7 +48,6 @@ class Zynadd : public Mess, public Master virtual void getInitData(int*, const unsigned char**); virtual int getControllerInfo(int, const char**, int*, int*, int*); virtual const char* getPatchName(int, int, int) const; - virtual const char* getBankName(int) const; virtual const MidiPatch* getPatchInfo(int, const MidiPatch*) const; virtual bool hasGui() const { return true; } virtual bool guiVisible() const { return _guiVisible; } @@ -186,17 +185,6 @@ bool Zynadd::loadBank(int n) return true; } -//--------------------------------------------------------- -// getBankName -//--------------------------------------------------------- - -const char* Zynadd::getBankName(int n) const - { - n += 1; // bank 0 is always empty ?! -// printf("Zyn: getBankName %d <%s>\n", n, bank.banks[n].name); - return bank.banks[n].name; - } - //--------------------------------------------------------- // getControllerInfo //--------------------------------------------------------- @@ -260,7 +248,7 @@ int Zynadd::getControllerInfo(int i, const char** name, int* num, int* min, int* //--------------------------------------------------------- const char* Zynadd::getPatchName(int, int val, int) const - { + { int bankNo = (val >> 8) + 1; int program = val & 0x7f; return messPatch[bankNo][program]; @@ -270,23 +258,56 @@ const char* Zynadd::getPatchName(int, int val, int) const // getPatchInfo //--------------------------------------------------------- -const MidiPatch* Zynadd::getPatchInfo(int, const MidiPatch* p) const - { - if (!p) - return 0; - int bn = ((p->hbank << 8) & 0xff) + ((p->lbank) & 0xff) + 1; - for (unsigned int i = p->prog + 1; i < 128; ++i) { - if (messPatch[bn][i]) { - patch.name = messPatch[bn][i]; - patch.typ = 0xff; - patch.prog = i; - patch.hbank = p->hbank; - patch.lbank = p->lbank; - return &patch; - } - } - return 0; +const MidiPatch* Zynadd::getPatchInfo(int, const MidiPatch* p) const { + if(p) { + patch.hbank = p->hbank; + patch.lbank = p->lbank; + patch.prog = p->prog; + int bn = ((patch.hbank << 7) + patch.lbank); //7 because lbank is signed + switch(p->typ) { + case MP_TYPE_LBANK : + patch.typ = 0; + patch.name = messPatch[bn + 1][patch.prog]; + if(patch.name) return &patch; + else return getPatchInfo(0, &patch); + break; + default : + if(patch.prog + 1 < 128) { + patch.prog++; + patch.name = messPatch[bn + 1][patch.prog]; + if(patch.name) return &patch; + else return getPatchInfo(0, &patch); + } + else { + patch.prog = 0; + if(bn + 1 < MAX_NUM_BANKS - 1) { + bn++; + patch.name = bank.banks[bn + 1].name; + patch.hbank = bn / 128; + patch.lbank = bn % 128; + patch.typ = MP_TYPE_LBANK; + if(patch.name) return &patch; + else return getPatchInfo(0, &patch); + } + else return NULL; } + break; + } + } + else { + patch.typ = MP_TYPE_LBANK; + patch.hbank = 0; + patch.lbank = 0; + patch.prog = 0; + patch.name = bank.banks[(patch.hbank << 7) + patch.lbank + 1].name; + if(patch.name) return &patch; + else { + patch.typ = 0; + patch.prog = 127; //hack to go faster + return getPatchInfo(0, &patch); + } + } +} //--------------------------------------------------------- // getInitData -- cgit v1.2.3