HISE Logo Forum
    • Categories
    • Register
    • Login

    Setting middlePosition for Slider affects minimum return valueNormalized

    Scheduled Pinned Locked Moved Scripting
    15 Posts 2 Posters 523 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
      aaronventure @d.healey
      last edited by

      @d-healey Yes, that's why the graphic jumps. The normalized value cannot go below 0.079 if I set middlePosition to 400

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

        @aaronventure Can you post your laf function?

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

        A 1 Reply Last reply Reply Quote 0
        • A
          aaronventure @d.healey
          last edited by aaronventure

          @d-healey

          It's a modified version of the one from the examples.

          filterLAF.registerFunction("drawRotarySlider", function(g, obj)
          {
          	var leadPath = Content.createPath();
              var backgroundPath = Content.createPath();
              var range = obj.max - obj.min;
              var a = obj.area;
              
              var startOffset = Math.toRadians(135);
              var arcThickness = 0.06;	
              var arcWidth = 0.6;
              
              var pathX = (1.0 - (arcWidth + arcThickness)) / 2; // centers it horizontally
                
              backgroundPath.clear();
          
              var endOffset = -startOffset + 2.0 * startOffset * obj.valueNormalized;
              
              
              // Label Text
              g.setColour(COLOR_MONOCHROME_BASE);
              g.setFont("Arial", 14); 
              g.drawAlignedText(obj.text, [a[0], UI_FILTERS_LABEL_OFFSET, a[2], a[3]], "centredBottom");  
          	
          	    
              // Background Arc
              g.setColour(COLOR_LEAD_DARK);
              backgroundPath.addArc([pathX, pathX, arcWidth + arcThickness, arcWidth + arcThickness], -startOffset , startOffset);
              var pathArea = backgroundPath.getBounds(obj.area[2]); // get area with ui dimensions
              g.drawPath(backgroundPath, pathArea, obj.area[2] * arcThickness);
          
              // Lead Arc
              leadPath.addArc([pathX, pathX, arcWidth + arcThickness, arcWidth + arcThickness], -startOffset, endOffset);   
              var pathArea = leadPath.getBounds(obj.area[2]);
              g.setColour(COLOR_LEAD_BASE);
              g.drawPath(leadPath, pathArea, obj.area[2] * arcThickness );
          }
          
          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @aaronventure
            last edited by

            @aaronventure Thanks, I'll take a look at it shortly.

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

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

              Seems to work here, perhaps I'm misunderstanding the issue

              HiseSnippet 1342.3ocsWstaaaCElJMJa16BVG1C.Q9kbqiqcZZ1.BJlyMuk0bwnNsqCEEEzRT1rVhTijJotC8+6wZuC6EYuAcGRIKImaM0.0+HwjmaemOd3gG2WJ7oJkPhbpc5zDJx4qcGLkqGu6XBiiNXOXe2HRnlpzncllPTJZ.xw4N+hQrSskQ1O+2OuCIhv8okagPOWv7oGxhY5xc628Irnndj.5or3JZuQ2C7E7cEQhT.J2wsMJg3OgLhdLwn1RtHmU1OfoExAZB.FPmcDASGLVbNOS+myTrgQTyhNnAfix1Fs6XVTP+YooBgbVteYRemrj9GbOhEvJ1uL4+Nq.boEU4.mktIH04S.RNUfzxYP5ttC7krDcoDCd9J2C3ZpLj.TcUnjoKZo2rh6tBPCttULYBsmDVTXg2lsa2DC+owV0qCzsRiCYQfvC2tG9w3YF5KoP9bnvmDcnPLYadPOJMxqznyHR7S3hgcpXzHpdWQbhfCK7V0JcUiE0Y7HFmhCS49ZlfiEbqPicRQjm+LiZBtMJk1n9eUuFHTIhnsRjLvaEpXBxyMJcrPFShXuiF30.Bx6g3bi3nkxrqMf6RhhFBkVdyiCKTKHiVR5HlB9dubT6sZfjb9SEZhb5fHV.UtZyhTxaTSrX3arH2PMQTRPehd7knTylFZDCeLJZvwHoHke6TWR3infVPrfC22hWK6aLdoJjbwDvAY6VHRAXWeRXHPEfRGA9tkV7TR.ivUdcd3ipDHhz+zwL+IbntCzscq1atUspR+cVfEusas4EhRB32W.R75zpM.PuBku+bdsQC7CvquE9AO.6SMkmJLSiGKjr2AT.bDM05wbGOOO0xGHXosbbVTo7fhLaspI58wqC33dyk72yxPmMeczV0qUDN.T6TDQ71Re6tixJhLMn7LNX3nrE471EvHIH.Lz6kV9nIN+eWCabsBdUy4SmlUSjJGXF2uMbjCo+EvAbcXGyBk2rxhWt9qZXIdPD1rA9bFD3TFN.5HyUPAsJOgM071hv4cZyh30DWwq.wN2Qb94CDoCgKDE73raGednnlk0BPVdgBybJp.AWC4bkG2LMMNaYmBMJ3mYd71wLXSKKC8Xa.Yhyk50VzIpwVUZbdrPSOg6YazT+80wWTTX3UJKuEWDUdkhMODKuIC83owCoxpMnMJBuTM+yeqb6d9yOqIWEEE7C3L8IIz708DQAlm0Le+xOVhx6RZd1LGgfpZ6ilea9ilY8nQLvIegqklQVvWLvw+71tnmcvdDMYla.OBQIgJ0LSx3rG8LX7kr2hq4tGUMQKRr5l+5B7D8GMnuE4357XGDZp4K+FDXkdpgRVwp.JlEDDQ6KTLCkWNNzztvqOICfNSUmwJt5HWazEdCnX4e+ucUoggLS.cw+56PPETrRCv5fXXJJjy269LEEGPCIoQZrZB3J3c4IzfSE1wqN2b2pz6+Q2wT1nw5p6DKBnlIP5Io+YJk6OEofyP6Cx8EIoIlzd6ghynnxKKf8qfPe3CYC+cogbfwqDAoQD87ybYFtLWfgVpNniYXFnIkdZUh4SXPr123fX2VHdW29Ls+3qFiKcEXDpx9bfw7wW+F28CCo95R.trauWrnyp9QB+SEoZFeDLAgzVtcbZ7.3j1mBQmyoQJSo9Rl6oYqaaVaXfAPqY6hO.exE1wr1IWXmYBQwDeo309Y2tMCH+k1c.Lws+dfZtGYViKtV65BSoXtNwdsuuI8WCZcb01r9BXyCW.a1XAr4QKfMat.17iKfM+zMZi4mIscpVDmcc.1n+911qNN6yIPkksJD8+.XY1JM.
              

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

              A 1 Reply Last reply Reply Quote 0
              • A
                aaronventure @d.healey
                last edited by

                @d-healey Thanks for having a look at this.

                I still get the same behavior with your version, though now it cuts off at 0.17.

                alt text

                I'm on commit

                3235dac - - bump version to 3.6.0

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

                  Oh right, change the step size to 0.01, that might improve the resolution.

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

                  A 1 Reply Last reply Reply Quote 0
                  • A
                    aaronventure @d.healey
                    last edited by

                    @d-healey Alright, now it's skipping at 0.079 like my own example.

                    Just to confirm, are you getting the same behavior?

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

                      @aaronventure I see the same but the behaviour looks correct to me. What value are you expecting to see?

                      I wonder also what the calculation is under-the-hood, because I get a different result with my own "standard" normalisation function.

                      inline function onKnob1Control(component, value)
                      {
                      	local normalizedValue = (value - component.get("min")) / (component.get("max") - component.get("min"));
                      	Console.print(normalizedValue + " : " + component.getValueNormalized());
                      };
                      

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

                      A 2 Replies Last reply Reply Quote 1
                      • A
                        aaronventure @d.healey
                        last edited by

                        @d-healey When using the control while holding the mouse down, it snaps down to 0 after getting down to 7.9%. That leaves the entire 7.9% of the range inaccessible.

                        Shift clicking and manually altering the decimal values of the slider when at 20.x will let the normalizedValue go down as it should, as the graphic will update properly.

                        But when dragging with the mouse, it always snaps. After monitoring the "filter freq" value it outputs, I think it's because that always gets rounded to two decimal points, as the set step size is 0.01.

                        Moving the midpoint further up alleviates the situation, but it's not the correct move design-wise in this case. I'll try doing manual translation.

                        I wonder if I could force denser step size.

                        1 Reply Last reply Reply Quote 0
                        • A
                          aaronventure @d.healey
                          last edited by

                          @d-healey

                          Huh.

                          knob_LowCut.set("stepSize", 0.000001);
                          

                          does indeed work. But that's as dense as it'll go.

                          I wonder if there are any downsides. Perhaps in DAW automation?

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

                            Does adjusting the mouse sensitivity help?

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

                            A 1 Reply Last reply Reply Quote 0
                            • A
                              aaronventure @d.healey
                              last edited by

                              @d-healey No.

                              I have settled on stepSize 0.0001 with middlePosition 1000 and it works well. I think stepsize is the culprit, and the 20-20000 range is so insane in this curve that the frequency value just gets truncated, but that's the nature of filter frequency response being mapped to a knob.

                              Thanks for helping me work through this.

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

                              38

                              Online

                              1.7k

                              Users

                              11.7k

                              Topics

                              102.2k

                              Posts