Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add upgrade for CMT delays #7206

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/DataFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<UpgradeMethod> UPGRADE_METHODS;
Expand Down
2 changes: 1 addition & 1 deletion plugins/LadspaEffect/cmt/cmt
Submodule cmt updated 2 files
+4 −1 src/cmt.h
+13 −4 src/delay.cpp
41 changes: 40 additions & 1 deletion src/core/DataFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ const std::vector<DataFile::UpgradeMethod> 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.
Expand Down Expand Up @@ -1684,6 +1685,44 @@ void DataFile::upgrade_noteTypes()
}
}

void DataFile::upgrade_fixCMTDelays()
{
static const QMap<QString, QString> 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
*
Expand Down
Loading