HISE Logo Forum
    • Categories
    • Register
    • Login

    Display slider value with custom font, size, and position

    Scheduled Pinned Locked Moved Newbie League
    6 Posts 3 Posters 78 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.
    • YinxiY
      Yinxi
      last edited by

      Hi,

      I’m trying to display the value of a slider (for example, the gain of the "Simple Gain1" module) in the interface. I would also like to be able to change the font, size, and position of the displayed value.

      I’ve tried to find a solution, but I’m a bit overwhelmed by all the information. I imagine I need to use a panel script and paintRoutine for LAF to draw the value of the gain, and retrieve the gain value with a function, but this is beyond my current level in HISE.

      If anyone has a working example or guidance on how to display a slider value like this with customizable appearance, it would be really helpful.

      Thanks in advance.

      HISEnbergH It_UsedI 2 Replies Last reply Reply Quote 0
      • HISEnbergH
        HISEnberg @Yinxi
        last edited by

        @Yinxi David's videos are the best place to get started, as well as just diving into the documentation and examples found here on the forum:

        https://www.youtube.com/watch?v=3VVknix6-cY
        https://www.youtube.com/watch?v=PykrsXv8aqg

        This is probably worth looking into as well:
        https://www.audiodevschool.com/courses/hise-bootcamp/

        1 Reply Last reply Reply Quote 2
        • It_UsedI
          It_Used @Yinxi
          last edited by

          @Yinxi create visual mockup your idea, and i maybe implement this!

          YinxiY 1 Reply Last reply Reply Quote 1
          • YinxiY
            Yinxi @It_Used
            last edited by Yinxi

            @It_Used said in Display slider value with custom font, size, and position:

            @Yinxi create visual mockup your idea, and i maybe implement this!

            Reply

            I was thinking something like this : 919250af-e624-4855-9141-2c6f0ec6d9ce-image.png .

            And when I change the slider value it will also change the value at the top left

            It_UsedI 1 Reply Last reply Reply Quote 1
            • It_UsedI
              It_Used @Yinxi
              last edited by It_Used

              @Yinxi get resault.

              Update:

              • Changed visibible values after comma/dot for knob and label (from 1 to 2).
              • Some comments have a more nfo.
                4bca0896-7e9f-4adf-ada0-b70a75b8bd99-image.png

              Snippet (Copy and paste in Hise by shortcut Ctrl +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lmvt7Pe4odE0Vug38KrTl7Ok.rJj3SG.eeq93+ODP7RX9HXRq8vvfMxtJuHKZ.Tn2i.PkwHgxd8lyI6nnW6VTEe.g4qV7d3S9lsKplK2rcwleTtiHrWB+MEOIFRMWTQAzalpGUMq8jqQsmXLgh1zz234M4QcIAW51JXmaqfKeaEbkaqfqdaEbsaqfO9CKnb3lmj+ZDHOwvXu96nFqyzbG0zOpTFi+BXhPCHN
              

              Code:

              // Make UI.
              Content.makeFrontInterface(500, 100);
              
              // Declare master chain effect (for example).
              const var Gain = Synth.getEffect("Gain");
              
              // Declare gain knob UI Controller.
              const knbGain = Content.addKnob("knbGain", 20, 20);
              
              // Set gain knob properties.
              Content.setPropertiesFromJSON("knbGain", {
              "type": "ScriptSlider",
              "id": "knbGain",
              "x": 20,
              "y": 20,
              "style": "Knob",
              "middlePosition": -12.0,
              "stepSize": "0.01", // This parameter controls numbers after comma/dot, if you set this parameter to 0.1 and write -19.41 value - then in the out you get -19.40 (-19.4) value.
              "min": -100.0,
              "max": 0.0,
              "suffix": "", // If you need linear dB, write here dB. Do not change knob mode, this is can be apply a negative effect for smoothness them. Use suffix (in the fact it is postfix).
              "linkedTo": "",
              "showValuePopup": "Below",
              "showTextBox": false,
              "enableMidiLearn": false});
              
              // Declare value display label.
              const lblValueDisp = Content.addLabel("lblValueDisp", 200, 20);
              
              // Set value display label settings.
              Content.setPropertiesFromJSON("lblValueDisp", {
              "type": "ScriptLabel",
              "id": "uninitialised",
              "text": 0, // In the future this parameter can be changed by tweak gain knob.
              "x": 200,
              "y": 20,
              "fontName": "Rajdhani", // This parameter can be changed font.
              "fontSize": 19.0, // This parameter can be changed sise of font.
              "editable": false,
              "updateEachKey": true,
              "textColour": 4291743438});
              
              // Declare gain knob callback.
              inline function onknbGainControl(component, value)
              {
              	
              	// Set label text. (On compile, plugin startup this function apply automatically, if you do not create conditions).
              	lblValueDisp.set("text", Engine.doubleToString(value, 2)); // Engine.doubleToString need for control visible numbers after comma/dot in the value. without it we get this value: -7.400000095367432.
              	
              	// Set gain value.
              	Gain.setAttribute(0, value);
              	
              };
              Content.getComponent("knbGain").setControlCallback(onknbGainControl);
              
              YinxiY 1 Reply Last reply Reply Quote 1
              • YinxiY
                Yinxi @It_Used
                last edited by

                @It_Used wow thanks that’s awesome ! I’ll be able to dig into all of this.

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

                17

                Online

                2.0k

                Users

                12.7k

                Topics

                110.2k

                Posts