void GlobStore::readData(QXmlStreamReader& xml) { int tmp; while (!xml.atEnd()) { xml.readNext(); if (xml.isEndElement()) break; if (xml.name() == "timeMode") { tmp =xml.readElementText().toInt(); timeModeBox->setCurrentIndex(tmp); updateTimeModeBox(tmp); } else if (xml.name() == "switchAtBeat") { tmp =xml.readElementText().toInt(); switchAtBeatBox->setCurrentIndex(tmp); updateSwitchAtBeat(tmp); } else if (xml.name() == "timeModule") { tmp =xml.readElementText().toInt(); if (tmp > -1) timeModuleBox->setCurrentIndex(tmp); updateTimeModule(tmp); } else if (xml.isStartElement() && (xml.name() == "midiControllers")) { midiControl->readData(xml); } else skipXmlElement(xml); } modified = false; }
void GlobStore::skipXmlElement(QXmlStreamReader& xml) { if (xml.isStartElement()) { qWarning("Unknown Element in XML File: %s",qPrintable(xml.name().toString())); while (!xml.atEnd()) { xml.readNext(); if (xml.isEndElement()) break; if (xml.isStartElement()) { skipXmlElement(xml); } } } }
void ParStore::readData(QXmlStreamReader& xml) { int ix = 0; int step = 0; int tmpjumpto = -2; int tmponlypattern = 0; while (!xml.atEnd()) { xml.readNext(); if (xml.isEndElement()) break; if (xml.isStartElement() && (xml.name() == "parStore")) { while (!xml.atEnd()) { xml.readNext(); if (xml.isEndElement()) break; if (xml.name() == "empty") temp.empty = xml.readElementText().toInt(); else if (xml.name() == "muteOut") temp.muteOut = xml.readElementText().toInt(); else if (xml.name() == "res") temp.res = xml.readElementText().toInt(); else if (xml.name() == "size") temp.size = xml.readElementText().toInt(); else if (xml.name() == "loopMode") temp.loopMode = xml.readElementText().toInt(); else if (xml.name() == "waveForm") temp.waveForm = xml.readElementText().toInt(); else if (xml.name() == "portOut") temp.portOut = xml.readElementText().toInt(); else if (xml.name() == "channelOut") temp.channelOut = xml.readElementText().toInt(); else if (xml.name() == "chIn") temp.chIn = xml.readElementText().toInt(); else if (xml.name() == "ccnumber") temp.ccnumber = xml.readElementText().toInt(); else if (xml.name() == "ccnumberIn") temp.ccnumberIn = xml.readElementText().toInt(); else if (xml.name() == "freq") temp.freq = xml.readElementText().toInt(); else if (xml.name() == "ampl") temp.ampl = xml.readElementText().toInt(); else if (xml.name() == "offs") temp.offs = xml.readElementText().toInt(); else if (xml.name() == "vel") temp.vel = xml.readElementText().toInt(); else if (xml.name() == "dispVertical") temp.dispVertical = xml.readElementText().toInt(); else if (xml.name() == "transp") temp.transp = xml.readElementText().toInt(); else if (xml.name() == "notelen") temp.notelen = xml.readElementText().toInt(); else if (xml.name() == "loopMarker") temp.loopMarker = xml.readElementText().toInt(); else if (xml.name() == "indexIn0") temp.indexIn0 = xml.readElementText().toInt(); else if (xml.name() == "indexIn1") temp.indexIn1 = xml.readElementText().toInt(); else if (xml.name() == "rangeIn0") temp.rangeIn0 = xml.readElementText().toInt(); else if (xml.name() == "rangeIn1") temp.rangeIn1 = xml.readElementText().toInt(); else if (xml.name() == "attack") temp.attack = xml.readElementText().toInt(); else if (xml.name() == "release") temp.release = xml.readElementText().toInt(); else if (xml.name() == "repeatMode") temp.repeatMode = xml.readElementText().toInt(); else if (xml.name() == "rndTick") temp.rndTick = xml.readElementText().toInt(); else if (xml.name() == "rndLen") temp.rndLen = xml.readElementText().toInt(); else if (xml.name() == "rndVel") temp.rndVel = xml.readElementText().toInt(); else if (xml.name() == "pattern") temp.pattern = xml.readElementText(); else if (xml.name() == "jumpTo") tmpjumpto = xml.readElementText().toInt(); else if (xml.name() == "onlyPattern") tmponlypattern = xml.readElementText().toInt(); else if (xml.isStartElement() && (xml.name() == "muteMask")) { while (!xml.atEnd()) { xml.readNext(); if (xml.isEndElement()) break; if (xml.isStartElement() && (xml.name() == "data")) { temp.muteMask.clear(); QByteArray tmpArray = QByteArray::fromHex(xml.readElementText().toLatin1()); for (int l1 = 0; l1 < tmpArray.count(); l1++) { temp.muteMask.append(tmpArray.at(l1)); } } else skipXmlElement(xml); } } else if (xml.isStartElement() && (xml.name() == "wave")) { while (!xml.atEnd()) { xml.readNext(); if (xml.isEndElement()) break; if (xml.isStartElement() && (xml.name() == "data")) { temp.wave.clear(); QByteArray tmpArray = QByteArray::fromHex(xml.readElementText().toLatin1()); if (temp.ccnumberIn >= 0) step = TPQN / lfoResValues[temp.res]; else step = TPQN / seqResValues[temp.res]; int lt = 0; Sample sample; for (int l1 = 0; l1 < tmpArray.count(); l1++) { sample.value = tmpArray.at(l1); sample.tick = lt; sample.muted = temp.muteMask.at(l1); temp.wave.append(sample); lt+=step; } } else skipXmlElement(xml); } } else skipXmlElement(xml); } tempToList(ix); updateRunOnce(ix, tmpjumpto); onlyPatternList.replace(ix, tmponlypattern); ix++; } } }