diff --git a/include/DataFile.h b/include/DataFile.h index ce5d4edf4c2..452481a7f00 100644 --- a/include/DataFile.h +++ b/include/DataFile.h @@ -129,6 +129,7 @@ class LMMS_EXPORT DataFile : public QDomDocument void upgrade_midiCCIndexing(); void upgrade_loopsRename(); void upgrade_noteTypes(); + void upgrade_fixCMTDelays(); // List of all upgrade methods static const std::vector UPGRADE_METHODS; diff --git a/plugins/LadspaEffect/cmt/cmt b/plugins/LadspaEffect/cmt/cmt index 6e6e291fbad..d8bf8084aa3 160000 --- a/plugins/LadspaEffect/cmt/cmt +++ b/plugins/LadspaEffect/cmt/cmt @@ -1 +1 @@ -Subproject commit 6e6e291fbad1138c808860ba3f140a963b52fa58 +Subproject commit d8bf8084aa3a47497092f5ab99c843a55090d151 diff --git a/src/core/DataFile.cpp b/src/core/DataFile.cpp index eedb7f01d8a..00c6845f34e 100644 --- a/src/core/DataFile.cpp +++ b/src/core/DataFile.cpp @@ -83,7 +83,8 @@ const std::vector DataFile::UPGRADE_METHODS = { &DataFile::upgrade_defaultTripleOscillatorHQ, &DataFile::upgrade_mixerRename , &DataFile::upgrade_bbTcoRename, &DataFile::upgrade_sampleAndHold , &DataFile::upgrade_midiCCIndexing, - &DataFile::upgrade_loopsRename , &DataFile::upgrade_noteTypes + &DataFile::upgrade_loopsRename , &DataFile::upgrade_noteTypes, + &DataFile::upgrade_fixCMTDelays }; // Vector of all versions that have upgrade routines. @@ -1684,6 +1685,44 @@ void DataFile::upgrade_noteTypes() } } +void DataFile::upgrade_fixCMTDelays() +{ + static const QMap nameMap { + { "delay_0,01s", "delay_0.01s" }, + { "delay_0,1s", "delay_0.1s" }, + { "fbdelay_0,01s", "fbdelay_0.01s" }, + { "fbdelay_0,1s", "fbdelay_0.1s" } + }; + + const auto effects = elementsByTagName("effect"); + + for (int i = 0; i < effects.size(); ++i) + { + auto effect = effects.item(i).toElement(); + + // We are only interested in LADSPA plugins + if (effect.attribute("name") != "ladspaeffect") { continue; } + + // Fetch all attributes (LMMS) beneath the LADSPA effect so that we can check the value of the plugin attribute (XML) + auto attributes = effect.elementsByTagName("attribute"); + for (int j = 0; j < attributes.size(); ++j) + { + auto attribute = attributes.item(j).toElement(); + + if (attribute.attribute("name") == "plugin") + { + const auto attributeValue = attribute.attribute("value"); + + const auto it = nameMap.constFind(attributeValue); + if (it != nameMap.constEnd()) + { + attribute.setAttribute("value", *it); + } + } + } + } +} + /** \brief Note range has been extended to match MIDI specification *