Skip to content

Commit

Permalink
Warn about LADSPA problems
Browse files Browse the repository at this point in the history
Introduce a method which checks if a file that's loaded has the LADSPA
controls saved in an old format that was written with a version before
commit e99efd5.

The method is run at the end so that problems in all file versions are
detected. If a real upgrade was to be implemented it would have to run
between `DataFile::upgrade_0_4_0_rc2` and `DataFile::upgrade_1_0_99`.

See LMMS#5738 for more details.
  • Loading branch information
michaelgregorius committed May 18, 2024
1 parent f891bb3 commit 8710293
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/DataFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class LMMS_EXPORT DataFile : public QDomDocument
void upgrade_loopsRename();
void upgrade_noteTypes();
void upgrade_fixCMTDelays();
void findProblematicLadspaPlugins();

// List of all upgrade methods
static const std::vector<UpgradeMethod> UPGRADE_METHODS;
Expand Down
36 changes: 34 additions & 2 deletions src/core/DataFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const std::vector<DataFile::UpgradeMethod> DataFile::UPGRADE_METHODS = {
&DataFile::upgrade_mixerRename , &DataFile::upgrade_bbTcoRename,
&DataFile::upgrade_sampleAndHold , &DataFile::upgrade_midiCCIndexing,
&DataFile::upgrade_loopsRename , &DataFile::upgrade_noteTypes,
&DataFile::upgrade_fixCMTDelays
&DataFile::upgrade_fixCMTDelays , &DataFile::findProblematicLadspaPlugins
};

// Vector of all versions that have upgrade routines.
Expand Down Expand Up @@ -1046,7 +1046,6 @@ void DataFile::upgrade_0_4_0_rc2()
}
}


void DataFile::upgrade_1_0_99()
{
jo_id_t last_assigned_id = 0;
Expand Down Expand Up @@ -1957,6 +1956,39 @@ void DataFile::upgrade_midiCCIndexing()
}
}

void DataFile::findProblematicLadspaPlugins()
{
// This is not an upgrade but a check for potentially problematic LADSPA
// controls. See #5738 for more details.

const QDomNodeList ladspacontrols = elementsByTagName("ladspacontrols");

auto problematicLadspaControlFound = false;

for (int i = 0; i < ladspacontrols.size(); ++i)
{
const QDomElement ladspacontrol = ladspacontrols.item(i).toElement();

const auto attributes = ladspacontrol.attributes();
for (int j = 0; j < attributes.length(); ++j)
{
const auto attribute = attributes.item(j);
const auto name = attribute.nodeName();
if (name != "ports" && name.startsWith("port"))
{
problematicLadspaControlFound = true;
break;
}
}
}

if (problematicLadspaControlFound)
{
QMessageBox::warning(nullptr, QObject::tr("LADSPA plugins"),
QObject::tr("The project contains LADSPA plugins which might have not been restored correctly! Please check the project."));
}
}

void DataFile::upgrade()
{
// Runs all necessary upgrade methods
Expand Down

0 comments on commit 8710293

Please sign in to comment.