HISE Logo Forum
    • Categories
    • Register
    • Login

    Another Random Button with Lock Feature [Solved]

    Scheduled Pinned Locked Moved Scripting
    20 Posts 2 Posters 719 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.
    • LindonL
      Lindon @Natan
      last edited by

      @Natan

      like this?

      inline function onRandomizerControl(component, value)
      {
      
      	local idx = AllRandomizerButtons.indexOf(component);
      	
      	if(!value)
      		return;
      	if(AllBypassButtons[idx].getValue()== 1)
      	    return;	
      	    
      	for (i = 0; i < 2; i++)
      	    {
      			
      			if(AllLockButtons[idx].getValue()== 0)
      			{
      				AllFxKnobs[idx].setValue(Math.randInt(0, 100));
      				AllFxKnobs[idx].changed();			
      			}
      	
      }
      }// End Of inline function onRandomizerControl
      

      HISE Development for hire.
      www.channelrobot.com

      NatanN 2 Replies Last reply Reply Quote 0
      • NatanN
        Natan @Lindon
        last edited by

        @Lindon Thanks Mate, Its Close,

        Here is The Scenario:

        First Randomize Looks at Lock Button

        • If Lock Enabled It gets Blocked,
          and Does Nothing.

        If Lock Disabled, Bypass will get Randomized (0,2)
        Now if The result is BypassButtons == 1
        now Fx Knob GEts Randomied.

        It makes sense?

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

          @Lindon

          This is it:

          inline function onRandomizerControl(component, value)
          {
          
          	local idx = AllRandomizerButtons.indexOf(component);
          	
          	if(!value)
          		return;
          		
          	if(AllLockButtons[idx].getValue()== 1)
          	    return;	
          	 
          	 
          	AllBypassButtons[idx].setValue(Math.randInt(0, 2));
          	AllBypassButtons[idx].changed();
           
          	for (i = 0; i < 2; i++)
          	    {
          			
          			if(AllBypassButtons[idx].getValue()== 1)
          			{
          				AllFxKnobs[idx].setValue(Math.randInt(0, 100));
          				AllFxKnobs[idx].changed();			
          			}
          	
          }
          }// End Of inline function onRandomizerControl
          
          LindonL 1 Reply Last reply Reply Quote 0
          • LindonL
            Lindon @Natan
            last edited by

            @Natan said in Another Random Button with Lock Feature:

            inline function onRandomizerControl(component, value)
            {

            local idx = AllRandomizerButtons.indexOf(component);

            if(!value)
            return;

            if(AllLockButtons[idx].getValue()== 1)
            return;

            AllBypassButtons[idx].setValue(Math.randInt(0, 2));
            AllBypassButtons[idx].changed();

            for (i = 0; i < 2; i++)
            {

              	if(AllBypassButtons[idx].getValue()== 1)
              	{
              		AllFxKnobs[idx].setValue(Math.randInt(0, 100));
              		AllFxKnobs[idx].changed();			
              	}
            

            }
            }// End Of inline function onRandomizerControl

            ..possibly slightly better(cleaner approach)

            inline function onRandomizerControl(component, value)
            {
            
            	local idx = AllRandomizerButtons.indexOf(component);
            	
            	if(!value)
            		return;
            		
            	if(AllLockButtons[idx].getValue()== 1)
            	    return;	
            	 
            	 
            	AllBypassButtons[idx].setValue(Math.randInt(0, 2));
            	AllBypassButtons[idx].changed();
             
                   if(AllBypassButtons[idx].getValue()== 1)
                         return;
            
            	AllFxKnobs[idx].setValue(Math.randInt(0, 100));
            	AllFxKnobs[idx].changed();			
            	
            }
            }// End Of inline function onRandomizerControl
            

            HISE Development for hire.
            www.channelrobot.com

            NatanN 2 Replies Last reply Reply Quote 0
            • NatanN
              Natan @Lindon
              last edited by

              @Lindon Cheers Man, I Want the FX Kob Do not move if The Bypass enabled!

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

                @Lindon
                Is This Correct

                inline function onRandomizerControl(component, value)
                {
                
                	local idx = AllRandomizerButtons.indexOf(component);
                	
                	if(!value)
                		return;
                		
                	if(AllLockButtons[idx].getValue()== 1)
                	    return;	
                	 
                	 
                	AllBypassButtons[idx].setValue(Math.randInt(0, 2));
                	AllBypassButtons[idx].changed();
                 
                       if(AllBypassButtons[idx].getValue()== 0) // Now Knob Wont move, Right?
                             return;
                
                	AllFxKnobs[idx].setValue(Math.randInt(0, 100));
                	AllFxKnobs[idx].changed();			
                	
                }
                }// End Of inline function onRandomizerControl
                
                1 Reply Last reply Reply Quote 0
                • LindonL
                  Lindon @Natan
                  last edited by Lindon

                  @Natan said in Another Random Button with Lock Feature:

                  @Lindon Cheers Man, I Want the FX Kob Do not move if The Bypass enabled!

                  thats exactly what this says:

                  if(AllBypassButtons[idx].getValue()== 1) //<--if the bypass button is ON
                  return; //<--- leave....

                  HISE Development for hire.
                  www.channelrobot.com

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

                    @Lindon Exactly, My Bad, The LED on Button got me

                    Lindon, Mate, What about The GODRandomizer?!
                    You hane any lines

                    LindonL 1 Reply Last reply Reply Quote 0
                    • LindonL
                      Lindon @Natan
                      last edited by

                      @Natan Im sure you can work that out from the code you have...

                      HISE Development for hire.
                      www.channelrobot.com

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

                        @Lindon
                        Its Not Blinks
                        Does the Job But it is Dirty

                        inline function onGodRandomizerControl(component, value)
                        {
                        	
                        	if(!value)
                        		return;
                        	
                        
                        	for (i = 0; i < 2; i++)
                        	    {
                        			AllRandomizerButtons[i].setValue(value);
                        			AllRandomizerButtons[i].changed();
                         	}	
                        		
                        };
                        
                        Content.getComponent("GodRandomizer").setControlCallback(onGodRandomizerControl);
                        
                        LindonL 1 Reply Last reply Reply Quote 0
                        • LindonL
                          Lindon @Natan
                          last edited by

                          @Natan said in Another Random Button with Lock Feature:

                          @Lindon
                          Its Not Blinks
                          Does the Job But it is Dirty

                          inline function onGodRandomizerControl(component, value)
                          {
                          	
                          	if(!value)
                          		return;
                          	
                          
                          	for (i = 0; i < 2; i++)
                          	    {
                          			AllRandomizerButtons[i].setValue(value);
                          			AllRandomizerButtons[i].changed();
                           	}	
                          		
                          };
                          
                          Content.getComponent("GodRandomizer").setControlCallback(onGodRandomizerControl);
                          

                          its just too fast to see the blink... whats dirty about this code?

                          HISE Development for hire.
                          www.channelrobot.com

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

                            @Lindon Both Randomizers Gets stucked ON!
                            I want them to Blink

                            LindonL 1 Reply Last reply Reply Quote 0
                            • LindonL
                              Lindon @Natan
                              last edited by

                              @Natan said in Another Random Button with Lock Feature:

                              @Lindon Both Randomizers Gets stucked ON!
                              I want them to Blink

                              think about it...

                              	for (i = 0; i < 2; i++)
                              	    {
                              			AllRandomizerButtons[i].setValue(1);
                              			AllRandomizerButtons[i].changed();
                              			AllRandomizerButtons[i].setValue(0);
                               	}
                              

                              HISE Development for hire.
                              www.channelrobot.com

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

                                @Lindon said in Another Random Button with Lock Feature:

                                for (i = 0; i < 2; i++)
                                {
                                AllRandomizerButtons[i].setValue(1);
                                AllRandomizerButtons[i].changed();
                                AllRandomizerButtons[i].setValue(0);
                                }

                                Thank you So Much

                                Job Done 🤝 🙌

                                HiseSnippet 1275.3ocuW0naaaCDlJIJqxcoaEXO.bEX.1Hco1dccCvKXtwwNvn4Gi5r1MTjUvHQGSDIRCJpT6UDf8n0Go8FrcTR1RxQxwwHcpMAg79669g730SJro99BIxv5zIinHiuzr+DtZXqgDFG0cejwiLOh3qnRbzV6MYDw2m5fLLV+.8FFVafB+9mecOhKgaSS1BgdifYSOj4wTI61q4qXttcHNzSYdo394M6ZK3sDth..OqaVEMhXeI4B5wDMaqYhL1rsCSIj8UDE0GYrwdBmI8GJ9.Oh+2v7Ym6R0Kpg5CJJZ6NBWGMh06hZMj45zape6i.szKIJrdTT3aLOh4vlseRz3qCIfSjHc7vXsrva8LvqVZ3UME7xARFofzFQP5wl8skrQpDJZ77PytbH4Lf.g8zPIhWzZGroYKAvAWsiG4RZGIrXlDkeQ0pOEC+pRiRkJAwdeE9JBjoEAb0oePf2EWuQZBuz080Dtivi8WT4dAJEPACb8tyZjkqCE1WNiddLDg0EohNieEWb9LZoHdfvIAE.4oN3ETUKg2HAGVT9IY35Igd3.gDWlART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AYd9JHyOtBx7hUPleZEj4mWnL51HuLPI7hNN.azqcXOeCi1g8YBqBQ+Wal+Ox
                                
                                1 Reply Last reply Reply Quote 0
                                • NatanN
                                  Natan
                                  last edited by Natan

                                  @Lindon Mate, Let's Say we have another set of Bypass and Mix Knobs!
                                  I Followed the same instructor, and It Kinda Buggy, and Blockes the second Set of Controls!

                                  Please take a Look:

                                  HiseSnippet 1422.3ocuX80aaaCDmJIZs1stqEXOtG3Jv.rQ5Rs8551fWQcy+JLZShQca1FJxJXjniIhLoAEUqyJJv9brOM8Cv9vzW2SaGkjknrkcjMZqRhQHu62c+tiGoNytRgC02WHQVkd9EinHqqa26BtZvNCHLNpytHqaXe.wWQk3no19hQDeepKxxZ8GqmvpzFnvmO7vsIdDtCMcJD5XAyg9T1PlJc1tseByyaehK84rgFZeu1cbD7cDdh.fOqaWGMh3bN4L5gDsZqYir9h8bYJgrmhnn9HqM1V3dQuAh2viz+XlO6TOpdPCTOvPQSuuvyUyX8rncFv7b6NIt8QfU5llEVOJK7U1GvbYIymlMtYn.bJBy7g0ZYo25YnWCS5U2fd4PIKCJsQDktkcOGIajJUhlOWytCGVb5SfztIUhzEs1+dE6cDfFb0VCImS2WBCRPT890qeGL7QsVkKWFx89J7qIvJsHfqd9aD3Gfa1xTvi77dFg6JFx9Spb6.kBjfAsd4Isxp0SENmmHOOEh35hLw9ieBWbZhrrBOP3tHrf3CXg3yA9iEtoAAHdR94LpZGwvQBNLn5syn0sCSP8ERbUFfndKLC+KIoIXzlaVq7aKWJu7yKYmfmqWLbAdSv3a1nF3p4Yms70f4JovaGhm2ovtipBdplwxzVP+S10gExCsdSyfLKQKD89iizcZKDuDdIX05jAYH1zU3EBWqVt9NsD3xvCpk08uCVqKy3dLNE2Of6nXBNVvyTQDmpq5LwT2Aps7BngkAkKw5W8ahFWoboRRpJPxaA+K76zUQMiJe.IvNE7a05un0+i0VsZiZsVnhNCH7yntUuD0RrWcsh3RuCnND+sJWn8D4WNlWZJb6Sd4zBjPqTFxIPT3IbHdXl6XH0kW7rEi6RGeT+TKTKNiOuEiXYSuMwc7I53NJwT6AO.2XxhSLTMNb7eytOQCOIud.QMXKIPU3L2pvYsMqERp7QYtnA1FG8DwvbTeFNhMeRByJY2JtP50.dUvDBlAQJ0Jkb1h4NzKMnyEQpUgjYTJNIfmV2oh1DsyDsoLKYueAh2bwXDwgEJUzGK.eb26h2i6pSqQOFEyGJTzi3UiNB3ckwSKpe+bkEW46Qk4JV2ijbQ.qxCFdJUl4.HPQnwgrciXO+tQLaVxIZqughBdGNSczHJedsPghOu.5bobLq.UUg8sbi39VhVMQLn8jqXq2v0.ERXytEQEFbyoA+gGVDvWydx6pR7tsUQ8bJ3lKA064wboxPCTxNZSkgu+5kD5zd9u901Eg5W2N4EkFN2pfAtA5UNxi1eY37edIglmmeQmcIJhte43BPnnbDUpX55cqcouF9xGQcOWxdWp+4JwHjUkj2nAESyMl+R6LuHCMN0wr1WjN3OZ6SdMsCuqjBGyna8lxIv1J8WS3oThjqmh4efXH3PhDPZsFpPLnhcp6aX5+e2v+u+rOK9uog+eu7io+23ROkXNQNh2dYrybifBaGyyNlCmvxk1VykWSYqqVfSUlCqZGz1Onee1X8w2eKZHy00i1U3yzuGIERm1CIYr.7s9G0CV8m5P1kfRyM39TQoMJ1IfSmnrs9aqvSiVNCMa3MqgtZANSbV57OfU9rulM4b1YCpOtzY1613lZeG3QTYupE88KEKP6Fy62PeGFbv8WXZ4OZ2+RQo3sr6xTNCxmiqkCGgWU8ofiw2ZUE6852m5nRI3F16+aeZthJzyDAJF+LnkZotrv9vfg8DARGJ3cNm5o63DNpWCMbb8IsZ0ixcCG7evSrvFSZGQKrwDgngDGo3UNQMInuWrqFNCvId3UBB0r5w3z1JrquUcc4I6UNN5v+6f1UyGSyU.y2uBXt2Jf4GVAL2eEv7iq.leZgXzu1+QAJwvnsCvDc2KrGMKq8B6KHrJD8+PpfjBF
                                  
                                  inline function onRandomizerControl(component, value)
                                  {
                                  
                                  	local idx = AllRandomizerButtons.indexOf(component);
                                  	
                                  	if(!value)
                                  		return;
                                  		
                                  	if(AllLockButtons[idx].getValue()== 1)
                                  	    return;	
                                  	 
                                  	 // First Set
                                  	AllBypassButtons[idx].setValue(Math.randInt(0, 2));
                                  	AllBypassButtons[idx].changed();
                                   
                                         if(AllBypassButtons[idx].getValue()== 1)
                                               return;
                                  
                                  	AllFxKnobs[idx].setValue(Math.randInt(0, 100));
                                  	AllFxKnobs[idx].changed();	
                                  	
                                  	// Second Set
                                  	AllModButtons[idx].setValue(Math.randInt(0, 2));
                                  	AllModButtons[idx].changed();
                                  	 
                                  	       if(AllModButtons[idx].getValue()== 1)
                                  	             return;
                                  	
                                  	AllModMixKnob[idx].setValue(Math.randInt(0, 100));
                                  	AllModMixKnob[idx].changed();			
                                  	
                                  }
                                  
                                  LindonL 1 Reply Last reply Reply Quote 0
                                  • LindonL
                                    Lindon @Natan
                                    last edited by Lindon

                                    @Natan said in Another Random Button with Lock Feature [Solved]:

                                    Then you will have to invert the logic....

                                    inline function onRandomizerControl(component, value)
                                    {
                                    
                                    	local idx = AllRandomizerButtons.indexOf(component);
                                    	
                                    	if(!value)
                                    		return;
                                    		
                                    	if(AllLockButtons[idx].getValue()== 1)
                                    	    return;	
                                    	 
                                    	 
                                    	AllBypassButtons[idx].setValue(Math.randInt(0, 2));
                                    	AllBypassButtons[idx].changed();
                                     
                                        if(AllBypassButtons[idx].getValue()== 0)
                                        {
                                    		AllFxKnobs[idx].setValue(Math.randInt(0, 100));
                                    		AllFxKnobs[idx].changed();	
                                    	};
                                    	
                                    	AllModButtons[idx].setValue(Math.randInt(0, 2));
                                    	AllModButtons[idx].changed();
                                    	 
                                    	if(AllModButtons[idx].getValue()== 0)
                                    	{           
                                    		AllModMixKnob[idx].setValue(Math.randInt(0, 100));
                                    		AllModMixKnob[idx].changed();
                                    	};			
                                    	
                                    }
                                    

                                    HISE Development for hire.
                                    www.channelrobot.com

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

                                      @Lindon Amazing
                                      Well done Mate
                                      :folded_hands:

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

                                        Final Snippet:

                                        HiseSnippet 1402.3ocuX0naaaCDlJIZMVstqEXO.ZEX.1KcA1dccCvKXt4uNileLpyJZQQWGiDcLQjIMnnRsWVdW1iReJ1ywdC1NJIaQ4J4HajTmffHd22ce2w6nNyNBtCw2mKPFkNY7PBx3dlcGyj82oOlxPs2EYbeyCw9RhvNZosGOD66SbQFFq9b0BFkVCE94e+kswdXlCIYID5UbpC4.5.pLY0NsdA0yaerK4D5.MseRq1Nb1NbOd.vmUMqgFhcNGeF4HrRsULQFewdtTIWzUhkDejwZaycG2sO+CrH8eE0mdpGQ8PcTWvPQKuO2yUwX0pnc5S8b6LIt8QfU5jjEVMJK7UlGRcoSWOIa7fPA1IHzyGFqjldqlhd00oWMM5kAkLznzZQT5glccDzgxDIJ9bWy1LXyoGFR65TIRWzJ+ycL2gCZvjaN.eNYeA7vTDUdZsZO1F9S0lVVVPt2WZeAF1o4AL4Iefaukcil5Bdlm2KwLW9.5eRDaGHkfDaPq29tlo05.ty4SkmkBQbcdlX+QufwOcprzBOj6NOrf3Cog3y.9y4tIAAHdR94LhbG9fgbF7PkGkRqGElf5wE1Un.hZMso1+7zzD7zFaT05RqRYkedK8c145EMWXuAX7MpWEbUd1YSeEXlTv81A64cJzcTgyRzLVlxBpeRuOLWdnzaVFjZKZtn2eTjtyZg3svqAqRmTHCwlrCOW3J0xz2Ik.WGdPszt+JXu1hx7nLhcu.lijxY1bVpJh3TcEmIl5wPskW.IrLvpDsWkuN54xVkJIHx.AqI7uvuyVE0Hp7Aj.cJ1Wpzed6+uRY0J0q1btJ5zGyNi3V4ZTap8poTztzU.0g3uoUg5IxtbLqzTX6SV4zBjPKaA4DHJ73NXOap6HH0kU7rIk4RFcbuDKTMNim2lQrrYaSbG8NUbGkXpt0V10mr4DCUgyF9sbVsIJzSSqGhk82T.LENxsBbTaipgbJaT56YfsUNLhcYnaJ9UqZj1g0N5scykK0gi8iJOlERBQTQ5UwYwY5IKXbNKjTEl1S2.lUsOI9JcocxmXRq2hW7PcVToXzUMKEVVT15pxpS7SpTOhKIGypD0eekk8rh50KSYwk0dDQlhUC.IlGvJrfAmRDoNcATDlJH8nFl4Opg9jPNQ80ZJxYsYT4wCIr7lOBEeX.LVhULq.UkgCkb+3gRh17PTX1i6Xp5lpiBIr9nfnBCtwxA9tlSdQzTuaZXrvfaTPvc8ntDQH3RlQMPZ98WWPnZd8aKHkum4z29sDArFZMeiJLsi5izb7aVPnZd8OTP+s16hkX0vuwEbPQ3PhPRU02F6Rt.9lDQiBWxbWh+4R9PjQ4oudBJdxMV+RyTuUBMJozh1ZbxC+dKe7Ej1rNBBbXhZNZBCCsQpY9OffEL0RT+C4C.GhE.RiUPEhAkMSbecc++FM++wy9r3+FZ9+ihaR+u10dpPNQNh0ZQrStQPgsi9YE4vIawBaqb40L1Z8BbRRNrpUPK+fd8niTGW+MnATWWORGtOU8diDHsaM.mxBvWgeXWX2W+6quXTJ2f61hRqUrS9xIQ82iasvFK2PbFisdANWLud7+5y+92jyayqs+ljRe5EW7.k+C7vxz2ih5xihEnbi9kWntfBF39w5V9F6xUJJEenYGpzoe1bbkL3H7pqaCNFekTkM2qWOhiLgfqYt+quct+IzK4ARJ6LXPZgprv7nfAc4ABGB3cFi3ol3DN5WAM74ZSlcnKg4F9v+AehEVexXIJg0mHDM.6H3u2IZfA0kdsd3J.mXg22GT2pd1NYDCyZaVSUdReuiiJ7+NXb0rwzXIv78KAlmrDX9gk.ySWBL+3Rf4mlKF0X.OKPxGD0N.KzYuvY1LL1KbNgvpPz+C9ikH0A
                                        
                                        1 Reply Last reply Reply Quote 0
                                        • First post
                                          Last post

                                        9

                                        Online

                                        1.7k

                                        Users

                                        11.8k

                                        Topics

                                        102.4k

                                        Posts