getValueNormalized



  • Why isn't there a getValueNormalized function for sliders/knobs? and why is there such a function for buttons (I can't see the use for it)?



  • Sliders do have this function:

    Content.makeFrontInterface(600, 500);
    const var Knob = Content.addKnob("Knob", 76, 19);
    // [JSON Knob]
    Content.setPropertiesFromJSON("Knob", {
      "min": -100,
      "max": 0,
      "saveInPreset": 0,
      "mode": "Decibel",
      "stepSize": 0.1,
      "middlePosition": -12,
      "suffix": " dB"
    });
    // [/JSON Knob]
    
    Knob.set("saveInPreset", false);;
    Knob.setValue(-18.0);
    Console.print(Knob.getValueNormalized()); // 0.34...
    

    But I noticed, you have to explicitly set the middlePosition for non trivial modes like Decibel etc. for it to work correctly...

    It's there for buttons, because it's a generic function for every component (it's defined in the base class of all components) so you can even get the normalised value from a viewport, which makes even less sense 🙂



  • I see, I thought it wasn't there because it's not showing up in my API list

    0_1503830264859_Capture.PNG


 

5
Online

353
Users

1.1k
Topics

7.6k
Posts