HISE Logo Forum
    • Categories
    • Register
    • Login

    Output the value of a slider in a separate label

    Scheduled Pinned Locked Moved Scripting
    23 Posts 4 Posters 1.1k 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 @ThomAce
      last edited by

      @ThomAce Performance boost for declaring widgets as a const (in fact anything you can declare as a const should be) - https://forum.hise.audio/topic/79/scripting-best-practices

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

      T 1 Reply Last reply Reply Quote 1
      • T
        ThomAce @d.healey
        last edited by

        @d-healey Thanks for pointing out that. You might have some good idea for my question that I raised not a long ago. Would you mind to take a look at that as well?

        1 Reply Last reply Reply Quote 0
        • N
          nic @ThomAce
          last edited by

          @ThomAce I had this but when I link the slider via processorId it doesn‘t fire the callback anymore.

          d.healeyD T 2 Replies Last reply Reply Quote 0
          • d.healeyD
            d.healey @nic
            last edited by

            @nic You can use either processor/parameter ID or a callback, you can't use both at the same time.

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

            1 Reply Last reply Reply Quote 1
            • N
              nic @d.healey
              last edited by

              @d-healey thanks, yes I will try this way. Do you know code examples for lookAndFeel? I really don‘t know how to start. How to set up my own look and feel for the slider would be enough.

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

                @nic said in Output the value of a slider in a separate label:

                Do you know code examples for lookAndFeel

                What do you want the LAF to do? I have a few videos demonstrating different things you can do with it.

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

                N 1 Reply Last reply Reply Quote 1
                • T
                  ThomAce @nic
                  last edited by ThomAce

                  @nic You can use only one way as d.haley already mentioned that above... If you configure your slider in gui designer to Parameter Properties, and at the same time you set up the callback in oninit part of the code, you will lose controlling.

                  const var MySliderValueLabel = Content.getComponent("MySliderValueLabel");
                  const var ControlThis = Synth.getEffect("YourScriptFX or whatever you wanna control");
                  
                  Content.getComponent("MySlider1").setControlCallback(onMySlider1);
                  
                  inline function onMySlider1(component, value)
                  {
                  	MySliderValueLabel.set("text", Engine.doubleToString(value, 0));
                  	ControlThis.setAttribute(1, value);
                  }
                  

                  10907520-bbb8-4570-9fd2-b8fc20c28cf6-kép.png

                  Also, at the bottom right corner of the code editor, there is a Compile button. You should use it quiet often if you write codes...

                  51c467ea-493b-41d5-a21b-73ecc47f85c6-kép.png

                  I still need to used to this tool as none of RDEs worked in this way I used (Delphi, Lazarus, VS, so many Java and C++ developer environments...) But, it is still more userfriendly than Java developer tools.

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

                    @ThomAce said in Output the value of a slider in a separate label:

                    Also, at the bottom right corner of the code editor, there is a Compile button.

                    Shortcut key F5 will save you some clicks

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

                    T 1 Reply Last reply Reply Quote 1
                    • T
                      ThomAce @d.healey
                      last edited by

                      @d-healey Yeah, but you know how we develop... :D Typing something, then CTRL+S, CTRL+S, CTRL+S... But good thing anyway to use the F5... I didn't knew that this works on code editor as well. A visual feedback might be helpful for such idiots like me. :) I always forget that the code not in sync with the gui design. But, despite some bugs I found in the tool, it is awesome.

                      1 Reply Last reply Reply Quote 0
                      • N
                        nic @d.healey
                        last edited by nic

                        @d-healey I just want to output the value. So basically like this:

                        CUTOFF: 100%

                        And when I drag over the number or use scroll wheel it should increase/decrease it. In other words, the behavior of a diagonal slider but it should be not visible except it‘s value/textbox.

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

                          @nic In the look and feel function you just need to draw the text then.

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

                          N 1 Reply Last reply Reply Quote 0
                          • N
                            nic @d.healey
                            last edited by

                            @d-healey can you point me in the right direction how to set up the laf function? I have Content.getComponent() and don‘t know how to assign or start the laf.

                            M 1 Reply Last reply Reply Quote 0
                            • M
                              Mighty23 @nic
                              last edited by

                              @nic

                              const var Label = Content.getComponent("Label");
                              const var Knob = Content.getComponent("Knob");
                              
                              inline function onKnobControl(component, value)
                              {
                                 Label.set("text",value);
                              };
                              Content.getComponent("Knob").setControlCallback(onKnobControl);
                              

                              If you want something more "fancy" perhaps you could consider making only the writing visible on the label and making the other customizations in a panel. From what I understand it should be the most immediate way.

                              Values ​​and strings in labels can also be concatenated with the "+" symbol

                              .set("text", Engine.doubleToString(value, 0)+" %");
                              

                              Free Party, Free Tekno & Free Software too

                              N 1 Reply Last reply Reply Quote 0
                              • N
                                nic @Mighty23
                                last edited by

                                @Mighty23 thank you very much but I already tried that. The problem is that I want to use proccessorId and so setControlCallback() will not fire. I have to change look and feel instead.

                                T 1 Reply Last reply Reply Quote 0
                                • N
                                  nic
                                  last edited by nic

                                  If I do this:

                                  const var cutoffSlider = Content.getComponent('cutoffSlider');
                                  cutoffSlider.createLocalLookAndFeel();
                                  

                                  I get error "function not found". How do I set up it correctly?

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

                                    @nic https://youtu.be/PykrsXv8aqg

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

                                    N 1 Reply Last reply Reply Quote 0
                                    • N
                                      nic @d.healey
                                      last edited by

                                      @d-healey thanks! Big help.

                                      1 Reply Last reply Reply Quote 0
                                      • T
                                        ThomAce @nic
                                        last edited by ThomAce

                                        @nic As we told, you have to remove the parameter properties from that slider and then you have to use scripting. What I provided does exactly what you are looking for...

                                        Just for example:
                                        3e0a44f6-cb5d-42c7-b298-db16a2f2f205-kép.png

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

                                        13

                                        Online

                                        1.7k

                                        Users

                                        11.9k

                                        Topics

                                        103.3k

                                        Posts