HISE Logo Forum
    • Categories
    • Register
    • Login

    getValueNormalized

    Scheduled Pinned Locked Moved Scripting
    3 Posts 2 Posters 723 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • d.healeyD
      d.healey
      last edited by d.healey

      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)?

      Libre Wave - Freedom respecting instruments and effects
      My Patreon - HISE tutorials
      YouTube Channel - Public HISE tutorials

      1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart
        last edited by

        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 :)

        1 Reply Last reply Reply Quote 1
        • d.healeyD
          d.healey
          last edited by

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

          0_1503830264859_Capture.PNG

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          1 Reply Last reply Reply Quote 0
          • First post
            Last post

          16

          Online

          1.7k

          Users

          11.9k

          Topics

          103.5k

          Posts