commit 50a55c6ef44586abc2f77d758e626057b93a377b
parent 018e45db4a40d57761f12e797093e3699b1ca5e3
Author: falkTX <falktx@falktx.com>
Date: Thu, 28 Sep 2023 15:19:06 +0200
Fix VST3 usage with non-english locales
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/distrho/extra/Runner.hpp b/distrho/extra/Runner.hpp
@@ -114,7 +114,7 @@ public:
}
/*
- * Start the thread.
+ * Start the runner.
*/
bool startRunner(const uint timeIntervalMilliseconds = 0) noexcept
{
diff --git a/distrho/src/DistrhoPluginVST3.cpp b/distrho/src/DistrhoPluginVST3.cpp
@@ -1097,9 +1097,14 @@ public:
continue;
if (fPlugin.getParameterHints(j) & kParameterIsInteger)
+ {
fvalue = std::atoi(value.buffer());
+ }
else
+ {
+ const ScopedSafeLocale ssl;
fvalue = std::atof(value.buffer());
+ }
fCachedParameterValues[kVst3InternalParameterBaseCount + j] = fvalue;
#if DISTRHO_PLUGIN_HAS_UI
@@ -1835,12 +1840,18 @@ public:
*output = static_cast<double>(std::atoi(ScopedUTF8String(input))) / DPF_VST3_MAX_BUFFER_SIZE;
return V3_OK;
case kVst3InternalParameterSampleRate:
- *output = std::atof(ScopedUTF8String(input)) / DPF_VST3_MAX_SAMPLE_RATE;
+ {
+ const ScopedSafeLocale ssl;
+ *output = std::atof(ScopedUTF8String(input)) / DPF_VST3_MAX_SAMPLE_RATE;
+ }
return V3_OK;
#endif
#if DISTRHO_PLUGIN_WANT_LATENCY
case kVst3InternalParameterLatency:
- *output = std::atof(ScopedUTF8String(input)) / DPF_VST3_MAX_LATENCY;
+ {
+ const ScopedSafeLocale ssl;
+ *output = std::atof(ScopedUTF8String(input)) / DPF_VST3_MAX_LATENCY;
+ }
return V3_OK;
#endif
#if DISTRHO_PLUGIN_WANT_PROGRAMS
@@ -1885,9 +1896,14 @@ public:
float value;
if (fPlugin.getParameterHints(index) & kParameterIsInteger)
+ {
value = std::atoi(input8);
+ }
else
+ {
+ const ScopedSafeLocale ssl;
value = std::atof(input8);
+ }
*output = ranges.getNormalizedValue(value);
return V3_OK;