HISE Logo Forum
    • Categories
    • Register
    • Login

    Expansion encode error

    Scheduled Pinned Locked Moved General Questions
    51 Posts 2 Posters 2.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DanHD
      DanH @d.healey
      last edited by

      @d-healey Nope compiled plugin doesn't go any further than that. So what do you mean by using magic numbers?!

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

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

        @d-healey oh wait, I haven't defined hr.... what should I use? var / reg?

        Oh I have and it's for something else lol

        Yup that was it :)

        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 d.healey

          @danh said in Expansion encode error:

          oh wait, I haven't defined hr..

          It's the callback parameter FileSystem.browse(FileSystem.Downloads, false, "*.hr1", function(hr) you don't need to define it, but if you have the same name used somewhere else globally it will cause issues.

          So what do you mean by using magic numbers?!

          Link Preview Image
          Magic number (programming) - Wikipedia

          favicon

          (en.wikipedia.org)

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

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

            @d-healey Thanks, yes the hr was being used by my previous expansion install button ha

            So I'm looking into the progress bar - I don't know if you've used the expansion obj.Progress API or not. I'm trying to get it's value into a variable so I can refer to it for the progress bar, not very well :face_with_tears_of_joy:

            const var pnlProgress = Content.getComponent("pnlProgress");
            var expProgress;
            
            function installCallback(obj)
            {
                pnlProgress.setValue(0);
                //local x = obj.Progress
                
                if (obj.Progress)
                {
                    expProgress = this.data.progress;
                    pnlProgress.showControl(1);
                    pnlProgress.startTimer(30);
                }
                if (obj.Status == 2 && isDefined(obj.Expansion))
                {
                    // make sure the user presets are updated
                    obj.Expansion.rebuildUserPresets();
            
                    Engine.showYesNoWindow("INSTALL COMPLETE",
                                           "ENJOY!",
                    function(ok)
                    {
                        if(ok)
                             expHandler.refreshExpansions();
                             pnlProgress.showControl(0);
                    });
                }
            };
            
            expHandler.setInstallCallback(installCallback);
            
            pnlProgress.setTimerCallback(function()
                                         {
                                         //var x = this.getValue();
                                         var x = expProgress;
                                         //x = x + 0.1;
                                         this.setValue(x);
                                         
                                         Console.print(x);
                                         if (x >= 0.9)
                                         this.stopTimer();
                                         
                                         this.repaint();
                                         });
            
            //pnlProgress.startTimer(30);
            
            pnlProgress.setPaintRoutine(function(g)
                                        {
                                        g.fillAll(0x00000000);
                                        
                                        var a = [this.getWidth() / 2 - 400 / 2, this.getHeight() / 2 - 20 / 2, 400, 10];
                                        
                                        g.setColour(Colours.darkgrey);
                                        g.fillRoundedRectangle(a, 5);
                                        
                                        var v = this.getValue;
                                        g.setColour(0xFF7B026B);
                                        g.fillRoundedRectangle([a[0], a[1], a[2] * expProgress, a[3]], 5);
                                        
                                        });
            

            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 Here is the most basic progress indicator ever.

              expHandler.setInstallCallback(function(obj)
              {
              	Console.print(Math.ceil(obj.Progress * 100) + "%");
              });
              

              Now instead of outputting obj.Progress to the console, set it as the panel's value and then repaint the panel.

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

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

                @d-healey thanks, before I go any further, just looking at the console readout, the percentage is jumping all over the place, up and down. It's not a steady incrementation in line with the actual progress of installation.... Is it meant to be?

                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 The progress resets for each ch file I think

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

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

                    @d-healey that's what it looks like... hmmm... not quite what I was hoping for then! Is there not an overall progress thingy we can access do you know? If not maybe I'll just make a nice animation 😆

                    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 d.healey

                      @danh

                      Is there not an overall progress thingy we can access do you know

                      Don't think so. If there's a way to access the number of ch files you could create your own.

                      I'd like this too, I'll take a look at the source when I have some time and see if I can implement it.

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

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

                        @d-healey Not getting any joy from 'expHandler.refreshExpansions();'

                        Are you using it successfully? Just tried in latest Develop

                        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 Expansion encode error:

                          expHandler.refreshExpansions();

                          Take a look at the docs I linked to before. You don't need to call that function, it is called automatically. But I haven't noticed any issues. Does it not work for you in HISE or just in the compiled binary?

                          This step is only necessary when you implement a manual installation routine, but it will be called automatically at these events:
                          User installs an expansion from a package with Expansionhandler.installExpansionFromPackage()

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

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

                            @d-healey said in Expansion encode error:

                            I'd like this too, I'll take a look at the source when I have some time and see if I can implement it.

                            I've implemented it now - https://github.com/davidhealey/HISE/commit/ec63c0efe31e742937a95f046c017cab03ead552

                            The obj now has a property called TotalProgress this is updated at the start of each ch file being extracted, that means it doesn't show a constant progress from 0 - 1 but will jump. So if you have two ch files for example and their total size is 100MB but one file is 20MB and the other is 80MB, you'll see three progress points, one at 0.0, one at 0.2 and one at 0.8 - I don't think you see one at 1.0 but you can add this yourself by checking obj.status. In between those progress points you won't see any additional output so you'll need to use the standard obj.Progress to give feedback to the user.

                            I can't make a pull request yet because the latest develop branch has some workflow stuff in it that is preventing me pushing to github, I'll need to look into it to figure out what I have to do.

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

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

                              @d-healey Oh well done :)

                              So re refreshexpansions, I was being stupid - it does work, but I was expecting my combo box (expansion selector) to update with the new expansion - which obviously it doesn't. The preset browser shows the new expansions fine - but I'm not doing it that way.

                              I tried to put the code I use for the combo box list into the obj.Status callback. I don't get any errors but nor does the combo box update upon installation...

                              function installCallback(obj)
                              {
                              
                                  if (obj.Progress)
                                  {
                                      pnlProgress.showControl(1);
                                      pnlProgress.startTimer(50);
                              
                                  }
                                  if (obj.Status == 2 && isDefined(obj.Expansion))
                                  {
                                      // make sure the user presets are updated
                                      obj.Expansion.rebuildUserPresets();
                                      pnlProgress.stopTimer();
                              
                                      Engine.showYesNoWindow("- INSTALL COMPLETE -",
                                                             "SELECT THE EXPANSION FROM THE EXPANSION BOX",
                                      function(ok)
                                      {
                                          if(ok)
                                               expHandler.refreshExpansions();
                                               pnlProgress.showControl(0);
                              // this is the code for the combo box outside of this callback
                                               for(e in expHandler.getExpansionList())
                                  expansionNames.push(e.getProperties().Name);
                                  ExpansionSelector.set("items", expansionNames.join("\n"));
                                      });
                                  }
                              };
                              

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

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

                                @d-healey also tried:

                                function(ok)
                                        {
                                            if(ok)
                                                 expHandler.refreshExpansions();
                                                 pnlProgress.showControl(0);
                                
                                            reg exprfnames = expHandler.getExpansionList();     
                                                 
                                    //expansionNames.push(e.getProperties().Name);
                                    ExpansionSelector.set("items", exprfnames.join("\n"));
                                        });
                                

                                If you have any ideas pls let me know! :)

                                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 d.healey

                                  You have to clear out the combobox before you can re-add the items, this is a long standing quirk (although I thought it had been fixed).

                                  ExpansionSelector.set("items", "");
                                  ExpansionSelector.set("items", expansionNames.join("\n"));
                                  

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

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

                                    @d-healey said in Expansion encode error:

                                    although I thought it had been fixed)

                                    Yep it has been fixed so that's probably not the issue.

                                    HiseSnippet 896.3ocsV8+RaCDE+R0SVxlhB6OfP+oJzIo0pafLlqUcT1TKqNYfSjyjq1albWI4hyxPX+x9+c+CL1dujzznV5zBK+PHuu+48t26coSnxkGEoBIFlGMb.mX7LZ2gRc+V8YBIo8NDikn6yhz7P6TVMGNfEEw8HFFy8Njgg47jjme8llLelzkOlEgbrR3x+fHPnGysy1uW36uGyiejHnf1M1tsqR1R4qhA7LG0gLf4dI6B9ALTsRThwB65IzpvtZllGA5zT4Mrae02jo5erHRbtOGIpQ5BNJkMoUeguWmQ4ZDgXLemwY9boY9yo6K7D47GWAVNQf8XKJVCLJMMHU6Q.IiBPZ9THsBsqanXfdrDDOOk1VBGH8XPotHTR0kT5jRzVJPCods.1k78BAhbKproiSUa30paYYAk6HssuHRWy901mTqpc8p1qW0tQU6M.kNcqBZTOQCz353q0wWMvWa33bZtuthAMJpfyUMUWi9bDPtfqA1CTRfnR4bMJCnHmXsHNHSn4AQkqlhp09pRHqT9Kxxqh3UH8ERtcuXoqVnj1JYyXsVIqggIT4WwcTLpBHwOlup02sLE8rqjQYZ9vilI2OhOcKpeaKtAf3jS3LXVdUzGYfsEy2+bnAuxcyBvSExvCTZ9gxJIYh0MV12UTudSTVlu74gSTLN4ENMCqHiCNmGVrNhJBsl2teegGV+taZYofhJYaoPe3.dF8dJeOrOF+99SGjr5JNmjgPPUcxTxxYSIiNnHBObHI+bijjBE2JQ9T6cXZ1HmA9Eh0.dnVfojwN7qfsVoiflzc3QWpUCfEP4GnPZ+.C804g8Gmr8vwX3nsCXfLpwB.QRKEwXQZMq5Vqa0vZCqMwLNOZzznsTVzRaWRhkIMq2gj3seBdaH9wugOhXWwaK6DxgdNb+.49KXfUaJuXel9166vE6YBflhasjAWjHiD5gEW7+HVB5L0kfOTHtBsiP61exXrzDvHbT++.iYWcrHc2d83t5w.bd5dedVum3eD9Oph0B4E6yzgB7P+f3ftvMltbH5RIrzBO+KgiLozNHMVA5xkdID+AdxDVCoMxDVajPR.yMTcla5fFd4zSR3.XRlbWrI7SA.sc9rEk5rlCI.tm7LWWL8eALEOYapOC1r9LXSiYvlMlAa1bFr4kyfMuZp1f+hxai0pfzwAfQmcS1wYXrqjAcVIcgj+9Mty1N
                                    

                                    I see you're pushing values to an array called expansionNames where is this array declared? Have you cleared the array before pushing more values to it?

                                    Also your if statement and for loop are missing curly braces!

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

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

                                      @d-healey said in Expansion encode error:

                                      Yep it has been fixed so that's probably not the issue.

                                      I'm in master so it quite possibly is....

                                      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 Expansion encode error:

                                        I'm in master so it quite possibly is....

                                        Yes probably not fixed in master, but your lack of curly braces won't help :)

                                        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 thanks for your help on this :)

                                          So it kinda worked, but it seems to be repeating the list rather than clearing it and starting again. More precisely: I have one expansion installed already, I install the second and the list comes out as:

                                          Exp1
                                          Exp2
                                          Exp1

                                          Which is weird. Are my braces right?!

                                          function(ok)
                                                  {
                                                      if(ok)
                                                      {
                                                           expHandler.refreshExpansions();
                                                           pnlProgress.showControl(0);
                                                      }
                                                           //expHandler.setCurrentExpansion();
                                                           for(e in expHandler.getExpansionList())
                                                      {
                                              expansionNames.push(e.getProperties().Name);
                                              ExpansionSelector.set("items", "");
                                              ExpansionSelector.set("items", expansionNames.join("\n"));
                                                      }
                                                  });
                                          

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

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

                                            @danh

                                            Are my braces right?!

                                            Do you want the loop inside the if statement?

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

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

                                            46

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            101.8k

                                            Posts