HISE Logo Forum
    • Categories
    • Register
    • Login

    Master Bypass Button

    Scheduled Pinned Locked Moved General Questions
    38 Posts 5 Posters 1.7k 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 @DanH
      last edited by

      @DanH do you know how to use an array yet?

      Dan Korneff - Producer / Mixer / Audio Nerd

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

        @dustbro The basic principle yes, I have several in my project doing various things, but I haven't come across storing changeable values in one yet... Assuming I'll be needing .getValue API at some point!

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

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

          @DanH if you have several bypass buttons I imagine you have stored them in an array as well as the modules, so you use only one callback

          Just use the index of the buttons to store their value in the array using the button index

          bypassArray[btnIndex] = value;
          

          Then in the master bypas CB

          for (i=0; i<buttonsArray.length; i++)
          {
              if (value)
                  moduleArray[i].setBypass(true);
              else
                  moduleArray[i].setBypass(bypassArray[i]);
          }
          

          Sorry for the approximate typing I’m on my phone...

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

          DanHD 2 Replies Last reply Reply Quote 0
          • DanHD
            DanH @ustk
            last edited by

            @ustk You would imagine, but actually I went the long way round at the time as I didn't know scripting very well :face_with_tears_of_joy:

            I'll see if I can figure it out

            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 said in Master Bypass Button:

              @ustk You would imagine, but actually I went the long way round at the time as I didn't know scripting very well :face_with_tears_of_joy:

              I'll see if I can figure it out

              Time for some refactoring

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

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

                @d-healey indeed, I find arrays really confusing. your scripting 101 video is great but only so deep. I have several arrays doing different jobs and which all look totally different (these are taken from scripts and snippets from the forum), and I can't figure out exactly what they do - scripting wise I mean...

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

                d.healeyD ustkU 2 Replies Last reply Reply Quote 0
                • d.healeyD
                  d.healey @DanH
                  last edited by

                  @DanH

                  which all look totally different (these are taken from scripts and snippets from the forum),

                  You're making Frankenstein code 👻

                  Make a new file and play around with arrays to get a better understanding. Just try stuff out.

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

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

                    @DanH This is where it is important to build a small house before constructing a building. Play as long as you need with the basics, make dummy projects, turn the code in all possible shapes, again and again, using different techniques to do the same thing from different angles, and understand EXACTLY what it does.
                    Taking ideas and solutions on the forum is a good thing, applying ready-made blocks of code is less of a good thing...

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

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

                      @d-healey Yup, you see why I want my homework marked now right?

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

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

                        @ustk only just saw this, thank you :)

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

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

                          @ustk Help please! :face_with_tears_of_joy: 👻

                          I'm getting the error: Interface:! Line 50, column 35: Unknown function 'setBypassed'

                          Which is the moduleArray line in the callback, but I suspect some other things might be wrong as well!

                          Code & Snippet below:

                          HiseSnippet 1371.3oc6Z80aaaCDmJ1ps1YtXcnOrGEB1CNqsYxRscCHqn1wwdvXM+A1oEaHvnfQl1lHRjZRTYynH.608sXOuOM6iR+FrQRIaI4nYq3zsAjZ8j3c2Ope2wi7N5ji8nVHeepGPozISbQ.kOQs2DBabywPLAzYefRE0iN7n1s0ZzsaieDr2DWnuOZ.PQov2ILQoTQf748ubOnMjXghEA.ughsPuB6fYwROt92issaCGfNA6jv5mVuiEkzjZSC3zofpNvEZcNbD5PnvrMTAJ2o0.Li50iAYHefRw8nClzaL8mIg1+FrO9LajXPMPO9DEJtM0dffwh2AMGisGb7T21G.Tt6wwAgBgAgGpd.d.dl73fwmJUnEiHY7PYiEQuZqH8TRPuhgz6Ap8r7vtrXMBtsoZGBC4MDxWBRRqPaAa7a2QsIkaAgsiC7bTaO9fYHp9bc8Gq8Lc8s2sR4Jk4KD9LsKfdZ6EvXTRMsWnME7HDqI0wkR3CptUj9sD3lGkwRPYjIJykfxbq44XuNG1RvPYlqDiHJJGUcKox49PBYFKBfQF.LWDfojpRYLwFSPZCCHVLLknQIQgHgO4QsqZM0gdLepsCPaWo76pTtjjm63iXSW6pV6IQFvm4Kky9RVBDni9JMg11mw29Tc9O+xnoQNnowMflFKllF4jll4fll2.ZZtXZZlhlw4ImI052vyCNgmtb5r0lGqMy+m8p4V8Skj4PGDXihwFl4xMOLiL5k4QclzAmgRnLgnS06mqstIgTqet12lDhQ+bso8JDSthj0mOKEFIUjUpgCzmeb1RxLFR8zpheg9tZ3uM4x0N1HxH1Xt3G8nsK+txZ7G7PspgXkCEOIVjNE2OUFFySjcIsDY6ixCjjtGtOG7kKN4LzC+mxMS4+auahHygTF5HRUgeUp7kk0lW0vgYpKZprQdYpVT+1aQ.qRBbNC4McAXpg7BYoqTtY9pTZEFSRXHkzgfYG4hhFGWKUnKzqmpUGLyYSJJ1GSJU5ZYXVrnqVpFDslwKZWLxbtoLYI66GUxNb2..y4XI0nMf.YzIYmTfqAbiaFby4gG4GKA98TCS1x3i+5N6CYPQmKQwCdLxE4wvhUZk8QWvaILrOlRp6i7OmQckArnjb964Hj8Ky9j+Z85ShGzpN3ZMSFhYRU4O3XmHd4KC8+qwLXFNCekx0dFlECicl5NIble+75fq17GuETw4IPV59REMiGofuELUCfhl7H9X1jjKSWilU0yrY0ZYsCHmz8ApGiYViyluajAe4YS+ay2nV+qn1Z3PjEKlrEUa+CqZe9qFUteHU1TsGu.mrISIQtqprifEbGr+Lu2AyM22A6HKF7BzIdPhuK0O0D2C4fOgmk6mT3q842r.8ScEKqIk2jB8xT06eYatWlIldPVfmL+ngCMfvRkOTXktrU5sIIrOiadU7+gKF9geu1M+ngB4itK4tqklxwdXGWaTKxEHadcAIG+Ldgfgv.a1TooSxOfRntioDrUxLftHlGdzHjWRtmoC0fw3MHEK4g06hrQvjYyeQ8WwyBgd73DZEiE0xerXQqWetZHc0D6L0tcbjdgONORuKMfgIiN.xSTEMIbXfSO9AqVHNSHD9cDD8Krg3vwvw5hwgmrRFHG7W7mHk0DiUhTVapxbW1vXcYi0kMtsW1vXcYi0kMVW13CXYCyT2LacYi0kMtEV1vbcYi0kMVW1HGkM9u3a3.s7nu0J72fVjKeOoDteSj+i.TR8.wXsY+t4pp56nCb3mH9VKKQ39I73S1XLVALlq.lmtBXd1Jf44q.ludEv7MKDinXTi.F0IbqHWvwsj+M.TTZQf7LYYVO3ugmYIVD
                          
                          const var Button1 = Content.getComponent("Button1");
                          const var Button2 = Content.getComponent("Button2");
                          const var Button3 = Content.getComponent("Button3");
                          
                          const var SINE1 = Synth.getChildSynth("SINE1");
                          const var SINE2 = Synth.getChildSynth("SINE2");
                          const var SINE3 = Synth.getChildSynth("SINE3");
                          
                          
                          inline function onButton1Control(component, value)
                          {
                          	SINE1.setBypassed(1- value);
                          };
                          
                          Content.getComponent("Button1").setControlCallback(onButton1Control);
                          
                          
                          inline function onButton2Control(component, value)
                          {
                          	SINE2.setBypassed(1- value);
                          };
                          
                          Content.getComponent("Button2").setControlCallback(onButton2Control);
                          
                          
                          inline function onButton3Control(component, value)
                          {
                          	SINE3.setBypassed(1- value);
                          };
                          
                          Content.getComponent("Button3").setControlCallback(onButton3Control);
                          
                          const var buttonsArray = ["Button1", "Button2", "Button3"];
                          const var moduleArray = ["SINE1", "SINE2", "SINE3"];
                          const var bypassArray = [];
                          bypassArray[0] = Content.getComponent("Button1");
                          bypassArray[1] = Content.getComponent("Button2");
                          bypassArray[2] = Content.getComponent("Button3");
                          bypassArray[0] = value;
                          bypassArray[1] = value;
                          bypassArray[2] = value;
                          
                          inline function onmasterControl(component, value)
                          {
                          	for (i=0; i<buttonsArray.length; i++)
                          {
                              if (value)
                                  moduleArray[i].setBypassed(true);
                              else
                                  moduleArray[i].setBypassed(bypassArray[i]);
                          }
                          };
                          
                          Content.getComponent("master").setControlCallback(onmasterControl);
                          

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

                          d.healeyD ustkU 2 Replies Last reply Reply Quote 0
                          • d.healeyD
                            d.healey @DanH
                            last edited by

                            @DanH You're module array just contains strings, it doesn't contain any modules.

                            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

                              bypassArray[0] = Content.getComponent("Button1");
                              bypassArray[1] = Content.getComponent("Button2");
                              bypassArray[2] = Content.getComponent("Button3");
                              bypassArray[0] = value;
                              bypassArray[1] = value;
                              bypassArray[2] = value;
                              

                              More crazy code :p

                              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

                                as @d-healey says. Use your variables, not strings.

                                const var moduleArray = [SINE1, SINE2, SINE3];

                                Dan Korneff - Producer / Mixer / Audio Nerd

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

                                  @DanH Ok so many things going on here

                                  First, the error you get is because what you stored in moduleArray are strings, not the variables you declared at the top

                                  Then another error, why are you declaring the buttons a second time in bypassArray, and why are you overwriting it again with value?

                                  bypassArray should be at the top too (like all declarations actually) and kept empty until the buttons callback are feeding it

                                  So this is better:

                                  const var SINE1 = Synth.getChildSynth("SINE1");
                                  const var SINE2 = Synth.getChildSynth("SINE2");
                                  const var SINE3 = Synth.getChildSynth("SINE3");
                                  
                                  const var moduleArray  = [SINE1, SINE2, SINE3];
                                  

                                  Even better so you declare directly the array of modules

                                  const var moduleArray = [Synth.getChildSynth("SINE1"),
                                                           Synth.getChildSynth("SINE2"),
                                                           Synth.getChildSynth("SINE3")];
                                  

                                  and then the buttons have the same treatment:

                                  const var buttonsArray = [Content.getComponent("Button1"),
                                                            Content.getComponent("Button2"),
                                                            Content.getComponent("Button3")];
                                  
                                  const var moduleArray = [Synth.getChildSynth("SINE1"),
                                                           Synth.getChildSynth("SINE2"),
                                                           Synth.getChildSynth("SINE3")];
                                  
                                  const var bypassArray  = [];
                                  

                                  Now we are going to feed bypassArray
                                  Before, you would have done this (temporarily, to show the progress):

                                  inline function onButton1Control(component, value)
                                  {
                                  	SINE1.setBypassed(1- value);
                                  	bypassArray[0] = value;
                                  };
                                  Content.getComponent("Button1").setControlCallback(onButton1Control);
                                  
                                  
                                  inline function onButton2Control(component, value)
                                  {
                                  	SINE2.setBypassed(1- value);
                                  	bypassArray[1] = value;
                                  };
                                  Content.getComponent("Button2").setControlCallback(onButton2Control);
                                  
                                  
                                  inline function onButton3Control(component, value)
                                  {
                                  	SINE3.setBypassed(1- value);
                                  	bypassArray[2] = value;
                                  };
                                  Content.getComponent("Button3").setControlCallback(onButton3Control);
                                  

                                  But instead, you can use only one callback for all the buttons

                                  inline function onBypassButtonsControl(component, value)
                                  {
                                      var btnIdx = buttonsArray.indexOf(component);
                                      
                                      moduleArray[btnIdx].setBypassed(value);
                                      bypassArray[btnIdx] = value;
                                  };
                                  for (b in buttonsArray) b.setControlCallback(onBypassButtonsControl);
                                  

                                  So we put altogether:

                                  const var buttonsArray = [Content.getComponent("Button1"),
                                                            Content.getComponent("Button2"),
                                                            Content.getComponent("Button3")];
                                  
                                  const var moduleArray = [Synth.getChildSynth("SINE1"),
                                                           Synth.getChildSynth("SINE2"),
                                                           Synth.getChildSynth("SINE3")];
                                  
                                  const var bypassArray  = [];    // The array that stores the buttons states (bypass)
                                  
                                  // INDIVIDUAL BYPASSES
                                  inline function onBypassButtonsControl(component, value)
                                  {
                                      var btnIdx = buttonsArray.indexOf(component);   // Which button has been clicked
                                      
                                      moduleArray[btnIdx].setBypassed(value);         // Set the corresponding module bypass
                                      bypassArray[btnIdx] = value;                    // Store the individual states
                                  };
                                  for (b in buttonsArray) b.setControlCallback(onBypassButtonsControl);
                                  
                                  
                                  // MASTER BYPASS
                                  inline function onmasterControl(component, value)
                                  {
                                      for (i=0; i<buttonsArray.length; i++)
                                      {
                                          if (value)                                      // If Master bypass ON
                                              moduleArray[i].setBypassed(true);           // Set all to bypass
                                          else
                                              moduleArray[i].setBypassed(bypassArray[i]); // Or restore their original state from the array
                                      }
                                  };
                                  Content.getComponent("master").setControlCallback(onmasterControl);
                                  

                                  And the final snippet:

                                  HiseSnippet 1461.3oc6Y0saaaCEVJNps1ctXcnWrKIB1E1ncoNNscCvqn1wwdvXMwFVocqnHnfVhNlHRjdTzYwnn.6QYOR6QouAaGRJaK0oj53sVr0YcQf4Omi9324P9cnROA2iDEwEV14OZ5Xhk8m43NkIG0bDlxr5rukcQmtG1scaTi98a7Bq8lNFGEQ7srsy88poXmeSK8yaexd3.LyirnKKqmyodjmRCoxE81q9OPCBZi8IGQCSL6GTuiGm0jGvm.vImSEqwXuSwmPNDql1FNV1WqkOUxEtRrjDYYu4db+oti3+ByL+mSinCBHpF6X4BNxzcadfuBwpdsZNhF32a1xNxxx958VPB4LjvcbNf5Sm2+Bx3y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zSWpjFHW2QWeVJtJ8MN98k8FGiW5abz0SB4jGIvLnfhnTN1kDROBx5iR14yhf5nI+beUXMY+M4XQlC81mzFVkYZiKVNQnyOZDxmvjoxGxszAgqvMe17e0274i2oA4VN39dtbV9YXzkFNNfzhcFI.jJzX7K.sgg3IAxY8lJuN2AbFe7HNi5kLn2mHEzSNgHRh8LWPMjRnTjE8bm58IADbxD3up9SgDOr.3IxJxE6r7bwkEu9RGCbQpMinOMNEO2+OOEuOehDtz0AXHQEj4cNbRnKbVpGAPBiAEuC8Yug57PS6Jp1lCSY95F+A7DO3Np11wCtyrAWZkhpWx2lZsRwZkh+qpTTcsRwZkh0JE+CpTr656TrVo3SPkhcWqTrVoXsRwRnT7w3cDh8D7W4Y95ypb4an6AV2L8+O67NGnZil+IucbprcEqP3DwW44on6uF3mrso5JXytqfMOXEr4gqfMOZEr4aVAa91K0FkXTiIRdnYqHzQuV5O9uscKFFxj0Y8V+I7haMR
                                  

                                  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 You missed an opportunity, you could use a single callback for all the buttons ;)

                                    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 That is what I did, except for the master bypass, but I don't want to complicate it more for @DanH
                                      Or I don't get what you mean?

                                      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 Oh so you did! I read through it too quickly :D

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

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

                                          @d-healey @ustk @dustbro Thanks guys, I told you I find it confusing! this is going to really help me learn :)

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

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

                                            @DanH I just updated the snippet above with some comments ;)

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

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

                                            13

                                            Online

                                            1.7k

                                            Users

                                            11.9k

                                            Topics

                                            103.5k

                                            Posts