HISE Logo Forum
    • Categories
    • Register
    • Login

    Slider value display issue.

    Scheduled Pinned Locked Moved General Questions
    7 Posts 4 Posters 365 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.
    • lalalandsynthL
      lalalandsynth
      last edited by lalalandsynth

      I am having this issue on sliders where it will not show the correct value at the lowest setting , strangely it "works" if I move the slider slowly, although it should go to zero and not stop at 1ms.

      This is only a display issue as its correct on the corresponding module (delay in this case)

      I think I have posted about this before but cannot find it.

      Value.gif

      Code I am using.

      var PREDELAY = "PREDELAY";
      
      const var Delay1 = Synth.getEffect("Delay1");
      const var sliderPredelay = Content.getComponent("sliderPredelay");
      
      var pred = createLabel(PREDELAY, "ms", 275, 455, 128, 22);
      
      inline function onsliderPredelayControl(component, value) {
      	Delay1.setAttribute(1,value);
          Delay1.setAttribute(0,value);
          displayValue(pred, value);
      };
      
      Content.getComponent("sliderPredelay").setControlCallback(onsliderPredelayControl); 
      

      https://lalalandaudio.com/

      https://lalalandsynth.com/

      https://www.facebook.com/lalalandsynth

      https://www.facebook.com/lalalandsynth

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

        @lalalandsynth

        Don't use var, use const or reg. - This won't fix the issue but is good practice.

        Don't use Magic Numbers, use enums. - Also won't fix the problem but might prevent future problems.

        displayValue(pred, value);

        We need to see the contents of this function

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

        lalalandsynthL 1 Reply Last reply Reply Quote 0
        • ustkU
          ustk @lalalandsynth
          last edited by

          @lalalandsynth My guess is that it takes too long time to update in your custom function.
          What if you set the text at first in the CB?
          I don't like to do this because to me there's a priority to set the values and the text comes after, as you did...

          Can't help pressing F5 in the forum...

          1 Reply Last reply Reply Quote 1
          • lalalandsynthL
            lalalandsynth @d.healey
            last edited by

            @d-healey

            There is a label created that can show the value when clicked.
            Label.gif

            var Labels = {};
            
            const var TEXT_COLOUR = 0xFF9B9B9B;
            const var TRANSPARENT = 0x00000000;
            
            const var labelData = {
                "fontSize": 13,
                "editable": false,
                "bgColour": TRANSPARENT,
                "itemColour": TRANSPARENT, 
                "itemColour2": TRANSPARENT, 
                "textColour": TEXT_COLOUR
            };
            
            const var buttonData = {
                "bgColour": TRANSPARENT,
                "itemColour": TRANSPARENT, 
                "itemColour2": TRANSPARENT, 
                "textColour": TRANSPARENT,
                "filmstripImage": "{PROJECT_FOLDER}transparent.png"
            };
            
            function createLabel(label, postfix, x, y, w, h) {
                var buttonName = label;
                var labelName = label + "Label";
            
                var buttonComponent = Content.addButton(buttonName);
                var labelComponent = Content.addLabel(labelName);
            
                buttonComponent.setPosition(x, y, w, h);
                labelComponent.setPosition(x, y, w, h);
            
                Content.setPropertiesFromJSON(labelName, labelData);
                Content.setPropertiesFromJSON(buttonName, buttonData);
            
                Labels[buttonName] = {
                    component: labelComponent,
                    state: true,
                    label: label,
                    value: 0,
                    postfix: postfix
                };
            
                //Console.print(trace(Labels));
            
                inline function click(component, value) {
                    var buttonName = component.get("id");
                    Labels[buttonName].state = !Labels[buttonName].state;
                    displayValue(component, undefined);
                }
            
                buttonComponent.setControlCallback(click);
            
                return buttonComponent;
            }
            
            inline function displayValue(buttonComponent, value) {
                if (!buttonComponent) { 
                    return; 
                }
            
                var buttonName = buttonComponent.get("id");
                var o = Labels[buttonName];
            
                if (value) {
                    o.value = value;
                }
            
                if (o.state) {
                    o.component.set("text", o.value + " " + o.postfix);
                } else {
                    o.component.set("text", o.label);
                }
            }
            

            https://lalalandaudio.com/

            https://lalalandsynth.com/

            https://www.facebook.com/lalalandsynth

            https://www.facebook.com/lalalandsynth

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

              @lalalandsynth Looks like a lot of weird stuff to me. You have a function and inside that you have an inline function, and inside that you're using var instead of local 😧

              Can you make a snippet that demonstrates the whole thing that I can load into HISE and untangle?

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

              lalalandsynthL 1 Reply Last reply Reply Quote 1
              • lalalandsynthL
                lalalandsynth @d.healey
                last edited by

                @d-healey Someone was assisting me that knows more about programming but maybe not so much about HISE.

                I will prepare an example :)

                https://lalalandaudio.com/

                https://lalalandsynth.com/

                https://www.facebook.com/lalalandsynth

                https://www.facebook.com/lalalandsynth

                DanHD 1 Reply Last reply Reply Quote 1
                • DanHD
                  DanH @lalalandsynth
                  last edited by

                  @lalalandsynth @d-healey was thinking of implementing the same system into my project... watching with interest 😎

                  DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                  https://dhplugins.com/ | https://dcbreaks.com/
                  London, UK

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

                  24

                  Online

                  1.8k

                  Users

                  12.0k

                  Topics

                  104.1k

                  Posts