HISE Logo Forum
    • Categories
    • Register
    • Login

    A/B comparison

    Scheduled Pinned Locked Moved Scripting
    22 Posts 6 Posters 1.4k 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.
    • d.healeyD
      d.healey @Lindon
      last edited by

      @Lindon

      on ui change
      store its value in Array_A (if A button = true) or store it in Array_B (if B button = true)

      This might add some unnecessary overhead and extra code. Why not just store all values in array A once when button B is pressed? I'm also thinking we could avoid using an array and use a base64string using MidiProcessor.exportState() although I don't know if this function can be used from within the MIDI processor that is being exported/restored.

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

      LindonL 1 Reply Last reply Reply Quote 0
      • LindonL
        Lindon @d.healey
        last edited by

        @d-healey sure that'd work too...

        HISE Development for hire.
        www.channelrobot.com

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

          Has anyone explored this further? I'm experimenting with exportState() and restoreState() at the moment.

          HiseSnippet 1068.3ocsVEtaaaCDlx1paVadXEnO.b4W1.YNxaqcEnXXw1ItvnKIFyccCqnvfVhJlHRjBTTswKHOC6UZOB6QY+e+X6HkjkblRVpwl7OLOd22wu63wiblT3QSRDRjU6WtNlhr9X64q4pUiWQXbzziPV11CWLBMZcLIIg5irrZ9bsJq1sP4eiHgDtGs5TuRv7neGKhopL6gufEFNg3SeIKZKqm5I3iEghTfFMscQwDuKHmSOknMqgMx5AG6yTB4bEQQS.aFI7WOek3c7L6eEKgsLjpEFflCNJaZz3UrP+YEgXBBY0ZVY.2LKfej8ILe1l4KC7O0n.WhnZNvpw1Tp0VTZvsQoIhPesCtE5YUgdsxn2Csm6IYwpRMZt8Q1S4JpLf.o8pzJyVTi+ro8XAXAW0OhbAchDD1fn6Sbc2G+XW2dOqiSGmCN3bpBKoATIE1FwJANBxAXXSQA+SkcbfgIJ7aIRLTKf+FroDoO.yDBFot6Ap1qviF6VlpTBNlHkj0a4iQKFpmCbzqKXo1WhnXAGD.WsWu863fq8qdDvR+lh01rf5vHA1fnXyVDVDfGhGciPYwbvBnRSyjMvYblhQBY+BM2SuioVg8RkP5QgCEPArO3Zvocbp3iW69FvMvD8oWFKjJyx1UmPpZzfaynreLdHjwwAobOECxcZnSxE55UDt6C7OLk1qiyUYYoCNHKTMrByBvwoIqn9YJYAcKLWKdUYhMT3QBwL+K0bJeSoOi6Su7rfxUSytBDUCE.2sELZSuN6uBBJovZEVxPtPcSV9Y+WRy9RpImjQJ.bEd0tiy0lTdfP1krjrD1y234dX8L8SzkWbkTDNF38RniT2paF8d1l8HA+TghdFuaOmqbZ6bsC9lpBBpUWt+CoxZUq6RJuKfc4oQKoxhpgBCgVGa2a5A2udSdYGrpXnfOENKbVLMWtr60fZ5dgxOYB8wZlyPXjxzE6Sx6hMxzR.wLNYHxP7xaB9iuEcu.N5l.yW75.NOj4SkFfef8K3hkCpA7OL8Hhhna.mGCPbESkJlN8YcD8svsYYsiaaeDM4BkH1Dj4kdvkj2YXdIXf0uBqyZ8feFFHI9Lwykhz3hr48yWiz9Jm3+dxgqKihe7v6xms9WSJk9EGUwu+14Gh9mWJAWMJ7SCIpsuuT+vfbEPg5VWLou7gmvTqqta+dbIpasWhVaY38jtOzdFS4spd91nF9BkG+ey27mjzw93f.pmpjrsrm7S656OdOnx2KRUL94mPTRltn8zzn4vqx7n.S3bZXht9sg9zVlrqVVmYlS49Fg+B9xUNPKakqbPgRTDwSJV3kcbU+nmOzLCvIt48dssOQKi2bN011suKJBdK1BOOcp3yAtWOluXGv7k6.luZGv73c.yS1ALe8Nf4o2IF8yfGlpDQYGSfIlcroeok0wbBTkYpHQ+c3rG0t
          
          Content.makeFrontInterface(600, 500);
          
          //get reference to main container
          const var A_B = Synth.getChildSynth("A_B");
          
          // A_B button array
          const var AB_Array = [Content.getComponent("A"),
                                Content.getComponent("B")];
          
          // array to store State of A B
          const var A_B_Storage = [];
          
          // initialize array with current loaded state
          A_B_Storage[0] = A_B.exportState();
          A_B_Storage[1] = A_B.exportState();
          
          
          
          inline function A_B_Function(component, value)
          {
              //store state if pushed
              if(value)
              {
                  local idx = AB_Array.indexOf(component);
                  A_B_Storage[idx] = A_B.exportState();
              }
              
              //recall state if not pushed
              if(!value)
              {
                  local idx = AB_Array.indexOf(component);
                  A_B.restoreState(idx);
              }
          	
          };
          
          for(abab in AB_Array) abab.setControlCallback(A_B_Function);
          

          The exportState() appears to be working and I can store that value in an array, but restoreState() is questionable. At the moment, it only sets the master container volume to -100.

          Dan Korneff - Producer / Mixer / Audio Nerd

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

            I spot an error in my function. in the second half idx is undefined.

                //recall state if not pushed
                if(!value)
                {
                    local idx = AB_Array.indexOf(component);
                    A_B.restoreState(idx);
                }
            

            it should be

                //recall state if not pushed
                if(!value)
                {
                    local idx = AB_Array.indexOf(component);
                    A_B.restoreState(A_B_Storage[idx]);
                }
            

            but changing to this value causes an instant crash.

            Dan Korneff - Producer / Mixer / Audio Nerd

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

              @dustbro yeah I have A/B running in my synth - export and restore are not any use to me - as I want to be able to morph states a-to-B and to include/exclude voices in that process.. so it's all hand built.

              HISE Development for hire.
              www.channelrobot.com

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

                @Lindon said in A/B comparison:

                it's all hand built

                Any hints on the method you used?

                Dan Korneff - Producer / Mixer / Audio Nerd

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

                  @dustbro see the post here from April 9th

                  HISE Development for hire.
                  www.channelrobot.com

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

                    @Lindon Are you using

                    Content.storeAllControlsAsPreset()
                    

                    or

                    Engine.dumpAsJSON()
                    

                    Dan Korneff - Producer / Mixer / Audio Nerd

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

                      @dustbro said in A/B comparison:

                      @Lindon Are you using

                      Content.storeAllControlsAsPreset()
                      

                      or

                      Engine.dumpAsJSON()
                      

                      no. neither.

                      I have a two array-dimensional array of "sound affecting controls"(lets call them slots) - and a button (in stateA or stateB).

                      I save the array in the preset(panel.data) and depending on the button state I load one or other dimension.

                      This allows me to :

                      1. have a morph slider so I can move between slots
                      2. Include or exclude any set of controls from this morph
                      3. on preset load I can overwrite the loaded preset with these values if I wish

                      So I have a 4-voice synth - the user can morph between Slot A and B - and include or exclude any voice, and they can include or exclude any voice from a preset load.

                      HISE Development for hire.
                      www.channelrobot.com

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

                        @Lindon Got it! 👍

                        Dan Korneff - Producer / Mixer / Audio Nerd

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

                          Can I get some extra eyes on this AB script? This is a simplified script with 2 knobs controlling an EQ.
                          If I comment out Compare_Elements_Array[i].changed(); the knobs store/recall as expected but module doesn't update (also expected). With .changed() left in, one knob works, and the other stops updating.
                          I can't see why.

                          The full version of this script is getting Time Out errors on the for() loops and crashing HISE... yay!

                          Content.makeFrontInterface(600, 500);
                          
                          
                          //--------------------------eq stuff------------------------------------
                          const var ParametriqEQ1 = Synth.getEffect("Parametriq EQ1");
                          const var band_enable = Content.getComponent("band_enable");
                          const var eq_gain = Content.getComponent("eq_gain");
                          
                          const var controls = [Content.getComponent("eq_gain"),
                                                Content.getComponent("band_enable")];
                          
                          //function to disable all EQ bands
                          inline function DisableAllBands()
                          {
                              //diable all bands
                              for(i=0; i<3; i++)
                              {
                                  ParametriqEQ1.setAttribute(i * ParametriqEQ1.BandOffset + ParametriqEQ1.Enabled, false);
                              }
                          };
                          
                          
                          inline function eq_function(component, value)
                          {
                          	DisableAllBands();  //disable all bands
                          	
                          	//enable only selected bands
                              local bands = band_enable.getValue() +1;
                          	for(i=0; i<bands; i++)
                              {
                                  ParametriqEQ1.setAttribute(i * ParametriqEQ1.BandOffset + ParametriqEQ1.Enabled, true);
                              }
                              
                              // set gain
                              local gain = eq_gain.getValue();
                              for(i=0; i<bands; i++)
                              {
                                  ParametriqEQ1.setAttribute(i * ParametriqEQ1.BandOffset + ParametriqEQ1.Gain, gain);
                              }
                          	
                          };
                          
                          for(c in controls) c.setControlCallback(eq_function);
                          
                          
                          
                          
                          //--------------------------A B Compare---------------------------
                          
                          
                          //compare panels
                          const var Compare = Content.getComponent("Compare");
                          
                          //components to store
                          
                          const var Compare_Elements_Array = [Content.getComponent("band_enable"),
                                                              Content.getComponent("eq_gain")];
                          
                          
                          //array for value storage
                          
                          const var Compare_A = [];
                          const var Compare_B = [];
                          
                          //populate both compare arrays
                          for(i=0; i<Compare_Elements_Array.length; i++)
                          {
                              Compare_A[i] = Compare_Elements_Array[i].getValue();
                              Compare_B[i] = Compare_Elements_Array[i].getValue();
                          };
                          
                          
                          inline function onCompareControl(component, value)
                          {
                          	if(!value)
                              {
                                  for(i=0; i<Compare_Elements_Array.length; i++)
                                  {
                                      Compare_A[i] = Compare_Elements_Array[i].getValue();
                                      Compare_Elements_Array[i].setValue(Compare_B[i]);
                          //            Compare_Elements_Array[i].changed();
                                  }
                              }
                              
                              if(value)
                              {
                                  for(i=0; i<Compare_Elements_Array.length; i++)
                                  {
                                      Compare_B[i] = Compare_Elements_Array[i].getValue();
                                      Compare_Elements_Array[i].setValue(Compare_A[i]);
                          //            Compare_Elements_Array[i].changed();
                                  }
                              }
                          };
                          
                          Content.getComponent("Compare").setControlCallback(onCompareControl);
                          
                          
                          HiseSnippet 1542.3ocuX0saaTDEd23rHrAW0J0GfgbCNjzD6l9SPgp5ehMJBZqAWppnJJc7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3Giw2IMmWSJ0sThLftFcdcpn8J8IIqyb15cMBjn2oSl7W9HRVKLsJAIpXF7TpCccVHC31GyOl3Aa43c70S2CCBRWNwn5WFwnZ+OFihK+tfVNypUY15SEfLJdenPRdDuz5ENsP9BvtkkUudyjm1XLh+LYqtLu+4oXId3ftD+jiHIBB2pcxqM6L+qMadqd233hgfB9Abp7QCI74cYZKcvDtVcNMpfOIitT8UzWptCi5Q7snvcmK5Xz30JB1FC2T0ZALQdGcG2IT+uO6rhyW85gRofqUWmImZ2sr9tC1GKwpIDzdE3oCI9RpJHZuO4kvnWwyKj2YeRvKjv3aJ2VWCASSsfN9qFusOGWcz3E+jW0.IYXG5ORLmBb.9UYBRi2vBKPXJU4pRiMyhTcfvS6KtztDl0.yoO28sSru6lEZu4ry9i6G.yrPAobbPd0A887Xj1h.ppNchPqAlWcAxMoa7a3FX9OCqZM8vavHjBO06FmbtR0kjzLTnwb.N0PZb.kiLCyuWF1bQg60bZSkt8mMdWYF3EpReeiW8n6EchGlLErq5z5oK6b5y9qQn7EMm90SN20Hz+kjlmnywSNd6DX5ggCZQYvv3pFf14.WScg5xoQvO8sJBUzDd9U90uuphvMm7Kfg6sSVB2JkvUiT41YM5cRL5ubseNRh6l0F6lkvmm0nURf5aUs1hnjf0pE9qeOlxTfsxNlkHQTl.tsZ8X8PPQ4sbSl2xsX4sYT17shPIke7CvPtP0O.h9cDg9tDnpgqt8uJIrhpQP75xp0JH0gDkTbr+W3QyrhZsslYkDlWJ6w.rqu3njAmfhvOLhB327nuyr7NOPsFUI40GNNk2prpyG8HWW0Qia.GqlsN2bIzYmkPmasD5b6kPm6rD5b2kPmcOWcTe8g0BkhAwsMABsaF8ZbaaiJcq+Sw4ldg
                          

                          Dan Korneff - Producer / Mixer / Audio Nerd

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

                            @dustbro I don't fully understand why but calling changed() at the end works:

                            inline function onCompareControl(component, value)
                            {
                            	if(!value)
                                {
                                    for(i=0; i<Compare_Elements_Array.length; i++)
                                    {
                                        Compare_A[i] = Compare_Elements_Array[i].getValue();
                                        Compare_Elements_Array[i].setValue(Compare_B[i]);
                                    }
                                }
                                
                                if(value)
                                {
                                    for(i=0; i<Compare_Elements_Array.length; i++)
                                    {
                                        Compare_B[i] = Compare_Elements_Array[i].getValue();
                                        Compare_Elements_Array[i].setValue(Compare_A[i]);
                                    }
                                }
                                
                                for (comp in Compare_Elements_Array) comp.changed();
                            };
                            
                            Content.getComponent("Compare").setControlCallback(onCompareControl);
                            

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

                            LindonL 1 Reply Last reply Reply Quote 2
                            • LindonL
                              Lindon @ustk
                              last edited by

                              @dustbro - what @ustk said - the only way I get this sort of thing to work is to make all the value changes then outside that loop do the changed() element

                              HISE Development for hire.
                              www.channelrobot.com

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

                                @ustk said in A/B comparison:

                                for (comp in Compare_Elements_Array) comp.changed();

                                You guys are life savers! !!

                                Dan Korneff - Producer / Mixer / Audio Nerd

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

                                41

                                Online

                                1.7k

                                Users

                                11.7k

                                Topics

                                102.1k

                                Posts