HISE Logo Forum
    • Categories
    • Register
    • Login

    LAF SliderPack Bug

    Scheduled Pinned Locked Moved Unsolved General Questions
    35 Posts 5 Posters 1.5k 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.
    • DanHD
      DanH @ulrik
      last edited by

      @ulrik ah ok, I think I get it now, thanks

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

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

        @ulrik Use Content.getAllComponents instead. This will return an array, just use the first element.

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

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

          However I'm not sure it's a good idea to use "Content.getComponent" from inside a LAF, someone else have to respond to that.

          Nope, bad idea. The paint call should be as fast as possible and getComponent() and especially getAllComponents() should be avoided as it has to iterate over all components and find the one with the matching id. If you have less than 50-100 components this might be OK, but for bigger projects it's recommend to create a reference on init and then use this instead. If you have multiple sliderpacks, you can create a JSON object with the id as key:

          const var SliderPacks =
          {
            "SliderPack1": Content.getComponent("SliderPack1"),
            "SliderPack2": Content.getComponent("SliderPack2")
          };
          
          function drawRotarySlider(g, obj)
          {
              var numSliders = SliderPacks[obj.parentName].getNumSliders();
          }
          
          DanHD 1 Reply Last reply Reply Quote 2
          • DanHD
            DanH @Christoph Hart
            last edited by

            @Christoph-Hart Thanks, I'm still struggling to understand how to implement this into that code.... :face_with_tears_of_joy:

            	// linear interpolate each slider
            	// unfortunately you have to hardcode the slider amount
            	// (if it's dynamic, use obj.parentName to fetch the parent slider pack)
            	var c = Colours.mix(l, r, parseInt(obj.Arpeggiator1) / 16); // this is normally parseInt(obj.id)
            
            	g.setColour(c);
            

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

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

              @DanH Console.print(trace(obj)); Will show you all of the data that is available to you in the obj object.

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

              DanHD 1 Reply Last reply Reply Quote 0
              • DanHD
                DanH @d.healey
                last edited by

                @d-healey what am I looking for? I was hoping something like this might work

                	// linear interpolate each slider
                	// unfortunately you have to hardcode the slider amount
                	// (if it's dynamic, use obj.parentName to fetch the parent slider pack)
                	var c = Colours.mix(l, r, parseInt(obj.parentName) / numSliders); 
                
                	g.setColour(c);
                

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

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

                  @DanH obj.parentName is a string (the I'd of the parent control) why are you trying to convert that to a number? Use Console.print everywhere to figure out what the code you're writing is doing.

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

                  DanHD 1 Reply Last reply Reply Quote 0
                  • DanHD
                    DanH @d.healey
                    last edited by

                    @d-healey I'm not.... Maybe this doesn't make sense without context...

                    
                    const var SliderPacks =
                    {
                      "SliderPack4": Content.getComponent("SliderPack4"),
                      "SliderPack5": Content.getComponent("SliderPack5")
                    };
                    
                    function drawRotarySlider(g, obj)
                    {
                        var numSliders = SliderPacks[obj.parentName].getNumSliders();
                    }
                    
                    SPLAF.registerFunction("drawLinearSlider", function(g, obj)
                    {
                    	// ID is the number of the slider
                    	var a = obj.area;
                    	var v = obj.valueNormalized;
                    	var l = 0x7FE903D9;
                    	var r = 0xA502A3A3;
                    		
                    	g.setColour(0x7302A3A3);
                    	g.drawHorizontalLine(a[3] / 2, a[0], a[2]);
                    	
                    	// linear interpolate each slider
                    	// unfortunately you have to hardcode the slider amount
                    	// (if it's dynamic, use obj.parentName to fetch the parent slider pack)
                    	var c = Colours.mix(l, r, parseInt(obj.id) / 16);
                    
                    	g.setColour(c);
                    	
                    	if (v >= 1)
                    	{
                    		a[1] = a[1] + a[3] / 2 * (1.0 - v);
                    		a[3] = a[3] / 2 - a[1];
                    	}		
                    	else
                    	{
                    		a[1] = a[3] / 2;
                    		a[3] = a[3] / 2 - a[3] / 2 * (2.0 * v);
                    	}
                    
                    	g.fillRect(a);
                    
                    });
                    

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

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

                      @DanH are you trying to get the index in an array?

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

                      DanHD 1 Reply Last reply Reply Quote 0
                      • DanHD
                        DanH @d.healey
                        last edited by

                        @d-healey ok let's rewind a bit, this is the line I don't understand:

                        // (if it's dynamic, use obj.parentName to fetch the parent slider pack)
                        

                        Am I supposed to replace obj.id with obj.parentName? And don't I also need to replace the number of sliders with something dynamic?

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

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

                          @DanH The 16 is hardcoded in this example.

                          var c = Colours.mix(l, r, parseInt(obj.id) / SliderPacks[obj.parentName].getNumSliders());
                          

                          @d-healey If you're using drawLinearSlider to paint SliderPacks, the id property will just contain the slider index so it's valid to parseInt() that bad boy...

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

                            @Christoph-Hart Thanks! - still a bit janky, however!

                            HiseSnippet 1760.3ocwX01SabDD9LvQqcJMPZj5WWwGZMINN1.kl1HZrM1j3FCXESnQBghV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FKyxW9ZqnyZ32F5K0b.LIzeVrjl6fzjQWEvLmd3Na9qsrP2+A4MLtbcVcJzYsoPm0mBc9goPmMlBc9woPmGcs5fegvhgJoWT5.vndE88dRjHpAr9Tnw+16qWeJ
                            

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

                            1 Reply Last reply Reply Quote 0
                            • ?
                              A Former User
                              last edited by

                              Has the bipolar fix been merged yet? Just noticed this on my arp sliderpack

                              DanHD 1 Reply Last reply Reply Quote 0
                              • DanHD
                                DanH @A Former User
                                last edited by

                                @iamlamprey no but see the snippet for a workaround in laf

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

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

                                  Need some help with this LAF. Trying to draw the rectangle with drawRect on a bipolar SliderPack (+/- 24) and it will only draw on the + side when the Slider hits the max value (24). The - side is fine, as in the uni-directional SliderPack below... Thanks!!

                                  Screenshot 2022-10-07 at 10.27.44.png

                                  HiseSnippet 1307.3ocsW0rbaaCDFTwzSoRSmlN8TOgwmjSTTnjr7OSlzZY8iiScrThbRsGOdx.QBIgXR.URHYqzwuA8de.5KRO1Gm9Fjt.TRjxV10VyTdfh6t3C3aWrXwplABGZXnH.YXc3n9TjwWa1ZDW1qROBii1qJx3aLeCITRCvQp1YTeRXH0EYX7fcUJLrVBoe9meZGhGg6PiUgPePvbn6y7YxXsM29mYdd0ItzCY9IF8ZaumifWQ3IF.74Al1n9DmyHcoGPTCKkIxX4ZtLoHnkjHogvX1Q3NpUOw47nw+AVHqsGUIjG0BlnH0nJ8XdtMm3qgHjwRMi87GD44eu4aXtro5ii.eq1.NFQxXfQpaiR4uGTxHAkVJhRO1rkS.quL1hhOOzbONrgzg.g5jTIZrnT+foYEALBtLmO4LZ8.PXJhLqaamECuV8EoSCg6PIdHI.2xi4RCZB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PE2XBtjY8iVzFL+OV92IFHY7tugHCXPdf4AC7aAoUNTX04b39Z09cJUtUjrsRVEAZQ4tZgu.OiMlWIaL1X9IFQ9Dm.wGchpdn5p8qzZ.Nw0MwaA+aBPFmeZwBS6b1HenA6O53nb+mA0OmOlBK.lhK.l0V.LkV.Lqu.X1XAvr4shQ8eaJOPJ7iNN.JZVSWV0vnFm.YV5rPz+NhzdOO
                                  

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

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

                                    @DanH encountering a similar issue with this snippet. Only works if the slider is at max value on the + side... Really strange as this has been working fine for weeks and I haven't touched it!
                                    Screenshot 2022-11-22 at 17.45.50.png

                                    HiseSnippet 1112.3ocsV0uSiaDDeMfqpc6U0q5d.VweYNBFGBkODh1P9hx0.jdg6NjhPmVr2D1C6ciVuIPtS7t0Go9FzNqsC1vEN0F0KxxQyG+142N6Ly5NRgOMNVHQFVmMYHEY78lcmvUWU+JBiiNpAx3GLOlDqnRbppZSFRhioAHCiEOTqvvZITxu+5WqQBIbeZtJD5sBlOsMKhox01o5uyBCaQBnmwhJ38lUOxWvqKBEi.9rnoGZHw+Zx.5IDsaKXhL9llALkP1UQTzXjwR0DAS5dk3Fdp+ukEytLjpEJi5BKTp5Vhv.Mi0ZQ0uhEFzY59NFAqRm7rvhoYgWXdLKfcu97rwOlX.minX9vXgGRuEe.8JWjddEn2LnjQAJsTJkdtYWeIanJ2hlOem4Qb3voOAR6EoRpunEBWzrt.7fqbiHWSaIAg6Q3rkmWIL7Zk8rsgTerBOlHwc6z9fV38wSA5Kov9osvmD1VHt9.dPKJMzA.U.SHKfJ6.mWkKfb.UUWDMTvAAmkK3yx5HZamDIWIc.SWg0ZD2WwDbmkCjjaZy3ThLEyxkv8mZbPIr3xOrh8mrsszQl.wCT3R.VtWppwYpFSBGQOQHiHgrORCfPZMvMVyIcIli2saWwaiCpbPEfMfEcT+Mgj8Qf8vVEhuCoWkKvqi2nDlzy6B86MtPScK3g0G6LF+K6iKuhs0mrsrH8JeAD4j+VEOEJ9kXmxtd30vi0gwJQ+94lWKA.X4NKKaKZXL8QqVpeOEz7frADjWlFj6x1nGJIALH22B52b54cay5o62R3xvAu947sa0bWuJM1MUUYOuKRSF8AHul5qbHZ4Gk3Ne5Bkm3dsXDGZxzPH7AgTmomIIwor1w0WOyU8xlaVay9N8qBEH5n8YUbIkKqr2zRArfehPQOk6nqFrruyF+XS86OSa55SoHLjJmoY8XI4WBnCeTzkTYIbRE18NB8pOb.f4SO.n37I+z1kBNJ3GwYpSGR4O0TKTVOldXQFqfvqRFU7SYiJxymHFLU3YlERvnDpmO78EUCHJBxnm4Va5tCerm6MdrZMZ355dVmD4lu6zW41Fja2QdXS0piCNqxt025OFLYj1U2C012lU6cqNpoJ3CIx0t7zWc4NiR72EgdyQMzAIix.6gczPpTwzIKiFzwvkEoS6rLaPiuVIFl3a1HDX9++gM3s4aNZ0I2KzQUMp30VN+YDofqNUQe9rWXpuHXTHQ8vqBz2+kY.JOdv7W8LVdLSMo38i+uc+v+VJ9byNLk+UyliKLCNBGMeM3X1spOyrY+9PyeNAWxr04ectBEACjTL9fiIJICNeMOYTTWX3kOEhNmCyYAcFKnajRk8zx5LPWJOHQ3ugeYFKqkMxLVdpQTDwWJdueZ6m9d6uMQCvIdxmrXAe6DHiuuayzzy0CEAeBw6880a+0fd6YiYi4.Sk4.ylyAledNvr0bfY64.yNeQL5ud6fQJQTZ6.nnSyjYRFFM4DnxJoJD8Or4D+2J
                                    

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

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

                                      @DanH works here, I'm on develop branch from Nov 15, 2022

                                      lafsp.gif

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

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

                                        @ulrik Thanks - yes worked on my other machine too, weird! Got round it by using fillRoundedRectangle with 0 corners...

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

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

                                        20

                                        Online

                                        1.8k

                                        Users

                                        12.0k

                                        Topics

                                        104.3k

                                        Posts