]> git.sesse.net Git - kdenlive/commitdiff
Make sox effects work again, part of bug:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 28 Dec 2008 15:30:40 +0000 (15:30 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 28 Dec 2008 15:30:40 +0000 (15:30 +0000)
http://www.kdenlive.org:80/mantis/view.php?id=499

svn path=/branches/KDE4/; revision=2837

src/clipitem.cpp
src/clipitem.h
src/customtrackview.cpp
src/definitions.h
src/renderer.cpp
src/renderer.h
src/trackview.cpp

index 259f6cb581bd2198c62575410e626510aef8cae1..f78324034786bf6808584cde1af8768d268ec2d7 100644 (file)
@@ -139,6 +139,7 @@ void ClipItem::initEffect(QDomElement effect) {
     QDomNodeList params = effect.elementsByTagName("parameter");
     for (int i = 0; i < params.count(); i++) {
         QDomElement e = params.item(i).toElement();
+        kDebug() << "// inint eff: " << e.attribute("name");
         if (!e.isNull() && e.attribute("type") == "keyframe") {
             QString def = e.attribute("default");
             // Effect has a keyframe type parameter, we need to set the values
@@ -1114,38 +1115,46 @@ void ClipItem::setEffectAt(int ix, QDomElement effect) {
     }
 }
 
-QHash <QString, QString> ClipItem::addEffect(QDomElement effect, bool animate) {
-    QHash <QString, QString> effectParams;
+EffectsParameterList ClipItem::addEffect(QDomElement effect, bool animate) {
+
     bool needRepaint = false;
     /*QDomDocument doc;
     doc.appendChild(doc.importNode(effect, true));
     kDebug() << "///////  CLIP ADD EFFECT: " << doc.toString();*/
     m_effectList.append(effect);
-    effectParams["tag"] = effect.attribute("tag");
+
+    EffectsParameterList parameters;
+    parameters.addParam("tag", effect.attribute("tag"));
+    parameters.addParam("kdenlive_ix", effect.attribute("kdenlive_ix"));
+
+    QString state = effect.attribute("disabled");
+    if (!state.isEmpty()) {
+        parameters.addParam("disabled", state);
+    }
+
     QString effectId = effect.attribute("id");
     if (effectId.isEmpty()) effectId = effect.attribute("tag");
-    effectParams["id"] = effectId;
-    effectParams["kdenlive_ix"] = effect.attribute("kdenlive_ix");
-    QString state = effect.attribute("disabled");
-    if (!state.isEmpty()) effectParams["disabled"] = state;
+    parameters.addParam("id", effectId);
+
     QDomNodeList params = effect.elementsByTagName("parameter");
     int fade = 0;
     for (int i = 0; i < params.count(); i++) {
         QDomElement e = params.item(i).toElement();
         if (!e.isNull()) {
             if (e.attribute("type") == "keyframe") {
-                effectParams["keyframes"] = e.attribute("keyframes");
-                effectParams["min"] = e.attribute("min");
-                effectParams["max"] = e.attribute("max");
-                effectParams["factor"] = e.attribute("factor", "1");
-                effectParams["starttag"] = e.attribute("starttag", "start");
-                effectParams["endtag"] = e.attribute("endtag", "end");
+                parameters.addParam("keyframes", e.attribute("keyframes"));
+                parameters.addParam("max", e.attribute("max"));
+                parameters.addParam("min", e.attribute("min"));
+                parameters.addParam("factor", e.attribute("factor", "1"));
+                parameters.addParam("starttag", e.attribute("starttag", "start"));
+                parameters.addParam("endtag", e.attribute("endtag", "end"));
             }
 
             double f = e.attribute("factor", "1").toDouble();
 
             if (f == 1) {
-                effectParams[e.attribute("name")] = e.attribute("value");
+                parameters.addParam(e.attribute("name"), e.attribute("value"));
+
                 // check if it is a fade effect
                 if (effectId == "fadein") {
                     needRepaint = true;
@@ -1157,7 +1166,7 @@ QHash <QString, QString> ClipItem::addEffect(QDomElement effect, bool animate) {
                     else if (e.attribute("name") == "in") fade += e.attribute("value").toInt();
                 }
             } else {
-                effectParams[e.attribute("name")] =  QString::number(e.attribute("value").toDouble() / f);
+                parameters.addParam(e.attribute("name"), QString::number(e.attribute("value").toDouble() / f));
             }
         }
     }
@@ -1176,28 +1185,32 @@ QHash <QString, QString> ClipItem::addEffect(QDomElement effect, bool animate) {
         m_selectedEffect = 0;
         setSelectedEffect(m_selectedEffect);
     }
-    return effectParams;
+    return parameters;
 }
 
-QHash <QString, QString> ClipItem::getEffectArgs(QDomElement effect) {
-    QHash <QString, QString> effectParams;
-    effectParams["tag"] = effect.attribute("tag");
-    effectParams["kdenlive_ix"] = effect.attribute("kdenlive_ix");
-    effectParams["id"] = effect.attribute("id");
+EffectsParameterList ClipItem::getEffectArgs(QDomElement effect) {
+    EffectsParameterList parameters;
+    parameters.addParam("tag", effect.attribute("tag"));
+    parameters.addParam("kdenlive_ix", effect.attribute("kdenlive_ix"));
+    parameters.addParam("id", effect.attribute("id"));
+
     QString state = effect.attribute("disabled");
-    if (!state.isEmpty()) effectParams["disabled"] = state;
+    if (!state.isEmpty()) {
+        parameters.addParam("disabled", state);
+    }
+
     QDomNodeList params = effect.elementsByTagName("parameter");
     for (int i = 0; i < params.count(); i++) {
         QDomElement e = params.item(i).toElement();
         //kDebug() << "/ / / /SENDING EFFECT PARAM: " << e.attribute("type") << ", NAME_ " << e.attribute("tag");
         if (e.attribute("type") == "keyframe") {
             kDebug() << "/ / / /SENDING KEYFR EFFECT TYPE";
-            effectParams["keyframes"] = e.attribute("keyframes");
-            effectParams["max"] = e.attribute("max");
-            effectParams["min"] = e.attribute("min");
-            effectParams["factor"] = e.attribute("factor", "1");
-            effectParams["starttag"] = e.attribute("starttag", "start");
-            effectParams["endtag"] = e.attribute("endtag", "end");
+            parameters.addParam("keyframes", e.attribute("keyframes"));
+            parameters.addParam("max", e.attribute("max"));
+            parameters.addParam("min", e.attribute("min"));
+            parameters.addParam("factor", e.attribute("factor", "1"));
+            parameters.addParam("starttag", e.attribute("starttag", "start"));
+            parameters.addParam("endtag", e.attribute("endtag", "end"));
         } else if (e.attribute("namedesc").contains(";")) {
             QString format = e.attribute("format");
             QStringList separators = format.split("%d", QString::SkipEmptyParts);
@@ -1210,14 +1223,16 @@ QHash <QString, QString> ClipItem::getEffectArgs(QDomElement effect) {
                 txtNeu << separators[i];
                 txtNeu << (int)(values[i+1].toDouble());
             }
-            effectParams["start"] = neu;
+            parameters.addParam("start", neu);
         } else {
-            if (e.attribute("factor", "1") != "1")
-                effectParams[e.attribute("name")] =  QString::number(e.attribute("value").toDouble() / e.attribute("factor").toDouble());
-            else effectParams[e.attribute("name")] = e.attribute("value");
+            if (e.attribute("factor", "1") != "1") {
+                parameters.addParam(e.attribute("name"), QString::number(e.attribute("value").toDouble() / e.attribute("factor").toDouble()));
+            } else {
+                parameters.addParam(e.attribute("name"), e.attribute("value"));
+            }
         }
     }
-    return effectParams;
+    return parameters;
 }
 
 void ClipItem::deleteEffect(QString index) {
index 98bd1c010df6760dc38ccd132b0b686407d31098..580cf3469bd5a3fe30e6a7a031b4ff98c54145c1 100644 (file)
@@ -61,9 +61,9 @@ public:
     /** Give a string list of the clip's effect names */
     QStringList effectNames();
     /** Add an effect to the clip and return the parameters that will be passed to Mlt */
-    QHash <QString, QString> addEffect(QDomElement effect, bool animate = true);
+    EffectsParameterList addEffect(QDomElement effect, bool animate = true);
     /** Get the effect parameters that will be passed to Mlt */
-    QHash <QString, QString> getEffectArgs(QDomElement effect);
+    EffectsParameterList getEffectArgs(QDomElement effect);
     /** Delete effect with id index */
     void deleteEffect(QString index);
     /** return the number of effects in that clip */
index 85c646a28ef8c88cc779aab44fef0a853c4cf516..651dd3f73cf7bc177e335d699f2056a15a749865 100644 (file)
@@ -975,8 +975,7 @@ void CustomTrackView::slotRefreshEffects(ClipItem *clip) {
 void CustomTrackView::addEffect(int track, GenTime pos, QDomElement effect) {
     ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()) + 1, m_document->tracksCount() - track);
     if (clip) {
-        QHash <QString, QString> effectParams = clip->addEffect(effect);
-        if (!m_document->renderer()->mltAddEffect(track, pos, effectParams))
+        if (!m_document->renderer()->mltAddEffect(track, pos, clip->addEffect(effect)))
             emit displayMessage(i18n("Problem adding effect to clip"), ErrorMessage);
         emit clipItemSelected(clip);
     } else emit displayMessage(i18n("Cannot find clip to add effect"), ErrorMessage);
@@ -1024,15 +1023,15 @@ void CustomTrackView::slotDeleteEffect(ClipItem *clip, QDomElement effect) {
 void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement effect, int ix, bool triggeredByUser) {
     ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()) + 1, m_document->tracksCount() - track);
     if (clip) {
-        QHash <QString, QString> effectParams = clip->getEffectArgs(effect);
+        EffectsParameterList effectParams = clip->getEffectArgs(effect);
         // check if we are trying to reset a keyframe effect
-        if (effectParams.contains("keyframes") && effectParams.value("keyframes").isEmpty()) {
+        if (effectParams.hasParam("keyframes") && effectParams.paramValue("keyframes").isEmpty()) {
             clip->initEffect(effect);
             clip->setEffectAt(ix, effect);
             effectParams = clip->getEffectArgs(effect);
         }
-        if (effectParams.value("disabled") == "1") {
-            if (m_document->renderer()->mltRemoveEffect(track, pos, effectParams.value("kdenlive_ix"))) {
+        if (effectParams.paramValue("disabled") == "1") {
+            if (m_document->renderer()->mltRemoveEffect(track, pos, effectParams.paramValue("kdenlive_ix"))) {
                 kDebug() << "//////  DISABLING EFFECT: " << index << ", CURRENTLA: " << clip->selectedEffectIndex();
             } else emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
         } else if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - clip->track(), clip->startPos(), effectParams))
@@ -1046,11 +1045,11 @@ void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement effect, i
         if (effect.attribute("tag") == "volume") {
             // A fade effect was modified, update the clip
             if (effect.attribute("id") == "fadein") {
-                int pos = effectParams.value("out").toInt() - effectParams.value("in").toInt();
+                int pos = effectParams.paramValue("out").toInt() - effectParams.paramValue("in").toInt();
                 clip->setFadeIn(pos);
             }
             if (effect.attribute("id") == "fadeout") {
-                int pos = effectParams.value("out").toInt() - effectParams.value("in").toInt();
+                int pos = effectParams.paramValue("out").toInt() - effectParams.paramValue("in").toInt();
                 clip->setFadeOut(pos);
             }
 
@@ -2476,8 +2475,7 @@ void CustomTrackView::updateClipFade(ClipItem * item, bool updateFadeOut) {
             end += start;
             EffectsList::setParameter(oldeffect, "in", QString::number(start));
             EffectsList::setParameter(oldeffect, "out", QString::number(end));
-            QHash <QString, QString> effectParams = item->getEffectArgs(oldeffect);
-            if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - item->track(), item->startPos(), effectParams))
+            if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - item->track(), item->startPos(), item->getEffectArgs(oldeffect)))
                 emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
             // if fade effect is displayed, update the effect edit widget with new clip duration
             if (item->isSelected() && effectPos == item->selectedEffectIndex()) emit clipItemSelected(item, effectPos);
@@ -2498,8 +2496,7 @@ void CustomTrackView::updateClipFade(ClipItem * item, bool updateFadeOut) {
             start = end - start;
             EffectsList::setParameter(oldeffect, "in", QString::number(start));
             EffectsList::setParameter(oldeffect, "out", QString::number(end));
-            QHash <QString, QString> effectParams = item->getEffectArgs(oldeffect);
-            if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - item->track(), item->startPos(), effectParams))
+            if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - item->track(), item->startPos(), item->getEffectArgs(oldeffect)))
                 emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
             // if fade effect is displayed, update the effect edit widget with new clip duration
             if (item->isSelected() && effectPos == item->selectedEffectIndex()) emit clipItemSelected(item, effectPos);
index 56cfc369970ce38881574783127fe6ccd3f79dd5..69c3c70221886e4200d47e89d7d96438fe44841b 100644 (file)
@@ -79,6 +79,55 @@ struct MltVideoProfile {
     int display_aspect_den;
 };
 
+
+class EffectParameter {
+public:
+    EffectParameter(const QString name, const QString value): m_name(name), m_value(value) {}
+    QString name()   const          {
+        return m_name;
+    }
+    QString value() const          {
+        return m_value;
+    }
+    void setValue(const QString value) {
+        m_value = value;
+    }
+
+private:
+    QString m_name;
+    QString m_value;
+};
+
+/** Use our own list for effect parameters so that they are not sorted in any ways, because
+    some effects like sox need a precise order
+*/
+class EffectsParameterList: public QList < EffectParameter > {
+public:
+    EffectsParameterList(): QList < EffectParameter >() {}
+    bool hasParam(const QString name) const {
+        for (int i = 0; i < size(); i++)
+            if (at(i).name() == name) return true;
+        return false;
+    }
+    QString paramValue(const QString name, QString defaultValue = QString()) const {
+        for (int i = 0; i < size(); i++) {
+            if (at(i).name() == name) return at(i).value();
+        }
+        return defaultValue;
+    }
+    void addParam(const QString &name, const QString &value) {
+        if (name.isEmpty()) return;
+        append(EffectParameter(name, value));
+    }
+    void removeParam(const QString name) {
+        for (int i = 0; i < size(); i++)
+            if (at(i).name() == name) {
+                removeAt(i);
+                break;
+            }
+    }
+};
+
 class CommentedTime {
 public:
     CommentedTime(): t(GenTime(0)) {}
index 9cafacb9ed2e44b4e53d0b94b3ce3cf93a2e6c12..db3e7ac1e57fc0a3d35128b4d856821a2e08b76e 100644 (file)
@@ -1720,7 +1720,7 @@ bool Render::mltRemoveEffect(int track, GenTime position, QString index, bool do
 }
 
 
-bool Render::mltAddEffect(int track, GenTime position, QHash <QString, QString> args, bool doRefresh) {
+bool Render::mltAddEffect(int track, GenTime position, EffectsParameterList params, bool doRefresh) {
 
     Mlt::Service service(m_mltProducer->parent().get_service());
 
@@ -1737,7 +1737,7 @@ bool Render::mltAddEffect(int track, GenTime position, QHash <QString, QString>
 
     // temporarily remove all effects after insert point
     QList <Mlt::Filter *> filtersList;
-    const int filter_ix = QString(args.value("kdenlive_ix")).toInt();
+    const int filter_ix = params.paramValue("kdenlive_ix").toInt();
     int ct = 0;
     Mlt::Filter *filter = clipService.filter(ct);
     while (filter) {
@@ -1749,30 +1749,30 @@ bool Render::mltAddEffect(int track, GenTime position, QHash <QString, QString>
     }
 
     // create filter
-    QString tag = args.value("tag");
+    QString tag =  params.paramValue("tag");
     kDebug() << " / / INSERTING EFFECT: " << tag;
     if (tag.startsWith("ladspa")) tag = "ladspa";
     char *filterTag = decodedString(tag);
-    char *filterId = decodedString(args.value("id"));
+    char *filterId = decodedString(params.paramValue("id"));
     QHash<QString, QString>::Iterator it;
-    QString kfr = args.value("keyframes");
+    QString kfr = params.paramValue("keyframes");
 
     if (!kfr.isEmpty()) {
         QStringList keyFrames = kfr.split(";", QString::SkipEmptyParts);
-        kDebug() << "// ADDING KEYFRAME EFFECT: " << args.value("keyframes");
-        char *starttag = decodedString(args.value("starttag", "start"));
-        char *endtag = decodedString(args.value("endtag", "end"));
+        kDebug() << "// ADDING KEYFRAME EFFECT: " << params.paramValue("keyframes");
+        char *starttag = decodedString(params.paramValue("starttag", "start"));
+        char *endtag = decodedString(params.paramValue("endtag", "end"));
         kDebug() << "// ADDING KEYFRAME TAGS: " << starttag << ", " << endtag;
         int duration = clip->get_playtime();
-        double max = args.value("max").toDouble();
-        double min = args.value("min").toDouble();
-        double factor = args.value("factor", "1").toDouble();
-        args.remove("starttag");
-        args.remove("endtag");
-        args.remove("keyframes");
-        args.remove("min");
-        args.remove("max");
-        args.remove("factor");
+        double max = params.paramValue("max").toDouble();
+        double min = params.paramValue("min").toDouble();
+        double factor = params.paramValue("factor", "1").toDouble();
+        params.removeParam("starttag");
+        params.removeParam("endtag");
+        params.removeParam("keyframes");
+        params.removeParam("min");
+        params.removeParam("max");
+        params.removeParam("factor");
         int offset = 0;
         for (int i = 0; i < keyFrames.size() - 1; ++i) {
             Mlt::Filter *filter = new Mlt::Filter(*m_mltProfile, filterTag);
@@ -1783,9 +1783,10 @@ bool Render::mltAddEffect(int track, GenTime position, QHash <QString, QString>
                 int x2 = keyFrames.at(i + 1).section(":", 0, 0).toInt();
                 double y2 = keyFrames.at(i + 1).section(":", 1, 1).toDouble();
                 if (x2 == -1) x2 = duration;
-                for (it = args.begin(); it != args.end(); ++it) {
-                    char *name = decodedString(it.key());
-                    char *value = decodedString(it.value());
+
+                for (int j = 0; j < params.count(); j++) {
+                    char *name = decodedString(params.at(j).name());
+                    char *value = decodedString(params.at(j).value());
                     filter->set(name, value);
                     delete[] name;
                     delete[] value;
@@ -1812,13 +1813,34 @@ bool Render::mltAddEffect(int track, GenTime position, QHash <QString, QString>
             return false;
         }
 
-        for (it = args.begin(); it != args.end(); ++it) {
-            char *name = decodedString(it.key());
-            char *value = decodedString(it.value());
+        params.removeParam("kdenlive_id");
+
+        for (int j = 0; j < params.count(); j++) {
+            char *name = decodedString(params.at(j).name());
+            char *value = decodedString(params.at(j).value());
             filter->set(name, value);
             delete[] name;
             delete[] value;
         }
+
+        if (tag == "sox") {
+            QString effectArgs = params.paramValue("id").section('_', 1);
+
+            params.removeParam("id");
+            params.removeParam("kdenlive_ix");
+            params.removeParam("tag");
+            params.removeParam("disabled");
+
+            for (int j = 0; j < params.count(); j++) {
+                effectArgs.append(' ' + params.at(j).value());
+            }
+            kDebug() << "SOX EFFECTS: " << effectArgs.simplified();
+            char *value = decodedString(effectArgs.simplified());
+            filter->set("effect", value);
+            delete[] value;
+        }
+
+
         // attach filter to the clip
         clipService.attach(*filter);
     }
@@ -1835,14 +1857,14 @@ bool Render::mltAddEffect(int track, GenTime position, QHash <QString, QString>
     return true;
 }
 
-bool Render::mltEditEffect(int track, GenTime position, QHash <QString, QString> args) {
-    QString index = args.value("kdenlive_ix");
-    QString tag =  args.value("tag");
-    QHash<QString, QString>::Iterator it = args.begin();
-    if (!args.value("keyframes").isEmpty() || /*it.key().startsWith("#") || */tag.startsWith("ladspa") || tag == "sox" || tag == "autotrack_rectangle") {
+bool Render::mltEditEffect(int track, GenTime position, EffectsParameterList params) {
+    QString index = params.paramValue("kdenlive_ix");
+    QString tag =  params.paramValue("tag");
+
+    if (!params.paramValue("keyframes").isEmpty() || /*it.key().startsWith("#") || */tag.startsWith("ladspa") || tag == "sox" || tag == "autotrack_rectangle") {
         // This is a keyframe effect, to edit it, we remove it and re-add it.
         mltRemoveEffect(track, position, index);
-        bool success = mltAddEffect(track, position, args);
+        bool success = mltAddEffect(track, position, params);
         return success;
     }
 
@@ -1883,7 +1905,7 @@ bool Render::mltEditEffect(int track, GenTime position, QHash <QString, QString>
             } else ct++;
             filter = clipService.filter(ct);
         }
-        bool success = mltAddEffect(track, position, args);
+        bool success = mltAddEffect(track, position, params);
 
         for (int i = 0; i < filtersList.count(); i++) {
             clipService.attach(*(filtersList.at(i)));
@@ -1893,14 +1915,14 @@ bool Render::mltEditEffect(int track, GenTime position, QHash <QString, QString>
         return success;
     }
 
-    for (it = args.begin(); it != args.end(); ++it) {
-        kDebug() << " / / EDITING EFFECT ARGS: " << it.key() << ": " << it.value();
-        char *name = decodedString(it.key());
-        char *value = decodedString(it.value());
+    for (int j = 0; j < params.count(); j++) {
+        char *name = decodedString(params.at(j).name());
+        char *value = decodedString(params.at(j).value());
         filter->set(name, value);
         delete[] name;
         delete[] value;
     }
+
     m_isBlocked = false;
     refresh();
     return true;
index af212b73faec5a5460e4e36df57815ef876b907d..217eb79bda9e9bca7783ee72496022f48f1f27ba 100644 (file)
@@ -158,8 +158,8 @@ Q_OBJECT public:
     bool mltMoveClip(int startTrack, int endTrack, int pos, int moveStart, Mlt::Producer *prod);
     bool mltRemoveClip(int track, GenTime position);
     bool mltRemoveEffect(int track, GenTime position, QString index, bool doRefresh = true);
-    bool mltAddEffect(int track, GenTime position, QHash <QString, QString> args, bool doRefresh = true);
-    bool mltEditEffect(int track, GenTime position, QHash <QString, QString> args);
+    bool mltAddEffect(int track, GenTime position, EffectsParameterList params, bool doRefresh = true);
+    bool mltEditEffect(int track, GenTime position, EffectsParameterList params);
     void mltMoveEffect(int track, GenTime position, int oldPos, int newPos);
     void mltChangeTrackState(int track, bool mute, bool blind);
     void mltMoveTransition(QString type, int startTrack,  int newTrack, int newTransitionTrack, GenTime oldIn, GenTime oldOut, GenTime newIn, GenTime newOut);
index d87a0d7b7a7a9914420a46f1e1545689dbdf3def..e5e920d5880c4eaa5fc02dc2ea18854df41b6e2e 100644 (file)
@@ -513,12 +513,16 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml) {
                                 QString paramname = effectparam.attribute("name");
                                 QString paramvalue = effectparam.text();
 
+
                                 // try to find this parameter in the effect xml
                                 QDomElement e;
                                 for (int k = 0; k < clipeffectparams.count(); k++) {
                                     e = clipeffectparams.item(k).toElement();
                                     if (!e.isNull() && e.tagName() == "parameter" && e.attribute("name") == paramname) {
-                                        e.setAttribute("value", paramvalue);
+                                        double factor = e.attribute("factor", "1").toDouble();
+                                        if (factor != 1) {
+                                            e.setAttribute("value", paramvalue.toDouble() * factor);
+                                        } else e.setAttribute("value", paramvalue);
                                         break;
                                     }
                                 }