HISE Logo Forum
    • Categories
    • Register
    • Login

    LAF ScriptSlider?

    Scheduled Pinned Locked Moved General Questions
    195 Posts 11 Posters 15.9k 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.
    • ulrikU
      ulrik @Natan
      last edited by

      @Natan No, what do you mean?

      Hise Develop branch
      MacOs 15.3.1, Xcode 16.2
      http://musikboden.se

      1 Reply Last reply Reply Quote 0
      • NatanN
        Natan @ulrik
        last edited by

        @ulrik said in LAF ScriptSlider?:

        @ulrik ...and search light 😂
        pansliderWpointerAndSearchLight.gif

        HiseSnippet 1541.3ocuXstaaaCEVJMpXwaYnEXO.b9WNsNNxt0sCHKaw4hKLpSpabZ2JBJJnknr3hDo.Eca7FJvdQ56Rej1+2O5NjzxRxwosK6hPPP34F+32g7vCy.A2ijlxEV1qc5zDhk8W4LbJSFteHlxr5c.H2oemtnAXl0dSSvooDeKa6a7HkZ60V0R+8G+3d3HLyijKxx54bpGoOMlJykNX2GSih5h8ImRiKX882smGmsOOhOAfxMbbsRvdmiGSNFqLaEGK6adnOUxECkXII0xd0839SGFxeCyX+yoozQQD0flVCg.YD2kG4qPrRp09gzH+AYK4TKHJCxIfaXHfuw4HpOct7bh3VZEnbOJxG1q7wfWyhvycovycYvyt.7V0.ua6LzSPSj4ZTX6Kc5wjDQ.FRAEgkwVqUNdMm84fELYiX74jtBXvbOp8.W25n1ttar85UVuBjHRknWiEnHb.ZGzgrwTFogmf.KsGEwGgiLgsOmedGleWBIplwUkSIfKYykwmAXY3LC1ZKD5DtDKlhRin9DgQTu.zD.wHbJBq1pgFpUVGkRjHI4BIBy7QwbeBJQvSHBIkjhjbTUv3pqWA.ZCAYLMEVQcmv7jTNqVUeA9MlIyDtp0QAYJGWGwG8KaT42VuBB9T.WfYiI.3A4.IcAZSyeQYaarw7a.toPHkf49TLK2cszmDDnf7NnVMZWxMkEXg2ogTuyYPdCL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TnPSwtzUchy.TNs3r7O9EEKcyzmIbusy.pzKb43ckkfWXS0+03c16yV24vf.nraNXW0o6O+u6iwVJTfR9RnHJztkPk8cNdR7PXKmGAPBiAsi.xrWQcf0L1UMVwLCgZy5Ae.9loroZr8LkMyTZEi8D7W4YNlqdA3Wnk.XhoeH7ZNGoFiZlc51wAtdPsSm9JOOEUrIf8k6SqqgO26Z3y8uF9z9Z3yCtF97vqgOe2G0G0+SfNSj7XywDPvfC0UYssOjggcY5cjV+ETMTxJG
        

        This Show The Error 🤔 k.clear();

        d.healeyD ustkU ulrikU 3 Replies Last reply Reply Quote 0
        • d.healeyD
          d.healey @Natan
          last edited by

          @Natan Not for me

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

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

            @Natan Me neither...

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

            1 Reply Last reply Reply Quote 0
            • ulrikU
              ulrik @Natan
              last edited by

              @Natan Not here..

              Hise Develop branch
              MacOs 15.3.1, Xcode 16.2
              http://musikboden.se

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

                @ustk said in LAF ScriptSlider?:

                @ulrik textColour isn't working with the stock slider either so this should have something to do with a bug in the slider wrapper somehow, it's not related to custom LAF. I'm checking if I can do something...

                Any luck with finding a solution for the textColour property?

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

                ustkU 1 Reply Last reply Reply Quote 0
                • ustkU
                  ustk @d.healey
                  last edited by

                  @d-healey said in LAF ScriptSlider?:

                  Do you have an example of a rotary knob using skew factor?

                  Not on the top of my head...

                  Any luck with finding a solution for the textColour property?

                  I'm having a look before making my evening tea :)

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

                  1 Reply Last reply Reply Quote 1
                  • ustkU
                    ustk @d.healey
                    last edited by ustk

                    @d-healey Ok so now the textColour property is available from the custom LAF (although it still doesn't work with stock sliders, but who cares...)
                    Did I earn my tea? :)

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

                    d.healeyD 2 Replies Last reply Reply Quote 2
                    • d.healeyD
                      d.healey @ustk
                      last edited by

                      @ustk Yey well done, many much tea for you :D @Christoph-Hart merge merge merge :D

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

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

                        @ustk Do you have example of drawing a knob with the correct middle position?

                        This is what I'm working with:

                            laf.registerFunction("drawRotarySlider", function(g, obj)
                            {
                                var a = obj.area;
                                var width = obj.area[2];
                                var height = obj.area[3];
                                var stroke = 3;
                                var mark = 4;
                                var range = obj.max - obj.min;
                                var startOffset = 2.5;
                                var endOffset = -startOffset + 2.0 * startOffset * (obj.value - obj.min) / range;
                        
                                g.setColour(obj.itemColour1);
                                g.fillEllipse(a);
                        
                                g.setColour(obj.itemColour2);
                                g.drawEllipse([stroke / 2, stroke / 2, width - stroke, height - stroke], stroke);
                        
                                g.rotate(endOffset, [a[2] / 2, a[2] / 2]);
                        
                                g.setColour(obj.textColour);
                                g.fillRoundedRectangle([width / 2 - mark / 2, 0, mark, height / 2.5], 1.5);
                            });
                        

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

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

                          laf.registerFunction("drawRotarySlider", function(g, obj)
                          {
                              var a = obj.area;
                              var width = obj.area[2];
                              var height = obj.area[3];
                              var stroke = 3;
                              var mark = 4;
                              var range = obj.max - obj.min;
                              var startOffset = Math.PI * 0.25;
                              var fullArc = Math.PI * 1.5;
                              var arcPos = startOffset + fullArc * (obj.value - obj.min) / range;
                          
                              // 0 = starts in the center
                              var intend = width * 0.25;
                              
                              g.setColour(obj.itemColour1);
                              g.fillEllipse(a);
                              g.setColour(obj.itemColour2);
                              g.drawEllipse([stroke / 2, stroke / 2, width - stroke, height - stroke], stroke);
                              
                              var p = Content.createPath();
                              p.addArc([0, 0, 1.0, 1.0], Math.PI + startOffset + fullArc, Math.PI + startOffset);
                              
                              /// itemColour3 ?
                              g.setColour(0x22FFFFFF);
                              
                              // Annoyingly the path can't scale proportionally so we need to factor this weird number
                              // in to make it non-squashed (change it if you change the intend)
                              // someone with more math ambition could calculate it with a middle-school grade formula...
                              var magicScaler = 1.4;
                              
                              g.drawPath(p, [intend/2 + stroke, 
                                             intend/2 + stroke, 
                                             width - intend - 2 * stroke, 
                                             height - magicScaler * intend - 2 * stroke], 
                                            intend);
                              
                              g.rotate(arcPos, [a[2] / 2, a[3] / 2]);
                              g.setColour(obj.textColour);
                              g.drawLine(width/2, height/2, intend - stroke + width/2, height - stroke, 4.0);
                          });
                          
                          1 Reply Last reply Reply Quote 2
                          • ustkU
                            ustk @d.healey
                            last edited by

                            @d-healey Sorry but I don't understand what was the problem... Everything seems fine here...

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

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

                              @ustk If you use it with the attack knob of an ADSR for example the skew is totally off.

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

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

                                Oops I thought you were talking about the center point of the circle :)

                                I think the obj.value should be normalized (or at least an obj.normalisedValue should be added) that takes the skew factor into account.

                                ustkU 1 Reply Last reply Reply Quote 1
                                • ustkU
                                  ustk @Christoph Hart
                                  last edited by ustk

                                  @Christoph-Hart @d-healey There's a valueNormalized but I might have made a mistake (or not), so this is where obj.skew might help.
                                  This is the formula of the valueNormalized I've made:

                                  (s.getValue() - s.getMinimum()) / (s.getMaximum() - s.getMinimum())
                                  

                                  so this doesn't take the skew factor, hence 0.5 isn't the middlePosition of 1,000, but half the range (10,000 in the case of a 0-20,000 time knob)

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

                                  1 Reply Last reply Reply Quote 0
                                  • ustkU
                                    ustk @d.healey
                                    last edited by ustk

                                    @d-healey @Christoph-Hart This is what you want, but since it complicates too much the formula, I should either add a valueNormalizedWithSkew, or modify the existing valueNormalized... ?

                                    laf.registerFunction("drawRotarySlider", function(g, obj)
                                    {
                                        var a = obj.area;
                                        var width = obj.area[2];
                                        var height = obj.area[3];
                                        var stroke = 3;
                                        var mark = 4;
                                        var startOffset = 2.5;
                                        
                                        var valueNormalizedWithSkew = Math.pow(10, (Math.log10(obj.valueNormalized) / (1/obj.skew)));
                                        
                                        var endOffset = 5 * valueNormalizedWithSkew - startOffset;
                                    
                                        Console.print(obj.skew);
                                        g.setColour(obj.itemColour1);
                                        g.fillEllipse(a);
                                    
                                        g.setColour(obj.itemColour2);
                                        g.drawEllipse([stroke / 2, stroke / 2, width - stroke, height - stroke], stroke);
                                    
                                        g.rotate(endOffset, [a[2] / 2, a[2] / 2]);
                                    
                                        g.setColour(obj.textColour);
                                        g.fillRoundedRectangle([width / 2 - mark / 2, 0, mark, height / 2.5], 1.5);
                                    });
                                    

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

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

                                      Yeah, valueNormalised should definitely include the "deskewing", otherwise you can just use the normal value.

                                      ustkU 1 Reply Last reply Reply Quote 2
                                      • ustkU
                                        ustk @Christoph Hart
                                        last edited by

                                        @Christoph-Hart Alright, correcting... 😉

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

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

                                          @Christoph-Hart @d-healey that's fixed and pushed, so you can now do this:

                                          laf.registerFunction("drawRotarySlider", function(g, obj)
                                          {
                                              var a = obj.area;
                                              var width = obj.area[2];
                                              var height = obj.area[3];
                                              var stroke = 3;
                                              var mark = 4;
                                              var startOffset = 2.5;
                                              var endOffset = 5 * obj.valueNormalized - startOffset;
                                          
                                              g.setColour(obj.itemColour1);
                                              g.fillEllipse(a);
                                          
                                              g.rotate(endOffset, [a[2] / 2, a[2] / 2]);
                                          
                                              g.setColour(obj.textColour);
                                              g.fillRoundedRectangle([width / 2 - mark / 2, 0, mark, height / 2.5], 1.5);
                                          });
                                          

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

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

                                            @ustk Woohoo! Thank you both!

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

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

                                            14

                                            Online

                                            1.7k

                                            Users

                                            11.8k

                                            Topics

                                            102.6k

                                            Posts