mirror of
https://github.com/LMMS/lmms.git
synced 2026-05-17 11:18:30 -04:00
Alias-free oscillators (#5826)
Add a band-limited, alias-free wavetable oscillator option to the `Oscillator` class. Use it by default for Triple Oscillator. Savefiles which do not have this feature enabled (e.g. old savefiles) will be loaded without this feature to keep the sound consistent. Original author: @curlymorphic. Fixed: @he29-net.
This commit is contained in:
@@ -69,7 +69,8 @@ const std::vector<DataFile::UpgradeMethod> DataFile::UPGRADE_METHODS = {
|
||||
&DataFile::upgrade_1_0_99 , &DataFile::upgrade_1_1_0,
|
||||
&DataFile::upgrade_1_1_91 , &DataFile::upgrade_1_2_0_rc3,
|
||||
&DataFile::upgrade_1_3_0 , &DataFile::upgrade_noHiddenClipNames,
|
||||
&DataFile::upgrade_automationNodes , &DataFile::upgrade_extendedNoteRange
|
||||
&DataFile::upgrade_automationNodes , &DataFile::upgrade_extendedNoteRange,
|
||||
&DataFile::upgrade_defaultTripleOscillatorHQ
|
||||
};
|
||||
|
||||
// Vector of all versions that have upgrade routines.
|
||||
@@ -1736,6 +1737,28 @@ void DataFile::upgrade_extendedNoteRange()
|
||||
}
|
||||
|
||||
|
||||
/** \brief TripleOscillator switched to using high-quality, alias-free oscillators by default
|
||||
*
|
||||
* Older projects were made without this feature and would sound differently if loaded
|
||||
* with the new default setting. This upgrade routine preserves their old behavior.
|
||||
*/
|
||||
void DataFile::upgrade_defaultTripleOscillatorHQ()
|
||||
{
|
||||
QDomNodeList tripleoscillators = elementsByTagName("tripleoscillator");
|
||||
for (int i = 0; !tripleoscillators.item(i).isNull(); i++)
|
||||
{
|
||||
for (int j = 1; j <= 3; j++)
|
||||
{
|
||||
// Only set the attribute if it does not exist (default template has it but reports as 1.2.0)
|
||||
if (tripleoscillators.item(i).toElement().attribute("useWaveTable" + QString::number(j)) == "")
|
||||
{
|
||||
tripleoscillators.item(i).toElement().setAttribute("useWaveTable" + QString::number(j), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DataFile::upgrade()
|
||||
{
|
||||
// Runs all necessary upgrade methods
|
||||
|
||||
Reference in New Issue
Block a user