Update CMT submodule / Upgrade code for CMT delays (#7206)

## Bump CMT to d8bf8084aa3
Bump the CMT submodule to commit d8bf8084aa3 which contains the underlying fixes for issue #5167.

The CMT delay uses `sprintf` calls to generate the technical names and display names of the delays. These calls are locale dependent. As a consequence for example the feedback delay might have been saved either as "fbdelay_0.1s" (point) or "fbdelay_0,1s" (comma) in a save file.

The CMT fix makes sure that all delays use points in their names and thus that they now always report the same name strings.

## Add upgrade routine for CMT delays
Add an upgrade routine for CMT delays which works in conjunction with the upgraded CMT submodule. Because the delays will now always report their name with points old save files which might contain versions with the comma must be upgraded to a name with a point.
This commit is contained in:
Michael Gregorius
2024-04-14 18:03:39 +02:00
committed by GitHub
parent d3ab31558c
commit d2c2a80506
3 changed files with 42 additions and 2 deletions

View File

@@ -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.
@@ -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
*