Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix VST3 usage with non-english locales
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Sep 28, 2023
1 parent 018e45d commit 50a55c6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion distrho/extra/Runner.hpp
Expand Up @@ -114,7 +114,7 @@ class Runner
}

/*
* Start the thread.
* Start the runner.
*/
bool startRunner(const uint timeIntervalMilliseconds = 0) noexcept
{
Expand Down
20 changes: 18 additions & 2 deletions distrho/src/DistrhoPluginVST3.cpp
Expand Up @@ -1097,9 +1097,14 @@ class PluginVst3
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
Expand Down Expand Up @@ -1835,12 +1840,18 @@ class PluginVst3
*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
Expand Down Expand Up @@ -1885,9 +1896,14 @@ class PluginVst3

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;
Expand Down

0 comments on commit 50a55c6

Please sign in to comment.