From: werner s. <wsc...@us...> - 2005-12-12 22:03:53
|
Update of /cvsroot/lmuse/muse/muse/instruments In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7250/muse/instruments Modified Files: editinstrument.cpp editinstrument.h editinstrumentbase.ui minstrument.cpp minstrument.h Log Message: updates Index: minstrument.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/instruments/minstrument.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** minstrument.cpp 11 Nov 2005 22:21:44 -0000 1.26 --- minstrument.cpp 12 Dec 2005 22:03:44 -0000 1.27 *************** *** 20,23 **** --- 20,38 ---- //--------------------------------------------------------- + // Patch + //--------------------------------------------------------- + + Patch::Patch() + { + drumMap = 0; + } + + Patch::~Patch() + { + if (drumMap) + delete drumMap; + } + + //--------------------------------------------------------- // loadIDF //--------------------------------------------------------- *************** *** 48,61 **** continue; if (e.tagName() == "muse") { - node = node.firstChild(); QString version = e.attribute(QString("version")); ! while (!node.isNull()) { ! QDomElement e = node.toElement(); if (e.tagName() == "MidiInstrument") { MidiInstrument* i = new MidiInstrument(); ! i->read(node); midiInstruments.push_back(i); } - node = node.nextSibling(); } } --- 63,74 ---- continue; if (e.tagName() == "muse") { QString version = e.attribute(QString("version")); ! for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { ! QDomElement e = n.toElement(); if (e.tagName() == "MidiInstrument") { MidiInstrument* i = new MidiInstrument(); ! i->read(n); midiInstruments.push_back(i); } } } *************** *** 209,219 **** if (tag == "Patch") { ! Patch patch; ! patch.read(node, false); patches.push_back(patch); } else if (tag == "drummap") { ! Patch patch; ! patch.read(node, true); patches.push_back(patch); } --- 222,232 ---- if (tag == "Patch") { ! Patch* patch = new Patch; ! patch->read(node, false); patches.push_back(patch); } else if (tag == "drummap") { ! Patch* patch = new Patch; ! patch->read(node, true); patches.push_back(patch); } *************** *** 246,263 **** if (tag == "entry") { DrumMapEntry* de = drumMap->entry(idx); ! for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { ! e = n.toElement(); ! QString tag(e.tagName()); ! QString s(e.text()); ! int i = s.toInt(); ! if (tag == "name") ! de->name = s; ! else if (tag == "enote") ! de->enote = i; ! else if (tag == "anote") ! de->anote = i; ! else if (!tag.isEmpty()) ! printf("Patch:drummap:entry: unknown tag %s\n", tag.toLatin1().data()); ! } ++idx; } --- 259,263 ---- if (tag == "entry") { DrumMapEntry* de = drumMap->entry(idx); ! de->read(node); ++idx; } *************** *** 291,296 **** QString tag(e.tagName()); if (tag == "Patch") { ! Patch patch; ! patch.read(node, false); if (pg.empty()) { PatchGroup p; --- 291,296 ---- QString tag(e.tagName()); if (tag == "Patch") { ! Patch* patch = new Patch; ! patch->read(node, false); if (pg.empty()) { PatchGroup p; *************** *** 304,309 **** ; // TODO else if (tag == "drummap") { ! Patch patch; ! patch.read(node, true); if (pg.empty()) { PatchGroup p; --- 304,309 ---- ; // TODO else if (tag == "drummap") { ! Patch* patch = new Patch; ! patch->read(node, true); if (pg.empty()) { PatchGroup p; *************** *** 330,335 **** SysEx se; se.name = e.attribute("name"); ! QDomNode nnode = node.firstChild(); ! while (!nnode.isNull()) { e = nnode.toElement(); QString tag(e.tagName()); --- 330,334 ---- SysEx se; se.name = e.attribute("name"); ! for (QDomNode nnode = node.firstChild(); !nnode.isNull(); nnode = nnode.nextSibling()) { e = nnode.toElement(); QString tag(e.tagName()); *************** *** 340,344 **** else printf("MidiInstrument::read():SysEx: unknown tag %s\n", tag.toLatin1().data()); - nnode = nnode.nextSibling(); } sysex.push_back(se); --- 339,342 ---- *************** *** 369,378 **** PatchList& pl = i->patches; for (PatchList::const_iterator ipl = pl.begin(); ipl != pl.end(); ++ipl) { ! const Patch& mp = *ipl; ! if ((mp.typ & tmask) ! && (prog == mp.prog) ! && (hbank == mp.hbank || hb || mp.hbank == -1) ! && (lbank == mp.lbank || lb || mp.lbank == -1)) ! return mp.name; } } --- 367,376 ---- PatchList& pl = i->patches; for (PatchList::const_iterator ipl = pl.begin(); ipl != pl.end(); ++ipl) { ! const Patch* mp = *ipl; ! if ((mp->typ & tmask) ! && (prog == mp->prog) ! && (hbank == mp->hbank || hb || mp->hbank == -1) ! && (lbank == mp->lbank || lb || mp->lbank == -1)) ! return mp->name; } } *************** *** 399,408 **** PatchList& pl = i->patches; for (PatchList::const_iterator ipl = pl.begin(); ipl != pl.end(); ++ipl) { ! const Patch& mp = *ipl; ! if ((mp.typ & tmask) ! && (prog == mp.prog) ! && (hbank == mp.hbank || hb || mp.hbank == -1) ! && (lbank == mp.lbank || lb || mp.lbank == -1)) { ! return mp.drumMap; } } --- 397,406 ---- PatchList& pl = i->patches; for (PatchList::const_iterator ipl = pl.begin(); ipl != pl.end(); ++ipl) { ! const Patch* mp = *ipl; ! if ((mp->typ & tmask) ! && (prog == mp->prog) ! && (hbank == mp->hbank || hb || mp->hbank == -1) ! && (lbank == mp->lbank || lb || mp->lbank == -1)) { ! return mp->drumMap; } } *************** *** 426,434 **** PatchList& pl = i->patches; for (PatchList::const_iterator ipl = pl.begin(); ipl != pl.end(); ++ipl) { ! const Patch& mp = *ipl; ! if (mp.typ & mask) { ! int id = ((mp.hbank & 0xff) << 16) ! + ((mp.lbank & 0xff) << 8) + (mp.prog & 0xff); ! QAction* a = pm->addAction(mp.name); a->setData(id); } --- 424,432 ---- PatchList& pl = i->patches; for (PatchList::const_iterator ipl = pl.begin(); ipl != pl.end(); ++ipl) { ! const Patch* mp = *ipl; ! if (mp->typ & mask) { ! int id = ((mp->hbank & 0xff) << 16) ! + ((mp->lbank & 0xff) << 8) + (mp->prog & 0xff); ! QAction* a = pm->addAction(mp->name); a->setData(id); } *************** *** 440,448 **** PatchList& pl = pg.front().patches; for (PatchList::const_iterator ipl = pl.begin(); ipl != pl.end(); ++ipl) { ! const Patch& mp = *ipl; ! if (mp.typ & mask) { ! int id = ((mp.hbank & 0xff) << 16) ! + ((mp.lbank & 0xff) << 8) + (mp.prog & 0xff); ! QAction* a = menu->addAction(mp.name); a->setData(id); } --- 438,446 ---- PatchList& pl = pg.front().patches; for (PatchList::const_iterator ipl = pl.begin(); ipl != pl.end(); ++ipl) { ! const Patch* mp = *ipl; ! if (mp->typ & mask) { ! int id = ((mp->hbank & 0xff) << 16) ! + ((mp->lbank & 0xff) << 8) + (mp->prog & 0xff); ! QAction* a = menu->addAction(mp->name); a->setData(id); } Index: minstrument.h =================================================================== RCS file: /cvsroot/lmuse/muse/muse/instruments/minstrument.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** minstrument.h 5 Nov 2005 16:56:17 -0000 1.13 --- minstrument.h 12 Dec 2005 22:03:44 -0000 1.14 *************** *** 29,35 **** DrumMap* drumMap; void read(QDomNode, bool); }; ! typedef std::list<Patch> PatchList; //--------------------------------------------------------- --- 29,40 ---- DrumMap* drumMap; void read(QDomNode, bool); + + Patch(); + ~Patch(); }; ! typedef std::list<Patch*> PatchList; ! typedef PatchList::iterator iPatch; ! typedef PatchList::const_iterator ciPatch; //--------------------------------------------------------- *************** *** 94,97 **** --- 99,104 ---- MidiController* midiController(int num) const; void reset(MidiOutPort*); + + std::vector<PatchGroup>* groups() { return &pg; } }; Index: editinstrument.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/instruments/editinstrument.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** editinstrument.cpp 4 Nov 2005 12:03:35 -0000 1.5 --- editinstrument.cpp 12 Dec 2005 22:03:44 -0000 1.6 *************** *** 4,8 **** // $Id$ // ! // (C) Copyright 2003 Werner Schweer (ws...@se...) //========================================================= --- 4,8 ---- // $Id$ // ! // (C) Copyright 2005 Werner Schweer (ws...@se...) //========================================================= *************** *** 21,27 **** for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i) instrumentList->addItem((*i)->iname()); ! //TD instrumentList->setSelected(0, true); ! connect(instrumentList, SIGNAL(selectionChanged()), SLOT(instrumentChanged())); ! instrumentChanged(); } --- 21,30 ---- for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i) instrumentList->addItem((*i)->iname()); ! instrumentList->setItemSelected(instrumentList->item(0), true); ! connect(instrumentList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), ! SLOT(instrumentChanged(QListWidgetItem*))); ! connect(patchView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), ! SLOT(patchChanged(QTreeWidgetItem*))); ! instrumentChanged(instrumentList->item(0)); } *************** *** 30,41 **** //--------------------------------------------------------- ! void EditInstrument::instrumentChanged() { - #if 0 //TD - QListWidgetItem* sel = instrumentList->selectedItem(); if (sel == 0) return; QString iname = sel->text(); - printf("instrument changed: %s\n", iname.toLatin1().data()); iMidiInstrument i = midiInstruments.begin(); for (; i != midiInstruments.end(); ++i) { --- 33,41 ---- //--------------------------------------------------------- ! void EditInstrument::instrumentChanged(QListWidgetItem* sel) { if (sel == 0) return; QString iname = sel->text(); iMidiInstrument i = midiInstruments.begin(); for (; i != midiInstruments.end(); ++i) { *************** *** 43,50 **** break; } ! // MidiInstrument* instr = *i; ! // populate patch list ! #endif } --- 43,74 ---- break; } ! patchView->clear(); ! if (i == midiInstruments.end()) ! return; // populate patch list ! std::vector<PatchGroup>* pg = (*i)->groups(); ! for (std::vector<PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) { ! QTreeWidgetItem* item = new QTreeWidgetItem; ! item->setText(0, g->name); ! patchView->addTopLevelItem(item); ! for (iPatch p = g->patches.begin(); p != g->patches.end(); ++p) { ! QTreeWidgetItem* sitem = new QTreeWidgetItem; ! sitem->setText(0, (*p)->name); ! item->addChild(sitem); ! } ! } ! } ! ! //--------------------------------------------------------- ! // patchChanged ! //--------------------------------------------------------- ! ! void EditInstrument::patchChanged(QTreeWidgetItem* sel) ! { ! if (sel == 0) { ! textLabelPatchName->setText(""); ! return; ! } ! textLabelPatchName->setText(sel->text(0)); } Index: editinstrument.h =================================================================== RCS file: /cvsroot/lmuse/muse/muse/instruments/editinstrument.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** editinstrument.h 4 Nov 2005 12:03:35 -0000 1.3 --- editinstrument.h 12 Dec 2005 22:03:44 -0000 1.4 *************** *** 25,29 **** virtual void fileSaveAs(); virtual void fileExit(); ! void instrumentChanged(); public: --- 25,29 ---- virtual void fileSaveAs(); virtual void fileExit(); ! void instrumentChanged(QListWidgetItem*); public: Index: editinstrumentbase.ui =================================================================== RCS file: /cvsroot/lmuse/muse/muse/instruments/editinstrumentbase.ui,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** editinstrumentbase.ui 4 Nov 2005 12:03:35 -0000 1.4 --- editinstrumentbase.ui 12 Dec 2005 22:03:44 -0000 1.5 *************** *** 9,14 **** <x>0</x> <y>0</y> ! <width>771</width> ! <height>440</height> </rect> </property> --- 9,14 ---- <x>0</x> <y>0</y> ! <width>750</width> [...1292 lines suppressed...] <y>0</y> ! <width>840</width> ! <height>420</height> </rect> </property> --- 668,673 ---- <x>0</x> <y>0</y> ! <width>155</width> ! <height>213</height> </rect> </property> *************** *** 768,771 **** --- 751,755 ---- <layoutdefault spacing="6" margin="11" /> <pixmapfunction></pixmapfunction> + <includes/> <resources/> <connections/> |