From 3f64bc6c6077a8d63be159b98746bf653d28f248 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 8 Nov 2021 14:52:26 -0500 Subject: [PATCH] Add backward compatibility with MODE param on Random. --- src/Random.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Random.cpp b/src/Random.cpp index 513ca47..cb3848a 100644 --- a/src/Random.cpp +++ b/src/Random.cpp @@ -6,7 +6,7 @@ struct Random : Module { RATE_PARAM, SHAPE_PARAM, OFFSET_PARAM, - MODE_PARAM, + MODE_PARAM, // removed in 2.0 // new in 2.0 PROB_PARAM, RAND_PARAM, @@ -233,7 +233,15 @@ struct Random : Module { params[SHAPE_CV_PARAM].setValue(1.f); params[PROB_CV_PARAM].setValue(1.f); params[RAND_CV_PARAM].setValue(1.f); + // In <2.0, mode=0 implied relative mode, corresponding to about 20% RND. + params[RAND_PARAM].setValue(0.2f); Module::paramsFromJson(rootJ); + + // In <2.0, mode was used for absolute/relative mode. RND is a generalization so set it if mode is enabled. + if (params[MODE_PARAM].getValue() > 0.f) { + params[MODE_PARAM].setValue(0.f); + params[RAND_PARAM].setValue(1.f); + } } };