Update of /cvsroot/lmuse/muse/muse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10982 Modified Files: app.cpp conf.cpp globals.cpp globals.h midirc.cpp midirc.h song.cpp songfile.cpp wave.cpp wave.h Log Message: updates&fixes Index: wave.h =================================================================== RCS file: /cvsroot/lmuse/muse/muse/wave.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** wave.h 7 Aug 2005 14:22:49 -0000 1.9 --- wave.h 29 Oct 2005 18:17:04 -0000 1.10 *************** *** 41,45 **** class SndFile { static SndFileList _sndFiles; ! QFileInfo* finfo; SNDFILE* sf; SF_INFO sfinfo; --- 41,45 ---- class SndFile { static SndFileList _sndFiles; ! QFileInfo finfo; SNDFILE* sf; SF_INFO sfinfo; *************** *** 72,79 **** void update(); ! QString basename() const; // filename without extension ! QString dirPath() const; // path ! QString path() const; // path with filename ! QString name() const; // filename unsigned samples() const; --- 72,79 ---- void update(); ! QString basename(); // filename without extension ! QString dirPath(); // path ! QString path(); // path with filename ! QString name(); // filename unsigned samples() const; Index: globals.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/globals.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** globals.cpp 27 Oct 2005 17:27:18 -0000 1.31 --- globals.cpp 29 Oct 2005 18:17:04 -0000 1.32 *************** *** 138,146 **** bool rcEnable = false; - unsigned char rcStopNote = 28; - unsigned char rcRecordNote = 31; - unsigned char rcGotoLeftMarkNote = 33; - unsigned char rcPlayNote = 29; - bool midiSeqRunning = false; --- 138,141 ---- Index: midirc.h =================================================================== RCS file: /cvsroot/lmuse/muse/muse/midirc.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** midirc.h 29 Oct 2005 14:06:21 -0000 1.1 --- midirc.h 29 Oct 2005 18:17:04 -0000 1.2 *************** *** 44,47 **** --- 44,49 ---- bool isActive(int action); bool doAction(const MidiEvent&); + void read(QDomNode); + void write(Xml&); }; Index: midirc.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/midirc.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** midirc.cpp 29 Oct 2005 14:06:21 -0000 1.1 --- midirc.cpp 29 Oct 2005 18:17:04 -0000 1.2 *************** *** 93,96 **** --- 93,107 ---- return true; } + // + // compare controller and controller value + // TODO: maybe we need a special option to + // ignore the controller value + // + if ((e.type() == ME_CONTROLLER) + && i->event.dataA() == e.dataA() + && i->event.dataB() == e.dataB()) { + emitAction(i->action); + return true; + } } } *************** *** 98,99 **** --- 109,168 ---- } + //--------------------------------------------------------- + // read + //--------------------------------------------------------- + + void MidiRCList::read(QDomNode node) + { + int action = 0; + MidiEvent event; + for (node = node.firstChild(); !node.isNull(); node = node.nextSibling()) { + QDomElement e = node.toElement(); + if (e.isNull()) + continue; + if (e.tagName() == "action") { + action = e.attribute("id", "0").toInt(); + for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { + QDomElement e1 = node.toElement(); + if (e1.isNull()) + continue; + if (e1.tagName() == "noteOn") { + event.setType(ME_NOTEON); + event.setA(e1.attribute("pitch","0").toInt()); + } + else if (e1.tagName() == "controller") { + event.setType(ME_CONTROLLER); + event.setA(e1.attribute("no","0").toInt()); + event.setB(e1.attribute("val","0").toInt()); + } + else + printf("MusE:midiRC:action: unknown tag %s\n", e1.tagName().latin1()); + } + setAction(event, action); + } + else + printf("MusE:midiRC: unknown tag %s\n", e.tagName().latin1()); + } + } + + //--------------------------------------------------------- + // write + //--------------------------------------------------------- + + void MidiRCList::write(Xml& xml) + { + xml.tag("midiRC"); + for (iMidiRC i = begin(); i != end(); ++i) { + xml.tag("action id=\"%d\"", i->action); + if (i->event.type() == ME_NOTEON) + xml.tag("noteOn pitch=\"%d\"", i->event.dataA()); + else if (i->event.type() == ME_CONTROLLER) + xml.tag("controller no=\"%d\" val=\"%d\"", + i->event.dataA(), i->event.dataB()); + else + printf("remote event type %d not supported\n", i->event.type()); + xml.etag("action"); + } + xml.etag("midiRC"); + } + Index: conf.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/conf.cpp,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** conf.cpp 27 Oct 2005 17:27:18 -0000 1.62 --- conf.cpp 29 Oct 2005 18:17:04 -0000 1.63 *************** *** 20,23 **** --- 20,24 ---- #include "mixer.h" #include "globals.h" + #include "midirc.h" extern void writeMidiTransforms(Xml& xml); *************** *** 38,68 **** //--------------------------------------------------------- - // readSeqConfiguration - //--------------------------------------------------------- - - static void readSeqConfiguration(QDomNode node) - { - while (!node.isNull()) { - QDomElement e = node.toElement(); - QString tag(e.tagName()); - QString s = e.text(); - int i = s.toInt(); - if (tag == "rcStop") - rcStopNote = i; - else if (tag == "rcEnable") - rcEnable = i; - else if (tag == "rcRecord") - rcRecordNote = i; - else if (tag == "rcGotoLeft") - rcGotoLeftMarkNote = i; - else if (tag == "rcPlay") - rcPlayNote = i; - else - printf("MusE:readSeqConfiguration: unknown tag %s\n", e.tagName().latin1()); - node = node.nextSibling(); - } - } - - //--------------------------------------------------------- // readConfiguration //--------------------------------------------------------- --- 39,42 ---- *************** *** 224,231 **** mtcOffset = MTC(h, m, s, f, sf); } - else if (tag == "sequencer") - readSeqConfiguration(node.firstChild()); else if (tag == "shortcuts") readShortCuts(node.firstChild()); else if (tag == "division") config.division = i; --- 198,205 ---- mtcOffset = MTC(h, m, s, f, sf); } else if (tag == "shortcuts") readShortCuts(node.firstChild()); + else if (tag == "midiRC") + midiRCList.read(node); else if (tag == "division") config.division = i; *************** *** 340,358 **** //--------------------------------------------------------- - // writeSeqConfiguration - //--------------------------------------------------------- - - static void writeSeqConfiguration(Xml& xml) - { - xml.tag("sequencer"); - xml.intTag("rcEnable", rcEnable); - xml.intTag("rcStop", rcStopNote); - xml.intTag("rcRecord", rcRecordNote); - xml.intTag("rcGotoLeft", rcGotoLeftMarkNote); - xml.intTag("rcPlay", rcPlayNote); - xml.etag("sequencer"); - } - - //--------------------------------------------------------- // writeGlobalConfiguration //--------------------------------------------------------- --- 314,317 ---- *************** *** 459,465 **** xml.colorTag("bigtimeBackgroundcolor", config.bigTimeBackgroundColor); - writeSeqConfiguration(xml); - writeShortCuts(xml); xml.etag("configuration"); } --- 418,424 ---- xml.colorTag("bigtimeBackgroundcolor", config.bigTimeBackgroundColor); writeShortCuts(xml); + midiRCList.write(xml); + xml.etag("configuration"); } *************** *** 507,512 **** mixer2->write(xml, "mixer2"); - writeSeqConfiguration(xml); - writeMidiTransforms(xml); xml.etag("configuration"); --- 466,469 ---- Index: songfile.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/songfile.cpp,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** songfile.cpp 27 Oct 2005 17:27:18 -0000 1.59 --- songfile.cpp 29 Oct 2005 18:17:04 -0000 1.60 *************** *** 175,179 **** Part* part = 0; QString s = e.text(); ! int trackIdx, partIdx; sscanf(s.latin1(), "%d:%d", &trackIdx, &partIdx); TrackList* tl = song->tracks(); --- 175,180 ---- Part* part = 0; QString s = e.text(); ! unsigned trackIdx; ! int partIdx; sscanf(s.latin1(), "%d:%d", &trackIdx, &partIdx); TrackList* tl = song->tracks(); *************** *** 183,187 **** part = track->parts()->find(partIdx); } - printf("read part %p track %p\n", part, track); return part; } --- 184,187 ---- Index: song.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/song.cpp,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** song.cpp 29 Oct 2005 14:06:21 -0000 1.128 --- song.cpp 29 Oct 2005 18:17:04 -0000 1.129 *************** *** 1149,1153 **** eventFifoRindex = (eventFifoRindex + 1) % REC_EVENT_FIFO_SIZE; ! midiRCList.doAction(event); emit song->midiEvent(event); --eventFifoSize; --- 1149,1154 ---- eventFifoRindex = (eventFifoRindex + 1) % REC_EVENT_FIFO_SIZE; ! if (rcEnable) ! midiRCList.doAction(event); emit song->midiEvent(event); --eventFifoSize; Index: wave.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/wave.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** wave.cpp 27 Oct 2005 17:27:18 -0000 1.26 --- wave.cpp 29 Oct 2005 18:17:04 -0000 1.27 *************** *** 26,31 **** const int cacheMag = 128; - // ClipList* waveClips; - SndFileList SndFile::sndFiles; --- 26,29 ---- *************** *** 36,40 **** SndFile::SndFile(const QString& name) { ! finfo = new QFileInfo(name); sf = 0; csize = 0; --- 34,38 ---- SndFile::SndFile(const QString& name) { ! finfo.setFile(name); sf = 0; csize = 0; *************** *** 54,58 **** } } - delete finfo; if (cache) { for (unsigned i = 0; i < channels(); ++i) --- 52,55 ---- *************** *** 79,83 **** writeFlag = false; openFlag = true; ! QString cacheName = finfo->dirPath(true) + QString("/") + finfo->baseName() + QString(".wca"); readCache(cacheName, true); return false; --- 76,80 ---- writeFlag = false; openFlag = true; ! QString cacheName = finfo.dirPath(true) + QString("/") + finfo.baseName() + QString(".wca"); readCache(cacheName, true); return false; *************** *** 94,99 **** // force recreation of wca data ! QString cacheName = finfo->dirPath(true) + ! QString("/") + finfo->baseName() + QString(".wca"); ::remove(cacheName.latin1()); if (openRead()) { --- 91,96 ---- // force recreation of wca data ! QString cacheName = finfo.dirPath(true) + ! QString("/") + finfo.baseName() + QString(".wca"); ::remove(cacheName.latin1()); if (openRead()) { *************** *** 271,276 **** openFlag = true; writeFlag = true; ! QString cacheName = finfo->dirPath(true) + ! QString("/") + finfo->baseName() + QString(".wca"); readCache(cacheName, true); } --- 268,273 ---- openFlag = true; writeFlag = true; ! QString cacheName = finfo.dirPath(true) + ! QString("/") + finfo.baseName() + QString(".wca"); readCache(cacheName, true); } *************** *** 300,324 **** if (openFlag) close(); ! QFile::remove(finfo->filePath()); } ! QString SndFile::basename() const { ! return finfo->baseName(true); } ! QString SndFile::path() const { ! return finfo->filePath(); } ! QString SndFile::dirPath() const { ! return finfo->dirPath(true); } ! QString SndFile::name() const { ! return finfo->fileName(); } --- 297,321 ---- if (openFlag) close(); ! QFile::remove(finfo.filePath()); } ! QString SndFile::basename() { ! return finfo.baseName(true); } ! QString SndFile::path() { ! return finfo.filePath(); } ! QString SndFile::dirPath() { ! return finfo.dirPath(true); } ! QString SndFile::name() { ! return finfo.fileName(); } Index: globals.h =================================================================== RCS file: /cvsroot/lmuse/muse/muse/globals.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** globals.h 27 Oct 2005 17:27:18 -0000 1.25 --- globals.h 29 Oct 2005 18:17:04 -0000 1.26 *************** *** 106,114 **** extern bool rcEnable; - extern unsigned char rcStopNote; - extern unsigned char rcRecordNote; - extern unsigned char rcGotoLeftMarkNote; - extern unsigned char rcPlayNote; - #endif --- 106,109 ---- Index: app.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/app.cpp,v retrieving revision 1.188 retrieving revision 1.189 diff -C2 -d -r1.188 -r1.189 *** app.cpp 27 Oct 2005 21:14:54 -0000 1.188 --- app.cpp 29 Oct 2005 18:17:04 -0000 1.189 *************** *** 769,773 **** raster->setFixedHeight(24); aToolBar->addWidget(raster); ! for (int i = 0; i < sizeof(rasterTable)/sizeof(*rasterTable); i++) raster->addItem(rasterTable[i].label, i); raster->setCurrentItem(1); --- 769,773 ---- raster->setFixedHeight(24); aToolBar->addWidget(raster); ! for (unsigned i = 0; i < sizeof(rasterTable)/sizeof(*rasterTable); i++) raster->addItem(rasterTable[i].label, i); raster->setCurrentItem(1); |