HISE Logo Forum
    • Categories
    • Register
    • Login

    Percentage on lavel

    Scheduled Pinned Locked Moved General Questions
    5 Posts 2 Posters 331 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.
    • A
      arminh
      last edited by

      Im trying to put percentage value from knob to label.
      But I can't convert value to percentage, how I can convert 0.00 to 0%? I tried JS solutions but without success

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

        parseInt() is what you‘re looking for.

        A 1 Reply Last reply Reply Quote 0
        • A
          arminh @Christoph Hart
          last edited by arminh

          @Christoph-Hart im not sure what im doin wrong

          inline function onsaturationControl(component, value)
          {
              local v = saturationKnob.getValue();
              
          	Content.setPropertiesFromJSON("saturationLabel", {
          	    "text": parseInt(v),
          	});
          };
          
          Content.getComponent("saturation").setControlCallback(onsaturationControl);
          

          But I get only 0 or 1 on max

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

            parseInt(v * 100). Normalised percentage means that the range is from 0 to 1.

            A 1 Reply Last reply Reply Quote 0
            • A
              arminh @Christoph Hart
              last edited by

              @Christoph-Hart thanks!

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

              35

              Online

              1.7k

              Users

              11.8k

              Topics

              103.0k

              Posts