void WaveEventBase::write(int level, Xml& xml, const Pos& offset, bool forcePath) const { if (f.isNull()) return; xml.tag(level++, "event"); PosLen wpos(*this); wpos += offset; wpos.write(level, xml, "poslen"); xml.intTag(level, "frame", _spos); // offset in wave file xml.intTag(level, "leftclip", m_leftclip); xml.intTag(level, "rightclip", m_rightclip); // // waves in the project dirctory are stored // with relative path name, others with absolute path // QString path = f.dirPath(); //if (path.contains(losProject)) { if (!forcePath && path.contains(losProject)) { // extract losProject. QString newName = f.path().remove(losProject + "/"); xml.strTag(level, "file", newName); } else xml.strTag(level, "file", f.path()); xml.etag(--level, "event"); }
void SysEx::write(int level, Xml& xml) { xml.nput(level, "<SysEx name=\"%s\">\n", Xml::xmlString(name).toLatin1().constData()); level++; if(!comment.isEmpty()) xml.strTag(level, "comment", Xml::xmlString(comment).toLatin1().constData()); if(dataLen > 0 && data) xml.strTag(level, "data", sysex2string(dataLen, data)); xml.etag(level, "SysEx"); }
static void writeSeqConfiguration(int level, Xml& xml, bool writePortInfo)/*{{{*/ { xml.tag(level++, "sequencer"); if (writePortInfo) { // // write information about all midi ports, their assigned // instruments and all managed midi controllers // for (int i = 0; i < MIDI_PORTS; ++i) { bool used = false; MidiPort* mport = &midiPorts[i]; // Route check by Tim. Port can now be used for routing even if no device. // Also, check for other non-defaults and save port, to preserve settings even if no device. // Dont write the config for the global inputs list they will be auto created with each startup if (mport->defaultInChannels() || mport->defaultOutChannels() || (mport->instrument() && !mport->instrument()->iname().isEmpty() && mport->instrument()->iname() != "GM") /*|| !mport->syncInfo().isDefault()*/ ) { used = true; } else {//Put the ID of this track into a list MidiTrackList* tl = song->midis(); for (iMidiTrack it = tl->begin(); it != tl->end(); ++it) { MidiTrack* t = *it; if (t->outPort() == i) { used = true; break; } } } MidiDevice* dev = mport->device(); if (!used && !dev) continue; bool isGlobal = gInputListPorts.contains(mport->portno()); xml.tag(level++, "midiport portId=\"%lld\" isGlobalInput=\"%d\"", mport->id(), isGlobal); if (mport->defaultInChannels()) xml.intTag(level, "defaultInChans", mport->defaultInChannels()); if (mport->defaultOutChannels()) xml.intTag(level, "defaultOutChans", mport->defaultOutChannels()); if (mport->instrument() && !mport->instrument()->iname().isEmpty() && (mport->instrument()->iname() != "GM")) // FIXME: TODO: Make this user configurable. { xml.strTag(level, "instrument", mport->instrument()->iname()); } if (dev) { xml.strTag(level, "name", dev->name()); xml.intTag(level, "cacheNRPN", (int)dev->cacheNRPN()); if (dev->deviceType() != MidiDevice::ALSA_MIDI) xml.intTag(level, "type", dev->deviceType()); xml.intTag(level, "openFlags", dev->openFlags()); } // write out registered controller for all channels MidiCtrlValListList* vll = mport->controller(); for (int k = 0; k < MIDI_CHANNELS; ++k) { int min = k << 24; int max = min + 0x100000; xml.tag(level++, "channel idx=\"%d\"", k); iMidiCtrlValList s = vll->lower_bound(min); iMidiCtrlValList e = vll->lower_bound(max); if (s != e) { for (iMidiCtrlValList i = s; i != e; ++i) { if(i->second->num() != 262145) { xml.tag(level++, "controller id=\"%d\"", i->second->num()); if (i->second->hwVal() != CTRL_VAL_UNKNOWN) xml.intTag(level, "val", i->second->hwVal()); xml.etag(--level, "controller"); } } } xml.etag(--level, "channel"); } QList<PatchSequence*> *patchSequences = mport->patchSequences(); if (patchSequences && !patchSequences->isEmpty()) { for (int p = 0; p < patchSequences->size(); ++p) { PatchSequence* ps = patchSequences->at(p); QString pm = ps->name.replace('\n', " "); xml.put(level, "<patchSequence id=\"%d\" name=\"%s\" checked=\"%d\" />", ps->id, pm.toLatin1().constData(), ps->selected); } } if(!mport->presets()->isEmpty()) { QHashIterator<int, QString> iter(*mport->presets()); while(iter.hasNext()) { iter.next(); xml.put(level, "<midiPreset id=\"%d\" sysex=\"%s\"/>", iter.key(), iter.value().toLatin1().constData()); } } xml.etag(--level, "midiport"); } } xml.tag(--level, "/sequencer"); }/*}}}*/
void LOS::writeGlobalConfiguration(int level, Xml& xml) const { xml.tag(level++, "configuration"); xml.intTag(level, "division", config.division); xml.intTag(level, "rtcTicks", config.rtcTicks); xml.intTag(level, "minMeter", config.minMeter); xml.doubleTag(level, "minSlider", config.minSlider); xml.intTag(level, "freewheelMode", config.freewheelMode); xml.intTag(level, "denormalProtection", config.useDenormalBias); xml.intTag(level, "outputLimiter", config.useOutputLimiter); xml.intTag(level, "dummyAudioBufSize", config.dummyAudioBufSize); xml.intTag(level, "dummyAudioSampleRate", config.dummyAudioSampleRate); xml.intTag(level, "guiRefresh", config.guiRefresh); xml.strTag(level, "userInstrumentsDir", config.userInstrumentsDir); xml.intTag(level, "extendedMidi", config.extendedMidi); xml.intTag(level, "midiExportDivision", config.midiDivision); xml.intTag(level, "smfFormat", config.smfFormat); xml.intTag(level, "exp2ByteTimeSigs", config.exp2ByteTimeSigs); xml.intTag(level, "expOptimNoteOffs", config.expOptimNoteOffs); xml.intTag(level, "importMidiSplitParts", config.importMidiSplitParts); xml.intTag(level, "startMode", config.startMode); xml.strTag(level, "startSong", config.startSong); xml.strTag(level, "projectBaseFolder", config.projectBaseFolder); xml.intTag(level, "projectStoreInFolder", config.projectStoreInFolder); xml.intTag(level, "useProjectSaveDialog", config.useProjectSaveDialog); xml.intTag(level, "useAutoCrossFades", config.useAutoCrossFades); xml.intTag(level, "midiInputDevice", midiInputPorts); xml.intTag(level, "midiInputChannel", midiInputChannel); xml.intTag(level, "midiRecordType", midiRecordType); xml.intTag(level, "midiThruType", midiThruType); xml.intTag(level, "midiFilterCtrl1", midiFilterCtrl1); xml.intTag(level, "midiFilterCtrl2", midiFilterCtrl2); xml.intTag(level, "midiFilterCtrl3", midiFilterCtrl3); xml.intTag(level, "midiFilterCtrl4", midiFilterCtrl4); xml.strTag(level, "externalWavEditor", config.externalWavEditor); xml.intTag(level, "useOldStyleStopShortCut", config.useOldStyleStopShortCut); xml.intTag(level, "moveArmedCheckBox", config.moveArmedCheckBox); xml.intTag(level, "vuColorStrip", vuColorStrip); if(gInputList.size()) { const char* const tag = "globalInputList"; xml.put(level, "<%s count=\"%d\">", tag, gInputList.size()); level++; for(int i = 0; i < gInputList.size(); ++i) { QPair<int, QString> in = gInputList.at(i); xml.put(level, "<globalInput deviceType=\"%d\" deviceName=\"%s\" />", in.first, in.second.toUtf8().constData()); } level--; xml.put(level--, "</%s>", tag); level++; } writeSeqConfiguration(level, xml, false); writeShortCuts(level, xml); xml.etag(--level, "configuration"); writeInstrumentTemplates(level, xml); }