EffectsParameterList parameters;
parameters.addParam("tag", effect.attribute("tag"));
parameters.addParam("kdenlive_ix", effect.attribute("kdenlive_ix"));
+ if (effect.hasAttribute("src")) parameters.addParam("src", effect.attribute("src"));
QString state = effect.attribute("disabled");
if (!state.isEmpty()) {
parameters.addParam("tag", effect.attribute("tag"));
parameters.addParam("kdenlive_ix", effect.attribute("kdenlive_ix"));
parameters.addParam("id", effect.attribute("id"));
-
+ if (effect.hasAttribute("src")) parameters.addParam("src", effect.attribute("src"));
QString state = effect.attribute("disabled");
if (!state.isEmpty()) {
parameters.addParam("disabled", state);
#include "changetrackcommand.h"
#include "movegroupcommand.h"
#include "ui_addtrack_ui.h"
+#include "initeffects.h"
//TODO:
// disable animation if user asked it in KDE's global settings
if (itemList.at(i)->type() == AVWIDGET) {
ClipItem *item = (ClipItem *)itemList.at(i);
item->initEffect(effect);
+ if (effect.attribute("tag") == "ladspa") {
+ QString ladpsaFile = m_document->getLadspaFile();
+ initEffects::ladspaEffectFile(ladpsaFile, effect.attribute("ladspaid").toInt(), getLadspaParams(effect));
+ effect.setAttribute("src", ladpsaFile);
+ }
AddEffectCommand *command = new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), effect, true);
m_commandStack->push(command);
}
ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()) + 1, m_document->tracksCount() - track);
if (clip) {
EffectsParameterList effectParams = clip->getEffectArgs(effect);
+ if (effect.attribute("tag") == "ladspa") {
+ // Update the ladspa affect file
+ initEffects::ladspaEffectFile(effect.attribute("src"), effect.attribute("ladspaid").toInt(), getLadspaParams(effect));
+ }
// check if we are trying to reset a keyframe effect
if (effectParams.hasParam("keyframes") && effectParams.paramValue("keyframes").isEmpty()) {
clip->initEffect(effect);
m_document->renderer()->mltUpdateTransition(transition.attribute("tag"), transition.attribute("tag"), transition.attribute("transition_btrack").toInt(), m_document->tracksCount() - transition.attribute("transition_atrack").toInt(), tr->startPos(), tr->endPos(), transition);
}
+
+QStringList CustomTrackView::getLadspaParams(QDomElement effect) const {
+ QStringList result;
+ QDomNodeList params = effect.elementsByTagName("parameter");
+ for (int i = 0; i < params.count(); i++) {
+ QDomElement e = params.item(i).toElement();
+ if (!e.isNull() && e.attribute("type") == "constant") {
+ if (e.hasAttribute("factor")) {
+ double factor = e.attribute("factor").toDouble();
+ double value = e.attribute("value").toDouble();
+ value = value / factor;
+ result.append(QString::number(value));
+ } else result.append(e.attribute("value"));
+ }
+ }
+ return result;
+}
+
#include "customtrackview.moc"
void changeTimelineTrack(int ix, TrackInfo trackinfo);
void saveThumbnails();
void autoTransition();
+ QStringList getLadspaParams(QDomElement effect) const;
public slots:
void setCursorPos(int pos, bool seek = true);
delete filterString;
}
-QString jackString = "<?xml version=\"1.0\"?><!DOCTYPE jackrack SYSTEM \"http://purge.bash.sh/~rah/jack_rack_1.2.dtd\"><jackrack><channels>2</channels><samplerate>48000</samplerate><plugin><id>";
+const QString jackString = "<?xml version=\"1.0\"?><!DOCTYPE jackrack SYSTEM \"http://purge.bash.sh/~rah/jack_rack_1.2.dtd\"><jackrack><channels>2</channels><samplerate>48000</samplerate><plugin><id>";
char* initEffects::ladspaDeclipEffectString(QStringList) {
// make sure that the necessary folders exist
KStandardDirs::makeDir(m_projectFolder.path() + "/titles/");
KStandardDirs::makeDir(m_projectFolder.path() + "/thumbs/");
+ KStandardDirs::makeDir(m_projectFolder.path() + "/ladspa/");
m_scenelist = m_document.toString();
kDebug() << "KDEnnlive document, init timecode: " << m_fps;
bool KdenliveDoc::convertDocument(double version) {
kDebug() << "Opening a document with version " << version;
+ if (version == 0.81) return true;
+
// Opening a old Kdenlive document
- if (version == 0.5 || version == 0.7) {
+ if (version == 0.5 || version == 0.7 || version > 0.81) {
kDebug() << "Unable to open document with version " << version;
// TODO: convert 0.7 (0.5?) files to the new document format.
return FALSE;
void KdenliveDoc::moveProjectData(KUrl url) {
QList <DocClipBase*> list = m_clipManager->documentClipList();
+ //TODO: Also move ladspa effects files
for (int i = 0; i < list.count(); i++) {
DocClipBase *clip = list.at(i);
if (clip->clipType() == TEXT) {
QDomElement prod = doc.createElement("producer");
}
-QDomDocument KdenliveDoc::toXml() const {
+QDomDocument KdenliveDoc::toXml() {
return m_document;
}
pix.save(m_projectFolder.path() + "/thumbs/" + fileId + ".png");
}
+QString KdenliveDoc::getLadspaFile() const {
+ int ct = 0;
+ QString counter = QString::number(ct).rightJustified(5, '0', false);
+ while (QFile::exists(m_projectFolder.path() + "/ladspa/" + counter + ".ladspa")) {
+ ct++;
+ counter = QString::number(ct).rightJustified(5, '0', false);
+ }
+ return m_projectFolder.path() + "/ladspa/" + counter + ".ladspa";
+}
+
#include "kdenlivedoc.moc"
KAutoSaveFile *m_autosave;
void backupMltPlaylist();
Timecode timecode() const;
- QDomDocument toXml() const;
+ QDomDocument toXml();
void setRenderer(Render *render);
QUndoStack *commandStack();
QString producerName(const QString &id);
void switchTrackAudio(int ix, bool hide);
void cachePixmap(const QString &fileId, const QPixmap &pix) const;
void setProjectFolder(KUrl url);
+ QString getLadspaFile() const;
private:
KUrl m_url;
if ((index == "-1" && filter->get("kdenlive_id") != "") || filter->get("kdenlive_ix") == index) {// && filter->get("kdenlive_id") == id) {
if (clipService.detach(*filter) == 0) success = true;
kDebug() << " / / / DLEETED EFFECT: " << ct;
- } else ct++;
+ } else {
+ if (QString(filter->get("kdenlive_ix")).toInt() > index.toInt()) filter->set("kdenlive_ix", QString(filter->get("kdenlive_ix")).toInt() - 1);
+ ct++;
+ }
filter = clipService.filter(ct);
}
m_isBlocked = false;
for (int j = 0; j < params.count(); j++) {
effectArgs.append(' ' + params.at(j).value());
}
- kDebug() << "SOX EFFECTS: " << effectArgs.simplified();
+ //kDebug() << "SOX EFFECTS: " << effectArgs.simplified();
char *value = decodedString(effectArgs.simplified());
filter->set("effect", value);
delete[] value;
#include "kdenlivedoc.h"
#include "mainwindow.h"
#include "customtrackview.h"
-
+#include "initeffects.h"
TrackView::TrackView(KdenliveDoc *doc, QWidget *parent)
: QWidget(parent), m_doc(doc), m_scale(1.0), m_projectTracks(0) {
QString effecttag;
QString effectid;
QString effectindex;
+ QString ladspaEffectFile;
// Get effect tag & index
for (QDomNode n3 = effect.firstChild(); !n3.isNull(); n3 = n3.nextSibling()) {
// parse effect parameters
effectid = effectparam.text();
} else if (effectparam.attribute("name") == "kdenlive_ix") {
effectindex = effectparam.text();
+ } else if (effectparam.attribute("name") == "src") {
+ ladspaEffectFile = effectparam.text();
+ if (!QFile::exists(ladspaEffectFile)) {
+ // If the ladspa effect file is missing, recreate it
+ kDebug() << "// MISSING LADSPA FILE: " << ladspaEffectFile;
+ ladspaEffectFile = m_doc->getLadspaFile();
+ effectparam.firstChild().setNodeValue(ladspaEffectFile);
+ kDebug() << "// ... REPLACED WITH: " << ladspaEffectFile;
+ }
}
}
//kDebug() << "+ + CLIP EFF FND: " << effecttag << ", " << effectid << ", " << effectindex;
}
}
}
+ if (effecttag == "ladspa") {
+ //QString ladspaEffectFile = EffectsList::parameter(effect, "src", "property");
+
+ if (!QFile::exists(ladspaEffectFile)) {
+ // If the ladspa effect file is missing, recreate it
+ initEffects::ladspaEffectFile(ladspaEffectFile, currenteffect.attribute("ladspaid").toInt(), m_trackview->getLadspaParams(currenteffect));
+ }
+ currenteffect.setAttribute("src", ladspaEffectFile);
+ }
item->addEffect(currenteffect, false);
item->effectsCounter();
}