zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit d6bf6a4135b36f2d0ac86b3ee3d005015d0f19f1
parent db1cec9e88db1c808fa8eaa7a53e9dfaa0b23068
Author: Hans Petter Selasky <[email protected]>
Date:   Mon,  4 May 2020 02:49:30 +0200

Implement workaround for old presets.

All effect parameters have a default value.
Default values are skipped when storing parameters,
and must appear as the default value when loading.

Up until recently it was assumed that the default
value of all parameters is zero. This is no longer
true, but when loading old presets we need to
preserve this behaviour! Else sounds may change.

Add exception for the recently added DC offset parameter.

Bump the ZynAddSubFX version.

Signed-off-by: Hans Petter Selasky <[email protected]>

Diffstat:
MCMakeLists.txt | 2+-
Msrc/Effects/EffectMgr.cpp | 20+++++++++++++++++++-
2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -3,7 +3,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") project(zynaddsubfx) set(VERSION_MAJOR "3") set(VERSION_MINOR "0") -set(VERSION_REVISION "5") +set(VERSION_REVISION "6") #Set data directory, if any if(DEFINED ZYN_DATADIR) diff --git a/src/Effects/EffectMgr.cpp b/src/Effects/EffectMgr.cpp @@ -502,7 +502,25 @@ void EffectMgr::getfromXML(XMLwrapper& xml) if(xml.enterbranch("EFFECT_PARAMETERS")) { for(int n = 0; n != 128; n++) { if(xml.enterbranch("par_no", n) == 0) { - settings[n] = -1; /* use default */ + /* + * XXX workaround for old presets: + * + * All effect parameters have a default value. + * Default values are skipped when storing parameters, + * and must appear as the default value when loading. + * + * Up until recently it was assumed that the default + * value of all parameters is zero. This is no longer + * true, but when loading old presets we need to + * preserve this behaviour! Else sounds may change. + */ + if (xml.fileversion() < version_type(3,0,6) && + /* XXX old presets don't have DC offset */ + (geteffect() != 6 || n < 11)) { + settings[n] = 0; + } else { + settings[n] = -1; /* use parameter default */ + } } else { settings[n] = xml.getpar127("par", 0); xml.exitbranch();