Some little hacks to ensure proper mingw print format is used

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2022-01-10 10:50:36 +00:00
parent a1e0af2fda
commit 5946464fc9
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
5 changed files with 23 additions and 13 deletions

2
deps/PawPaw vendored

@ -1 +1 @@
Subproject commit 02ff3c65f53a8997a2c313e17afdc491c6575f61 Subproject commit 3ce181e48506ef6d14b6e256af98801e58119415

2
dpf

@ -1 +1 @@
Subproject commit 5d7fd17f6a634ccd648a264743319c145928a27c Subproject commit ad2b5b3d6e604dede370722ab04d89e2acaeb2fa

View file

@ -22,6 +22,12 @@
# define PRIVATE_WAS_DEFINED # define PRIVATE_WAS_DEFINED
#endif #endif
// use mingw print format
#if defined(ARCH_WIN) && !defined(SKIP_MINGW_FORMAT)
# include <regex>
# define format(f,a,b) format(__MINGW_PRINTF_FORMAT,a,b)
#endif
#include_next "common.hpp" #include_next "common.hpp"
// Make binary resources work the same no matter the OS // Make binary resources work the same no matter the OS

View file

@ -660,13 +660,13 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
uint parameterCount; uint parameterCount;
struct Parameter { struct Parameter {
char* name; char* name;
char* format; char* printformat;
uint32_t rindex; uint32_t rindex;
bool boolean, bvalue, log, readonly; bool boolean, bvalue, log, readonly;
float min, max, power; float min, max, power;
Parameter() Parameter()
: name(nullptr), : name(nullptr),
format(nullptr), printformat(nullptr),
rindex(0), rindex(0),
boolean(false), boolean(false),
bvalue(false), bvalue(false),
@ -677,7 +677,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
~Parameter() ~Parameter()
{ {
std::free(name); std::free(name);
std::free(format); std::free(printformat);
} }
}* parameters; }* parameters;
float* values; float* values;
@ -901,18 +901,18 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
const CarlaParameterInfo* const pinfo = carla_get_parameter_info(handle, 0, i); const CarlaParameterInfo* const pinfo = carla_get_parameter_info(handle, 0, i);
const ::ParameterRanges* const pranges = carla_get_parameter_ranges(handle, 0, i); const ::ParameterRanges* const pranges = carla_get_parameter_ranges(handle, 0, i);
String format; String printformat;
if (pdata->hints & PARAMETER_IS_INTEGER) if (pdata->hints & PARAMETER_IS_INTEGER)
format = "%.0f "; printformat = "%.0f ";
else else
format = "%.3f "; printformat = "%.3f ";
format += pinfo->unit; printformat += pinfo->unit;
PluginGenericUI::Parameter& param(ui->parameters[j]); PluginGenericUI::Parameter& param(ui->parameters[j]);
param.name = strdup(pinfo->name); param.name = strdup(pinfo->name);
param.format = format.getAndReleaseBuffer(); param.printformat = printformat.getAndReleaseBuffer();
param.rindex = i; param.rindex = i;
param.boolean = pdata->hints & PARAMETER_IS_BOOLEAN; param.boolean = pdata->hints & PARAMETER_IS_BOOLEAN;
param.log = pdata->hints & PARAMETER_IS_LOGARITHMIC; param.log = pdata->hints & PARAMETER_IS_LOGARITHMIC;
@ -1383,7 +1383,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
if (param.readonly) if (param.readonly)
{ {
ImGui::BeginDisabled(); ImGui::BeginDisabled();
ImGui::SliderFloat(param.name, &ui->values[i], param.min, param.max, param.format, ImGuiSliderFlags_NoInput); ImGui::SliderFloat(param.name, &ui->values[i], param.min, param.max, param.printformat, ImGuiSliderFlags_NoInput);
ImGui::EndDisabled(); ImGui::EndDisabled();
continue; continue;
} }
@ -1406,8 +1406,8 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
else else
{ {
const bool ret = param.log const bool ret = param.log
? ImGui::SliderFloat(param.name, &ui->values[i], param.min, param.max, param.format, 2.0f) ? ImGui::SliderFloat(param.name, &ui->values[i], param.min, param.max, param.printformat, 2.0f)
: ImGui::SliderFloat(param.name, &ui->values[i], param.min, param.max, param.format); : ImGui::SliderFloat(param.name, &ui->values[i], param.min, param.max, param.printformat);
if (ret) if (ret)
{ {
if (ImGui::IsItemActivated()) if (ImGui::IsItemActivated())

View file

@ -973,6 +973,7 @@ $(BUILD_DIR)/Bidoo/%.cpp.o: Bidoo/%.cpp
$(foreach m,$(BIDOO_CUSTOM),$(call custom_module_names,$(m),Bidoo)) \ $(foreach m,$(BIDOO_CUSTOM),$(call custom_module_names,$(m),Bidoo)) \
$(foreach m,$(BIDOO_CUSTOM_PER_FILE),$(call custom_per_file_names,$(m),Bidoo_$(shell basename $*))) \ $(foreach m,$(BIDOO_CUSTOM_PER_FILE),$(call custom_per_file_names,$(m),Bidoo_$(shell basename $*))) \
-DpluginInstance=pluginInstance__Bidoo \ -DpluginInstance=pluginInstance__Bidoo \
-DSKIP_MINGW_FORMAT \
-IBidoo/src/dep/gverb/include \ -IBidoo/src/dep/gverb/include \
-Wno-ignored-qualifiers \ -Wno-ignored-qualifiers \
-Wno-sign-compare \ -Wno-sign-compare \
@ -986,6 +987,7 @@ $(BUILD_DIR)/BogaudioModules/src/follower_base.cpp.o: BogaudioModules/src/follow
-DpluginInstance=pluginInstance__BogaudioModules \ -DpluginInstance=pluginInstance__BogaudioModules \
-DefGainMaxDecibels=efGainMaxDecibelsDebug \ -DefGainMaxDecibels=efGainMaxDecibelsDebug \
-DRACK_SIMD=1 \ -DRACK_SIMD=1 \
-DSKIP_MINGW_FORMAT \
-IBogaudioModules/lib \ -IBogaudioModules/lib \
-IBogaudioModules/src/dsp -IBogaudioModules/src/dsp
@ -997,6 +999,7 @@ $(BUILD_DIR)/BogaudioModules/%.cpp.o: BogaudioModules/%.cpp
$(foreach m,$(BOGAUDIO_CUSTOM_PER_FILE),$(call custom_per_file_names,$(m),Bogaudio_$(shell basename $*))) \ $(foreach m,$(BOGAUDIO_CUSTOM_PER_FILE),$(call custom_per_file_names,$(m),Bogaudio_$(shell basename $*))) \
-DpluginInstance=pluginInstance__BogaudioModules \ -DpluginInstance=pluginInstance__BogaudioModules \
-DRACK_SIMD=1 \ -DRACK_SIMD=1 \
-DSKIP_MINGW_FORMAT \
-IBogaudioModules/lib \ -IBogaudioModules/lib \
-IBogaudioModules/src/dsp -IBogaudioModules/src/dsp
@ -1015,6 +1018,7 @@ $(BUILD_DIR)/ChowDSP/%.cpp.o: ChowDSP/%.cpp
$(foreach m,$(CHOWDSP_CUSTOM),$(call custom_module_names,$(m),ChowDSP)) \ $(foreach m,$(CHOWDSP_CUSTOM),$(call custom_module_names,$(m),ChowDSP)) \
-DpluginInstance=pluginInstance__ChowDSP \ -DpluginInstance=pluginInstance__ChowDSP \
-DUSE_EIGEN \ -DUSE_EIGEN \
-DSKIP_MINGW_FORMAT \
-IChowDSP/lib \ -IChowDSP/lib \
-IChowDSP/lib/chowdsp_utils/DSP/WDF \ -IChowDSP/lib/chowdsp_utils/DSP/WDF \
-Wno-deprecated-copy -Wno-deprecated-copy