HISE Logo Forum
    • Categories
    • Register
    • Login

    Print array index

    Scheduled Pinned Locked Moved Scripting
    19 Posts 3 Posters 1.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.
    • Dan KorneffD
      Dan Korneff @Christoph Hart
      last edited by

      @christoph-hart thank you!
      More noob questions on the way.... although I'm trying to figure them out on my own :)

      1 Reply Last reply Reply Quote 0
      • Dan KorneffD
        Dan Korneff
        last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • Dan KorneffD
          Dan Korneff
          last edited by

          I'm trying to get familiar with using an index to show/hide controls, but it's not clicking in my brain yet... Also my first time using radiogroups.
          As a test, I have a simple instrument with 2 samplers. The user interface has buttons (in radiogroup) to select each sampler, and a second set of buttons (in separate radiogroup) to show/hide controls of the samplers.

          0_1534634825552_simp.png

          All buttons have been put into associated arrays, I've created a Callback function for the buttons, and I'm using the onControl section to show/hide content.

          What I'm attempting to do is use the index of my SamplerSelectButtonArray to show/hide knobs in the GainSliderArray or PanSliderArray.
          Any thoughts are appreciated.

          Content.makeFrontInterface(500, 300);
          
          const var Sampler = Content.getComponent("Sampler");
          const var Sampler2 = Content.getComponent("Sampler2");
          const var Gain = Content.getComponent("Gain");
          const var Pan = Content.getComponent("Pan");
          const var SamplerGain = Content.getComponent("SamplerGain");
          const var SamplerPan = Content.getComponent("SamplerPan");
          const var Sampler2Gain = Content.getComponent("Sampler2Gain");
          const var Sampler2Pan = Content.getComponent("Sampler2Pan");
          
          //create arrays
          
          const var SamplerSelectButtonArray =      [
                                                  Content.getComponent("Sampler"),
                                                  Content.getComponent("Sampler2")
                                              ];
                                         
          const var ControlSelectButtonArray = [
                                                  Content.getComponent("Gain"),
                                                  Content.getComponent("Pan")
                                              ];
                                         
          const var GainSliderArray =         [
                                                  Content.getComponent("SamplerGain"),
                                                  Content.getComponent("Sampler2Gain")
                                              ];
                                              
          const var PanSliderArray =         [
                                                  Content.getComponent("SamplerPan"),
                                                  Content.getComponent("Sampler2Pan")
                                              ];
                                              
                                     
          inline function buttonCallback(component, value)
          {
              if(value)
              {
                  local index = SamplerSelectButtonArray.indexOf(component);
                      var y = ControlSelectButtonArray.indexOf(component);
                      
                  Console.print(index);
                  Console.print(y);
              }
          }
          
          
          for(a in SamplerSelectButtonArray)
              a.setControlCallback(buttonCallback);
              
          for(a in ControlSelectButtonArray)
              a.setControlCallback(buttonCallback);
          function onNoteOn()
          {
          	
          }
          function onNoteOff()
          {
          	
          }
          function onController()
          {
          	
          }
          function onTimer()
          {
          	
          }
          function onControl(number, value)
          {
          	 if(number == Gain)
              {
                  GainSliderArray.showControl(index);
              }
              else if (number == Pan)
              {
                  PanSliderArray.showControl(index);
              }
          }
          
          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @Dan Korneff
            last edited by d.healey

            @dustbro

            This line var y = ControlSelectButtonArray.indexOf(component); You should use local rather than var.

            This line GainSliderArray.showControl(index); Where is index coming from?

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

            Dan KorneffD 1 Reply Last reply Reply Quote 0
            • Dan KorneffD
              Dan Korneff @d.healey
              last edited by Dan Korneff

              @d-healey said in Print array index:

              This line GainSliderArray.showControl(index); Where is index coming from?

              I thought:

              local index = SamplerSelectButtonArray.indexOf(component);
              

              Is that only available in my buttonCallback function?

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

                @dustbro Ya, that's why it's local :) post a HISE snippet, I think I will be able to help you more then.

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

                1 Reply Last reply Reply Quote 0
                • Dan KorneffD
                  Dan Korneff
                  last edited by

                  HiseSnippet 1609.3oc6ZE0aaaCDVJIrK1qtXcnOrWFfPwFfKVWpsSZ6FJFpSbZ5BVSiWbZ2vJ1JX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7cAz1jfWH495blnxHfSNCYMmjLkWu9vQMdMut.2lxenf22erHTFruQZUxDT2c9MAQ4cIF2Ivv3+92NQiaUOaFOL4bJ1t9ujeaO0rWCmyOYNGOs9.yKlkMSmJq1vxOyvxVe+4wxiksmX6W+Cld88OO1N8tfSL8AFlt4Xl9zW.EtFLuceOrL8ciU.NR.TnO0kPUWzjEPkCMS+tPtvbVg6UQMoR2imLdWZB3EJNbQi2nmenD5Ac5.mqm.1UP67iW7u0fIT9zPn7wnVR3Nj8nrtwUwT3Iol1b3Ag7y7CB0TP7331sn+lwvdc8s5CtKQ5d+y55oZyd79rTyUDvOf3CWMFh9DSgGbftTy3Z8l6qyUNT.7l.Ogof8YDvsKMWiMD7ffNvxQaq.SQM6K5p7UI8b.Y.QDjtuG2uGD5YLhmh9is5f9mDPTgZp6dXofdh4n0yRkCw5v8mipswZo+FrO7iNeg5W+5F51gpTM+pTK+prd9UYi7qxsyuJ2I+pb2boRXh1dX+I91keP1X0BpCkpIdFibKZWCSq5wbW8njOMVMdbz+y8xmu6N2Y4rA2y3wYKDiwVTUz4ArAPwJnmvCa1lzA22SNpWSPtGmw8OlyntoqL.6z61kHLg9DWOaJkPgojdtV8Cf6EhCLJs8Y0eDbocrHcAub4JplcWwrBWeBJDtNph8NuePWX4+2SWXVttXFsNvrKj+KONeYjtTuihNx+TP8.deIPyH9ndDvGnEvAxkXxJXIESiv1UheMfVDVaci+B9hDVMlBgRX0XgVtwlBVaQ+t9Fv1KSXpSNzrf8.xIdlozA.SKEjfCzrBzA0dpCgVQ44f9ZgGPBqvDhmoRmZOpaSN3Lg8QphNn6kCtmF2288Ixmyvasf74BxmKHetf74BxmKHetf74BxmKHeNuIe9tXQ2C6J3O2M7uUkZouptG.AL8+faEP6oZ6TM9OOkJX0CN264ttpcUeIDtlrF0xsFqmaM1H2Zb6bqwcxsF2M2Z7UyPCEIiM6K48BqwZY82.KOFiSB
                  
                  1 Reply Last reply Reply Quote 0
                  • Dan KorneffD
                    Dan Korneff
                    last edited by

                    Almost got it figured out.... 😀

                    1 Reply Last reply Reply Quote 0
                    • Dan KorneffD
                      Dan Korneff
                      last edited by Dan Korneff

                      ugh... I'm so close, but my code is crashing hise :(
                      I can't post a snippit cause the xml crashes on open... but here's the code from the interface file:
                      Does anything look whack enough to bring down HISE?

                      Content.makeFrontInterface(500, 300);
                      
                      const var Sampler = Content.getComponent("Sampler");
                      const var Sampler2 = Content.getComponent("Sampler2");
                      const var Gain = Content.getComponent("Gain");
                      const var Pan = Content.getComponent("Pan");
                      const var SamplerGain = Content.getComponent("SamplerGain");
                      const var SamplerPan = Content.getComponent("SamplerPan");
                      const var Sampler2Gain = Content.getComponent("Sampler2Gain");
                      const var Sampler2Pan = Content.getComponent("Sampler2Pan");
                      
                      //create arrays
                      
                      const var SamplerSelectButtonArray =      [
                                                              Content.getComponent("Sampler"),
                                                              Content.getComponent("Sampler2")
                                                          ];
                                                     
                      const var ControlSelectButtonArray = [
                                                              Content.getComponent("Gain"),
                                                              Content.getComponent("Pan")
                                                          ];
                                                     
                      const var GainSliderArray =         [
                                                              Content.getComponent("SamplerGain"),
                                                              Content.getComponent("Sampler2Gain")
                                                          ];
                                                          
                      const var PanSliderArray =         [
                                                              Content.getComponent("SamplerPan"),
                                                              Content.getComponent("Sampler2Pan")
                                                          ];
                                                          
                      const var empty = []
                                                          
                                                          
                      // Gain page index
                      inline function showPageGain(pageIndex)
                      {
                          for(k in GainSliderArray[0]) 
                          {
                              k.showControl(pageIndex == 0);
                          }
                          
                          for(k in GainSliderArray[1]) 
                          {
                          
                              k.showControl(pageIndex == 1);
                          }
                          
                              for(k in empty) 
                          {
                          
                              k.showControl(pageIndex == 2);
                          }
                      }
                      
                      // Pan page index
                      inline function showPagePan(pageIndex)
                      {
                          for(k in PanSliderArray[0]) 
                          {
                              k.showControl(pageIndex == 0);
                          }
                          
                          for(k in PanSliderArray[1]) 
                          {
                          
                              k.showControl(pageIndex == 1);
                          }
                          
                              for(k in empty) 
                          {
                          
                              k.showControl(pageIndex == 2);
                          }
                      }
                                                 
                      inline function buttonCallback(component, value)
                      {
                          if(value)
                          {
                              local x = SamplerSelectButtonArray.indexOf(component);
                              local y = ControlSelectButtonArray.indexOf(component);
                              
                                          if(x == true)
                                      
                                  {
                                      showPageGain(y);}
                                  else
                                      {showPageGain(2);
                                  }
                                  
                                  
                                  if(y == true)
                                  {
                                      showPagePan(y);}
                                      
                                  else
                                      {showPagePan(2);
                                  }
                              
                          }
                      }
                      
                      
                      for(a in SamplerSelectButtonArray)
                          a.setControlCallback(buttonCallback);
                          
                      for(b in ControlSelectButtonArray)
                          b.setControlCallback(buttonCallback);
                      function onNoteOn()
                      {
                      	
                      }
                      function onNoteOff()
                      {
                      	
                      }
                      function onController()
                      {
                      	
                      }
                      function onTimer()
                      {
                      	
                      }
                      function onControl(number, value)
                      {
                      	
                      }
                      
                      
                      1 Reply Last reply Reply Quote 0
                      • Dan KorneffD
                        Dan Korneff
                        last edited by

                        looks like this is causing it:

                        if(x == true)
                                        
                                    {
                                        showPageGain(y);}
                                    else
                                        {showPageGain(2);
                                    }
                                    
                                    
                                    if(y == true)
                                    {
                                        showPagePan(y);}
                                        
                                    else
                                        {showPagePan(2);
                                    }
                        1 Reply Last reply Reply Quote 0
                        • Christoph HartC
                          Christoph Hart
                          last edited by

                          Which HISE version are you using? I remember fixing a crash a few weeks ago that happened when you try to iterate over an object that isn't iteratable (eg. a module reference obtained by Content.getComponent() et al.), which is exactly what you trying to do with:

                          for(k in GainSliderArray[0]) 
                          {
                              k.showControl(pageIndex == 0);
                          }
                          

                          This is not how the for(... in ...) loop works. You want to iterate over the array, not the first element of it, so you need to remove the array subscription from the iterated object:

                          for(k in GainSliderArray) 
                          {
                              k.showControl(pageIndex == 0);
                          }
                          
                          Dan KorneffD 1 Reply Last reply Reply Quote 0
                          • Dan KorneffD
                            Dan Korneff
                            last edited by

                            I've gotten much closer to the goal.... just one thing left. Switching between Sampler1 and Sampler2 doesn't update my display until I select the Gain/Pan button.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VP+.sgdfbw5cErfrSivmqEez91XZG0C+E7IZx5wsPHmrd7jFtwlBhsnuqNNq4hXp7MGptf8flS7zKoCfNsjPBdglQfJo1W9RnkjLGLVazI3vcXBwyDamZOhaKFPlv5H4lNVOn.8dpc30OkZ9bJr07lOm2747lOm2747lOm2747lOm2747lOm0Me9wHn6ib4rW4F9COIC8qpFAP.U8ek3RV6Ie1td7u0jLY0Gdu2qbckqptMjtxVCmBqwcJrFaTXMtag03dEVi6WXM9tongrIiMGHX8C2i0v3uoArm2C
                            
                            Content.makeFrontInterface(500, 300);
                            
                            const var Sampler = Content.getComponent("Sampler");
                            const var Sampler2 = Content.getComponent("Sampler2");
                            const var Gain = Content.getComponent("Gain");
                            const var Pan = Content.getComponent("Pan");
                            const var SamplerGain = Content.getComponent("SamplerGain");
                            const var SamplerPan = Content.getComponent("SamplerPan");
                            const var Sampler2Gain = Content.getComponent("Sampler2Gain");
                            const var Sampler2Pan = Content.getComponent("Sampler2Pan");
                            
                            //create arrays
                            
                            const var allbuttons = [
                                                    Content.getComponent("Sampler"),
                                                    Content.getComponent("Sampler2"),
                                                    Content.getComponent("Gain"),
                                                    Content.getComponent("Pan")
                                                    ];
                            
                            const var SamplerSelectButtonArray =      [
                                                                    Content.getComponent("Sampler"),
                                                                    Content.getComponent("Sampler2")
                                                                ];
                                                           
                            const var ControlSelectButtonArray = [
                                                                    Content.getComponent("Gain"),
                                                                    Content.getComponent("Pan")
                                                                ];
                                                           
                            const var Samp1GainSliderArray =         [
                                                                    Content.getComponent("SamplerGain")
                                                                ];
                                                                
                            const var Samp2GainSliderArray =         [
                                                                    Content.getComponent("Sampler2Gain")
                                                                ];
                                                                
                            const var Samp1PanSliderArray =         [
                                                                    Content.getComponent("SamplerPan")
                                                                ];
                                                                
                            const var Samp2PanSliderArray =         [
                                                                    Content.getComponent("Sampler2Pan")
                                                                ];
                                                                
                            const var empty = []
                                                                
                                                                
                            // Gain page index
                            inline function showPageGain(pageIndex)
                            {
                                for(k in Samp1GainSliderArray) 
                                {
                                    k.showControl(pageIndex == 0);
                                }
                                
                                for(k in Samp2GainSliderArray) 
                                {
                                
                                    k.showControl(pageIndex == 1);
                                }
                                
                            
                            }
                            
                            // Pan page index
                            inline function showPagePan(pageIndex)
                            {
                                for(k in Samp1PanSliderArray) 
                                {
                                    k.showControl(pageIndex == 0);
                                }
                                
                                for(k in Samp2PanSliderArray) 
                                {
                                
                                    k.showControl(pageIndex == 1);
                                }
                                
                            
                            }
                                                       
                            inline function buttonCallback(component, value)
                            {
                                if(value)
                                {
                                    //set variable x 
                                    var x = SamplerSelectButtonArray.indexOf(component);
                            Console.print(x);
                                    
                                }
                            }
                            for(a in allbuttons)
                                a.setControlCallback(buttonCallback);
                            
                                
                            
                            inline function onGainControl(component, value)
                            {
                            	if(value)
                                {
                                    showPageGain(x);}
                                else if(1-value)
                                  {  showPageGain(2);
                                }
                            };
                            
                            Content.getComponent("Gain").setControlCallback(onGainControl);
                            
                            
                            inline function onPanControl(component, value)
                            {
                            		if(value)
                                {
                                    showPagePan(x);}
                                else if(1-value)
                                  {  showPagePan(2);
                                }
                            };
                            
                            Content.getComponent("Pan").setControlCallback(onPanControl);
                            
                            
                            
                            
                            1 Reply Last reply Reply Quote 0
                            • Dan KorneffD
                              Dan Korneff @Christoph Hart
                              last edited by

                              @christoph-hart The build is May3 2018. I'll update to the latest today.

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

                                @dustbro The latest is in the develop branch but there might be bugs.

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

                                Dan KorneffD 1 Reply Last reply Reply Quote 1
                                • Dan KorneffD
                                  Dan Korneff
                                  last edited by

                                  Finally figured it out!

                                  Content.makeFrontInterface(500, 300);
                                  
                                  const var Sampler = Content.getComponent("Sampler");
                                  const var Sampler2 = Content.getComponent("Sampler2");
                                  const var Gain = Content.getComponent("Gain");
                                  const var Pan = Content.getComponent("Pan");
                                  const var SamplerGain = Content.getComponent("SamplerGain");
                                  const var SamplerPan = Content.getComponent("SamplerPan");
                                  const var Sampler2Gain = Content.getComponent("Sampler2Gain");
                                  const var Sampler2Pan = Content.getComponent("Sampler2Pan");
                                  
                                  //create arrays
                                  
                                  
                                  
                                  const var SamplerSelectButtonArray =      [
                                                                          Content.getComponent("Sampler"),
                                                                          Content.getComponent("Sampler2")
                                                                      ];
                                                                 
                                  const var ControlSelectButtonArray = [
                                                                          Content.getComponent("Gain"),
                                                                          Content.getComponent("Pan")
                                                                      ];
                                                                 
                                  const var Samp1GainSliderArray =         [
                                                                          Content.getComponent("SamplerGain")
                                                                      ];
                                                                      
                                  const var Samp2GainSliderArray =         [
                                                                          Content.getComponent("Sampler2Gain")
                                                                      ];
                                                                      
                                  const var Samp1PanSliderArray =         [
                                                                          Content.getComponent("SamplerPan")
                                                                      ];
                                                                      
                                  const var Samp2PanSliderArray =         [
                                                                          Content.getComponent("Sampler2Pan")
                                                                      ];
                                                                      
                                  const var empty = []
                                                                      
                                                                      
                                  // Gain page index
                                  inline function showPageGain(pageIndex)
                                  {
                                      for(k in Samp1GainSliderArray) 
                                      {
                                          k.showControl(pageIndex == 0);
                                      }
                                      
                                      for(k in Samp2GainSliderArray) 
                                      {
                                      
                                          k.showControl(pageIndex == 1);
                                      }
                                      
                                      
                                      
                                  
                                  }
                                  
                                  // Pan page index
                                  inline function showPagePan(pageIndex)
                                  {
                                      for(k in Samp1PanSliderArray) 
                                      {
                                          k.showControl(pageIndex == 0);
                                      }
                                      
                                      for(k in Samp2PanSliderArray) 
                                      {
                                      
                                          k.showControl(pageIndex == 1);
                                      }
                                      
                                  
                                  }
                                  
                                  
                                  
                                  inline function ControlsCallback(component, value)
                                  {
                                      if(value)
                                      {
                                  
                                  //set variable y 
                                  var y = ControlSelectButtonArray.indexOf(component);
                                  
                                          if (y == 0)
                                             { showPageGain(x);}
                                             else (showPageGain(3));
                                             
                                             if (y == 1)
                                          {
                                              showPagePan(x);
                                          }
                                          else (showPagePan(3));
                                      }
                                  }
                                  for(a in ControlSelectButtonArray)
                                      a.setControlCallback(ControlsCallback);
                                      
                                      
                                                             
                                  inline function SamplerCallback(component, value)
                                  {
                                      if(value)
                                      {
                                                  //set variable x 
                                  var x = SamplerSelectButtonArray.indexOf(component);
                                  
                                          
                                  
                                        if (y == 0)
                                          {
                                              
                                              showPageGain(x);
                                          }
                                          else (showPageGain(3));
                                          
                                      if (y == 1)
                                          {
                                              showPagePan(x);
                                          }
                                          
                                          else (showPagePan(3));
                                      }
                                  }
                                  for(a in SamplerSelectButtonArray)
                                      a.setControlCallback(SamplerCallback);
                                  1 Reply Last reply Reply Quote 1
                                  • Dan KorneffD
                                    Dan Korneff @d.healey
                                    last edited by

                                    @d-healey Overall functionality of the newest version is quite more stable than what I was using. Keeping my eyes open for bugs as you suggested.

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

                                      Good to know ;)

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

                                      31

                                      Online

                                      1.7k

                                      Users

                                      11.8k

                                      Topics

                                      102.3k

                                      Posts