DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit 5835cd7918ea65fe030e881b4836ab8e0545a357
parent 2342feadc0d3e13e8aecd749f142e75709555c48
Author: falkTX <falktx@falktx.com>
Date:   Wed, 29 Dec 2021 14:15:15 +0000

Save vst3 parameters as integers as needed

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Mdistrho/src/DistrhoPluginVST3.cpp | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/distrho/src/DistrhoPluginVST3.cpp b/distrho/src/DistrhoPluginVST3.cpp @@ -845,7 +845,6 @@ public: else fvalue = std::atof(value.buffer()); - // TODO atoi if integer fCachedParameterValues[kVst3InternalParameterBaseCount + j] = fvalue; #if DISTRHO_PLUGIN_HAS_UI if (connectedToUI) @@ -895,8 +894,8 @@ public: const uint32_t stateCount = 0; #endif - // int64_t ignore = 0; - // v3_cpp_obj(stream)->seek(stream, 0, V3_SEEK_SET, &ignore); + int64_t ignore = 0; + v3_cpp_obj(stream)->seek(stream, 0, V3_SEEK_SET, &ignore); if (stateCount == 0 && paramCount == 0) { @@ -963,8 +962,10 @@ public: String tmpStr; tmpStr = fPlugin.getParameterSymbol(i); tmpStr += "\xff"; - // TODO cast to integer if needed - tmpStr += String(fPlugin.getParameterValue(i)); + if (fPlugin.getParameterHints(i) & kParameterIsInteger) + tmpStr += String(static_cast<int>(std::round(fPlugin.getParameterValue(i)))); + else + tmpStr += String(fPlugin.getParameterValue(i)); tmpStr += "\xff"; state += tmpStr;