AnalogTapeModel

Physical modelling signal processing for analog tape recording
Log | Files | Refs | Submodules | README | LICENSE

commit 139ab8b5c2030d432ec258887f852a274582a862
parent 8030c6fb0d7413ea97dbc644d3b69a16843add68
Author: jatinchowdhury18 <jatinchowdhury18@gmail.com>
Date:   Tue, 29 Jun 2021 09:11:19 -0700

Make oversampling parameters preset agnostic (#205)

* Make oversampling parameters preset agnostic

* {Apply clang-format}

Co-authored-by: jatinchowdhury18 <jatinchowdhury18@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Diffstat:
MPlugin/Source/Presets/PresetConfigs/OldTape.chowpreset | 1+
MPlugin/Source/Presets/PresetManager.cpp | 15+++++++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/Plugin/Source/Presets/PresetConfigs/OldTape.chowpreset b/Plugin/Source/Presets/PresetConfigs/OldTape.chowpreset @@ -7,6 +7,7 @@ <PARAM id="chew_var" value="0.0"/> <PARAM id="deg_amt" value="0.1499999910593033"/> <PARAM id="deg_depth" value="0.199999988079071"/> + <PARAM id="deg_onoff" value="1.0"/> <PARAM id="deg_var" value="0.25"/> <PARAM id="depth" value="0.0"/> <PARAM id="drive" value="0.5"/> diff --git a/Plugin/Source/Presets/PresetManager.cpp b/Plugin/Source/Presets/PresetManager.cpp @@ -124,7 +124,22 @@ bool PresetManager::setPreset (AudioProcessorValueTreeState& vts, int idx) return false; } + StringArray presetAgnosticParams { "os", "os_mode", "os_render_factor", "os_render_mode", "os_render_like_realtime" }; + auto newState = presetMap[idx]->state.createCopy(); + + for (auto& param : presetAgnosticParams) + { + auto curParamTree = vts.state.getChildWithProperty ("id", param); + jassert (curParamTree.isValid()); + + auto presetParamTree = newState.getChildWithProperty ("id", param); + if (presetParamTree.isValid()) + presetParamTree.copyPropertiesFrom (curParamTree, nullptr); + else + newState.appendChild (curParamTree.createCopy(), nullptr); + } + vts.replaceState (newState); return true; }