HISE Logo Forum
    • Categories
    • Register
    • Login

    Engine.getPreloadProgress update interval

    Scheduled Pinned Locked Moved Scripting
    11 Posts 3 Posters 437 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
      last edited by

      I want to use this function with a timer to show the progress of a zip file extraction but the update interval seems to be really slow so with a smaller zip file < 1GB the progress never gets past 0.0.

      Is it possible to increase the update interval?
      I also notice that it goes in steps of 0.2 is it possible to change this?

      Demo code (supply your own test.zip file in your Downloads folder)

      const d = FileSystem.getFolder(FileSystem.Downloads);
      const zip = d.getChildFile("test.zip");
      
      zip.extractZipFile(d, true, function(obj)
      {
      	if (obj.Status == 1)
      		t.startTimer(100);
      		
      	if (obj.Status == 2)
      		t.stopTimer();
      });
      
      const t = Engine.createTimerObject();
      
      t.setTimerCallback(function()
      {
      	Console.print(Engine.getPreloadProgress());
      });
      

      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 ustk

        @d-healey does Engine.getPreloadProgress() connect to zip extraction?
        I thought it was only for sample map loading purpose...

        Because the progress can been seen in the object itself:

        Interface: {
          "Status": 1,
          "Progress": 0.5,
          "TotalBytesWritten": 1143078934,
          "Cancel": false,
          "Target": "/Users/greg/Downloads",
          "CurrentFile": "__MACOSX/._LogicProTrial.dmg",
          "Error": ""
        }
        

        But I have no idea how to get it progressively...

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

          @ustk The obj.Progress is only for individual files, the callback is only triggered 3 times, once before extraction, once when extraction starts, and once when it completes.

          Link Preview Image
          HISE | Docs

          favicon

          (docs.hise.audio)

          The extraction process will be executed on the sample loading thread and you can assign a callback that is executed to track the extraction progress.

          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 ustk

            @d-healey Yeah I knew for the triggering happening only in this cases but I missed the part for extraction progress :)

            And I imagine you're not in this case scenario, right?

            the progress from 0.0 to 1.0. Be aware that this tracks only the number of files extracted vs. the total number of files, so if you have one big file inside the archive, it will not work.

            I only have 1 big file I can test on my side...

            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 That only applies to obj.Progress object. But I tested with both scenarios.

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

              ustkU 1 Reply Last reply Reply Quote 1
              • ustkU
                ustk @d.healey
                last edited by ustk

                @d-healey With a multi files zip, it works here with both solutions

                zip.extractZipFile(d, true, function(obj)
                {
                	Console.print(obj.Progress); // Here it is called all along the extraction
                });
                

                and

                zip.extractZipFile(d, true, function(obj)
                {
                	if (obj.Status == 1)
                		t.startTimer(100);
                		
                	if (obj.Status == 2)
                		t.stopTimer();
                });
                
                const t = Engine.createTimerObject();
                
                t.setTimerCallback(function()
                {
                	Console.print(Engine.getPreloadProgress());
                });
                

                Both giving me the same result (it's not well distributed because of my test files)

                Interface: 0.01705756929637527
                Interface: 0.06823027718550106
                Interface: 0.9232409381663113
                Interface: 0.9360341151385928
                Interface: 0.9360341151385928
                Interface: 0.9402985074626866
                Interface: 0.9445628997867804
                Interface: 0.9466950959488273
                Interface: 0.9488272921108742
                Interface: 0.9552238805970149
                Interface: 0.9594882729211087
                Interface: 0.9616204690831557
                Interface: 0.9616204690831557
                Interface: 0.9616204690831557
                Interface: 0.9616204690831557
                Interface: 0.9658848614072495
                Interface: 0.9658848614072495
                Interface: 0.9701492537313433
                Interface: 0.9744136460554371
                Interface: 0.9786780383795309
                Interface: 0.9786780383795309
                Interface: 0.9786780383795309
                Interface: 0.9786780383795309
                Interface: 0.9829424307036247
                Interface: 0.9829424307036247
                Interface: 0.9829424307036247
                Interface: 0.9872068230277186
                Interface: 0.9872068230277186
                Interface: 0.9914712153518124
                Interface: 0.9914712153518124
                Interface: 0.9957356076759062
                

                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 Interesting! Does it work with a single file in the zip? Are you using the develop branch?

                  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 ustk

                    @d-healey Always develop...
                    With a single file I get the same result as you.
                    This is probably meaning that Engine.getPreloadProgress() behaves exactly the same as obj.Progress,
                    so straight from 0 to 1 in the case of 1 big file...

                    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 said in Engine.getPreloadProgress update interval:

                      This is probably meaning that Engine.getPreloadProgress() behaves exactly the same as obj.Progress,
                      so straight from 0 to 1 in the case of 1 big file...

                      Uh that's annoying. Most of my zips contain multiple files so it's not too big a deal for me, but it would be nice to get the progress on a single file archive too.

                      @Christoph-Hart What is the reason for this limitation?

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

                      Christoph HartC 1 Reply Last reply Reply Quote 0
                      • Christoph HartC
                        Christoph Hart @d.healey
                        last edited by

                        @d-healey IIRC the extract function for a single file doesn't provide a progress, so we're stuck with counting what's left to extract.

                        Link Preview Image
                        JUCE: ZipFile Class Reference

                        favicon

                        (docs.juce.com)

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

                          @christoph-hart Ah I see, it's a JUCE limitation. I think in that case I'll just use a generic spinner type progress indicator.

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

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

                          46

                          Online

                          1.7k

                          Users

                          11.7k

                          Topics

                          101.9k

                          Posts