Browse Source

Add "knobLinearSensitivity" to settings.json.

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
4dce9431a5
3 changed files with 12 additions and 6 deletions
  1. +1
    -0
      include/settings.hpp
  2. +1
    -3
      src/app/Knob.cpp
  3. +10
    -3
      src/settings.cpp

+ 1
- 0
include/settings.hpp View File

@@ -36,6 +36,7 @@ enum KnobMode {
KNOB_MODE_ROTARY_RELATIVE,
};
extern KnobMode knobMode;
extern float knobLinearSensitivity;
extern float sampleRate;
extern int threadCount;
extern bool paramTooltip;


+ 1
- 3
src/app/Knob.cpp View File

@@ -145,9 +145,7 @@ void Knob::onDragMove(const event::DragMove& e) {

if (linearMode) {
float delta = (horizontal ? e.mouseDelta.x : -e.mouseDelta.y);
// TODO Put this in settings
const float linearSensitivity = 1 / 1000.f;
delta *= linearSensitivity;
delta *= settings::knobLinearSensitivity;
delta *= modScale;
delta *= rangeRatio;



+ 10
- 3
src/settings.cpp View File

@@ -23,6 +23,7 @@ bool invertZoom = false;
float cableOpacity = 0.5;
float cableTension = 0.5;
KnobMode knobMode = KNOB_MODE_LINEAR_LOCKED;
float knobLinearSensitivity = 0.001f;
float sampleRate = 44100.0;
int threadCount = 1;
bool paramTooltip = false;
@@ -67,6 +68,8 @@ json_t* toJson() {

json_object_set_new(rootJ, "knobMode", json_integer((int) knobMode));

json_object_set_new(rootJ, "knobLinearSensitivity", json_real(knobLinearSensitivity));

json_object_set_new(rootJ, "sampleRate", json_real(sampleRate));

json_object_set_new(rootJ, "threadCount", json_integer(threadCount));
@@ -137,9 +140,9 @@ void fromJson(json_t* rootJ) {
if (cableOpacityJ)
cableOpacity = json_number_value(cableOpacityJ);

json_t* tensionJ = json_object_get(rootJ, "cableTension");
if (tensionJ)
cableTension = json_number_value(tensionJ);
json_t* cableTensionJ = json_object_get(rootJ, "cableTension");
if (cableTensionJ)
cableTension = json_number_value(cableTensionJ);

// legacy v1
json_t* allowCursorLockJ = json_object_get(rootJ, "allowCursorLock");
@@ -152,6 +155,10 @@ void fromJson(json_t* rootJ) {
if (knobModeJ)
knobMode = (KnobMode) json_integer_value(knobModeJ);

json_t* knobLinearSensitivityJ = json_object_get(rootJ, "knobLinearSensitivity");
if (knobLinearSensitivityJ)
knobLinearSensitivity = json_number_value(knobLinearSensitivityJ);

json_t* sampleRateJ = json_object_get(rootJ, "sampleRate");
if (sampleRateJ)
sampleRate = json_number_value(sampleRateJ);


Loading…
Cancel
Save