Ejemplo n.º 1
0
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");
}
Ejemplo n.º 2
0
Archivo: sig.cpp Proyecto: faesong/oom
void SigEvent::write(int level, Xml& xml, int at) const
{
	xml.tag(level++, "sig at=\"%d\"", at);
	xml.intTag(level, "tick", tick);
	xml.intTag(level, "nom", z);
	xml.intTag(level, "denom", n);
	xml.tag(level, "/sig");
}
Ejemplo n.º 3
0
void AbstractMidiEditor::writeStatus(int level, Xml& xml) const/*{{{*/
{
    xml.tag(level++, "midieditor");
    TopWin::writeStatus(level, xml);
    xml.intTag(level, "quant", _quant);
    xml.intTag(level, "raster", _raster);
    xml.tag(level, "/midieditor");
}/*}}}*/
Ejemplo n.º 4
0
void AudioTrack::writeProperties(int level, Xml& xml) const
{
	Track::writeProperties(level, xml);
	xml.intTag(level, "prefader", prefader());
	xml.intTag(level, "sendMetronome", sendMetronome());
	xml.intTag(level, "automation", int(automationType()));
	if (hasAuxSend())
	{
		QHashIterator<qint64, AuxInfo> iter(_auxSend);
		while (iter.hasNext())
		{
			iter.next();
			Track* t = song->findTrackByIdAndType(iter.key(), Track::AUDIO_AUX);
			//Write it out only if the AUX track still exists
			if(t)
			{
				bool pre = iter.value().first;
				double val = iter.value().second;
				QString s("<auxSend trackId=\"%1\" pre=\"%2\">%3</auxSend>\n");
				xml.nput(level, s.arg(iter.key()).arg(pre).arg(val).toAscii().constData());
			}
		}
	}
    if (_wantsAutomation == false)
    {
        // _wantsAutomation is only set on fake midi automation tracks. on those, we don't need to save the plugins (synth) config
        for (ciPluginI ip = _efxPipe->begin(); ip != _efxPipe->end(); ++ip)
        {
            if (*ip)
                (*ip)->writeConfiguration(level, xml);
        }
    }
	for (ciCtrlList icl = _controller.begin(); icl != _controller.end(); ++icl)
	{
		const CtrlList* cl = icl->second;

		QString s= QString("controller id=\"%1\" cur=\"%2\"").arg(cl->id()).arg(cl->curVal()).toAscii().constData();
		s += QString(" color=\"%1\" visible=\"%2\"").arg(cl->color().name()).arg(cl->isVisible());
		xml.tag(level++, s.toAscii().constData());
		int i = 0;
		for (ciCtrl ic = cl->begin(); ic != cl->end(); ++ic)
		{
			QString s("%1 %2, ");
			xml.nput(level, s.arg(ic->second.getFrame()).arg(ic->second.val).toAscii().constData());
			++i;
			if (i >= 4)
			{
				xml.put(level, "");
				i = 0;
			}
		}
		if (i)
			xml.put(level, "");
        xml.etag(--level, "controller");
	}
}
Ejemplo n.º 5
0
void TEvent::write(int level, Xml& xml, int at) const
{
	xml.tag(level++, "tempo at=\"%d\"", at);
	xml.intTag(level, "tick", tick);
	xml.intTag(level, "val", tempo);
    xml.tag(--level, "/tempo");
}
Ejemplo n.º 6
0
void MasterEdit::writeStatus(int level, Xml& xml) const
{
    xml.tag(level++, "master");
    xml.intTag(level, "ypos", vscroll->pos());
    xml.intTag(level, "ymag", vscroll->mag());
    AbstractMidiEditor::writeStatus(level, xml);
    xml.tag(level, "/master");
}
Ejemplo n.º 7
0
void TempoList::write(int level, Xml& xml) const
{
	xml.put(level++, "<tempolist fix=\"%d\">", _tempo);
	if (_globalTempo != 100)
		xml.intTag(level, "globalTempo", _globalTempo);
	for (ciTEvent i = begin(); i != end(); ++i)
		i->second->write(level, xml, i->first);
    xml.tag(--level, "/tempolist");
}
Ejemplo n.º 8
0
void writeShortCuts(int level, Xml& xml)
{
	xml.tag(level++, "shortcuts");
	for (int i = 0; i < SHRT_NUM_OF_ELEMENTS; i++)
	{
		if (shortcuts[i].xml != NULL && shortcuts[i].type != INVIS_SHRT) //Avoid nullptr & hardcoded shortcuts
			xml.intTag(level, shortcuts[i].xml, shortcuts[i].key);
	}
	xml.etag(level, "shortcuts");
}
Ejemplo n.º 9
0
Archivo: conf.cpp Proyecto: Adamiko/los
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");
}/*}}}*/
Ejemplo n.º 10
0
Archivo: conf.cpp Proyecto: Adamiko/los
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);
}
Ejemplo n.º 11
0
void MasterEdit::writeConfiguration(int level, Xml& xml)
{
    xml.tag(level++, "masteredit");
    xml.intTag(level, "raster", _rasterInit);
    xml.tag(--level, "/masteredit");
}