@@ -13,6 +13,15 @@ | |||||
#endif // USE_VST2 | #endif // USE_VST2 | ||||
#ifdef USE_LOG_PRINTF | |||||
extern void log_printf(const char *logData, ...); | |||||
#undef Dprintf | |||||
#define Dprintf log_printf | |||||
#else | |||||
#define Dprintf printf | |||||
#endif // USE_LOG_PRINTF | |||||
namespace rack { | namespace rack { | ||||
@@ -185,6 +194,7 @@ void ModuleWidget::fromJson(json_t *rootJ) { | |||||
if (!paramIdJ) | if (!paramIdJ) | ||||
continue; | continue; | ||||
int paramId = json_integer_value(paramIdJ); | int paramId = json_integer_value(paramIdJ); | ||||
// Dprintf("fromJson: paramId=%d\n", paramId); | |||||
// Find ParamWidget(s) with paramId | // Find ParamWidget(s) with paramId | ||||
for (ParamWidget *paramWidget : params) { | for (ParamWidget *paramWidget : params) { | ||||
if (paramWidget->paramId == paramId) | if (paramWidget->paramId == paramId) | ||||
@@ -4,6 +4,14 @@ | |||||
#include "global.hpp" | #include "global.hpp" | ||||
#include "global_ui.hpp" | #include "global_ui.hpp" | ||||
#ifdef USE_LOG_PRINTF | |||||
extern void log_printf(const char *logData, ...); | |||||
#undef Dprintf | |||||
#define Dprintf log_printf | |||||
#else | |||||
#define Dprintf printf | |||||
#endif // USE_LOG_PRINTF | |||||
namespace rack { | namespace rack { | ||||
@@ -21,7 +29,11 @@ json_t *ParamWidget::toJson() { | |||||
void ParamWidget::fromJson(json_t *rootJ) { | void ParamWidget::fromJson(json_t *rootJ) { | ||||
json_t *valueJ = json_object_get(rootJ, "value"); | json_t *valueJ = json_object_get(rootJ, "value"); | ||||
if (valueJ) | if (valueJ) | ||||
setValue(json_number_value(valueJ)); | |||||
{ | |||||
float numberVal = json_number_value(valueJ); | |||||
// Dprintf("ParamWidget::fromJson: numberVal=%f\n", numberVal); | |||||
setValue(numberVal); | |||||
} | |||||
} | } | ||||
void ParamWidget::reset() { | void ParamWidget::reset() { | ||||
@@ -1,5 +1,13 @@ | |||||
#include "widgets.hpp" | #include "widgets.hpp" | ||||
#ifdef USE_LOG_PRINTF | |||||
extern void log_printf(const char *logData, ...); | |||||
#undef Dprintf | |||||
#define Dprintf log_printf | |||||
#else | |||||
#define Dprintf printf | |||||
#endif // USE_LOG_PRINTF | |||||
namespace rack { | namespace rack { | ||||
@@ -9,21 +17,23 @@ QuantityWidget::QuantityWidget() { | |||||
} | } | ||||
void QuantityWidget::setValue(float value) { | void QuantityWidget::setValue(float value) { | ||||
// printf("xxx QuantityWidget::setValue: value=%f\n", value); | |||||
// Dprintf("xxx QuantityWidget::setValue: value=%f\n", value); | |||||
if(isfinite(minValue) && isfinite(maxValue)) | if(isfinite(minValue) && isfinite(maxValue)) | ||||
{ | { | ||||
// Dprintf("xxx QuantityWidget::setValue: isfinite value=%f\n", value); | |||||
this->value = clamp(value, fminf(minValue, maxValue), fmaxf(minValue, maxValue)); | this->value = clamp(value, fminf(minValue, maxValue), fmaxf(minValue, maxValue)); | ||||
EventChange e; | EventChange e; | ||||
onChange(e); | onChange(e); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
// Dprintf("xxx QuantityWidget::setValue: !isfinite value=%f\n", value); | |||||
// Rotary knob | // Rotary knob | ||||
this->value = value; | this->value = value; | ||||
EventChange e; | EventChange e; | ||||
onChange(e); | onChange(e); | ||||
} | } | ||||
// printf("xxx QuantityWidget::setValue: LEAVE value=%f\n", value); | |||||
// Dprintf("xxx QuantityWidget::setValue: LEAVE value=%f\n", value); | |||||
} | } | ||||
void QuantityWidget::setLimits(float minValue, float maxValue) { | void QuantityWidget::setLimits(float minValue, float maxValue) { | ||||