Skip to content

Commit d247381

Browse files
committed
Fix expmode issue for [knob]
1 parent a3a8284 commit d247381

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Source/Objects/KnobObject.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#pragma once
77

88
#include "TclColours.h"
9+
#include "Components/PropertiesPanel.h"
910

1011
extern "C" {
1112
void knob_get_snd(void* x);
@@ -326,6 +327,7 @@ class KnobObject final : public ObjectBase {
326327

327328
Value sizeProperty = SynchronousValue();
328329

330+
PropertiesPanel::EditableComponent<float>* expFactorPanel = nullptr;
329331
NVGcolor bgCol;
330332

331333
String typeBuffer;
@@ -375,7 +377,7 @@ class KnobObject final : public ObjectBase {
375377
objectParameters.addParamBool("Circular drag", cGeneral, &circular, { "No", "Yes" }, 0);
376378
objectParameters.addParamBool("Read only", cGeneral, &readOnly, { "No", "Yes" }, 0);
377379
objectParameters.addParamBool("Jump on click", cGeneral, &jumpOnClick, { "No", "Yes" }, 0);
378-
380+
379381
objectParameters.addParamReceiveSymbol(&receiveSymbol);
380382
objectParameters.addParamSendSymbol(&sendSymbol);
381383
objectParameters.addParamString("Variable", cGeneral, &variableName, "");
@@ -1121,12 +1123,21 @@ class KnobObject final : public ObjectBase {
11211123
}
11221124
repaint();
11231125
} else if (value.refersToSameSourceAs(exponential)) {
1124-
if (auto knb = ptr.get<t_fake_knob>())
1125-
knb->x_exp = ::getValue<float>(exponential);
1126+
if (auto knb = ptr.get<t_fake_knob>()) {
1127+
if(knb->x_expmode == 2) {
1128+
knb->x_exp = ::getValue<float>(exponential);
1129+
}
1130+
}
11261131
} else if (value.refersToSameSourceAs(logMode)) {
11271132
if (auto knb = ptr.get<t_fake_knob>()) {
11281133
knb->x_expmode = ::getValue<float>(logMode) - 1;
11291134
knb->x_log = knb->x_expmode == 1;
1135+
if(knb->x_expmode <= 1) {
1136+
knb->x_exp = 0;
1137+
}
1138+
else {
1139+
knb->x_exp = ::getValue<float>(exponential);
1140+
}
11301141
}
11311142
} else if (value.refersToSameSourceAs(sendSymbol)) {
11321143
setSendSymbol(sendSymbol.toString());

0 commit comments

Comments
 (0)