Skip to content

Commit

Permalink
fixes LMMS#6354: Sample-and-Hold for LFO Controller
Browse files Browse the repository at this point in the history
Added upgrade routine for old projects using the
white noise on LFO controllers
  • Loading branch information
consolegrl committed Sep 7, 2023
1 parent 931d962 commit e76cfe0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/DataFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class LMMS_EXPORT DataFile : public QDomDocument
void upgrade_defaultTripleOscillatorHQ();
void upgrade_mixerRename();
void upgrade_bbTcoRename();
void upgrade_sampleAndHold();

// List of all upgrade methods
static const std::vector<UpgradeMethod> UPGRADE_METHODS;
Expand Down
17 changes: 17 additions & 0 deletions src/core/DataFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const std::vector<DataFile::UpgradeMethod> DataFile::UPGRADE_METHODS = {
&DataFile::upgrade_automationNodes , &DataFile::upgrade_extendedNoteRange,
&DataFile::upgrade_defaultTripleOscillatorHQ,
&DataFile::upgrade_mixerRename , &DataFile::upgrade_bbTcoRename,
&DataFile::upgrade_sampleAndHold ,
};

// Vector of all versions that have upgrade routines.
Expand Down Expand Up @@ -1762,6 +1763,22 @@ void DataFile::upgrade_bbTcoRename()
}


// Set LFO speed to 0.01 on projects made before sample-and-hold PR
void DataFile::upgrade_sampleAndHold()
{
QDomNodeList elements = elementsByTagName("lfocontroller");
for (int i = 0; !elements.item(i).isNull(); ++i)
{
auto e = elements.item(i).toElement();
// Correct old random wave LFO speeds
if (e.attribute("wave").toInt() == 6)
{
e.setAttribute("speed",0.01f);
}
}
}


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

0 comments on commit e76cfe0

Please sign in to comment.