HISE Logo Forum
    • Categories
    • Register
    • Login

    Loading Bar

    Scheduled Pinned Locked Moved General Questions
    4 Posts 2 Posters 137 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
      DailyLlama
      last edited by

      Hi! Just wondering if anyone knows of a way to make a loading bar function within a set range, say 0 - 1 whilst say a sample is loading in to the VST, is this even possible?

      i've seen some set to timers and built one of those myself, but when i link it up to the loading callback it just counts until the file is finished loading, giving me values of 60 or 140% complete.

      Here's my code if anyone's interested :)

      //PROGRESS PANEL
      
      const var pnlProgress = Content.getComponent("pnlProgress");
      pnlProgress.setValue(0);
      
      
      
      
      
      
      //PAINT ROUTINE
      pnlProgress.setPaintRoutine(function(g)
      {
            g.fillAll(C);
            
            var a = [this.getWidth() / 2 - 400 / 2, this.getHeight() / 2 - 20 / 2, 400, 20];
            
            g.setColour(0x005995C9);
            g.fillRoundedRectangle(a, 5);
            
            
            var v = this.getValue() / 10;
            g.setColour(Colours.white);
            g.fillRoundedRectangle([a[0], a[1], a[2] * v , a[3]], 5);
         
        	  v < 0.1 ? g.setColour(Colours.transparentWhite) : g.setColour(Colours.black);
       	  g.drawAlignedText(v * 100 + "%", a, "centred");
       	  
       	  });
      
      var preloading;
      
      
      pnlProgress.setTimerCallback(function()
      {
          	var v = (this.getValueNormalized()+1);
          	Console.print(v);
          	this.setValue(v);
          	this.repaint();
      });
      
      pnlProgress.setLoadingCallback(function(isPreloading)
      {		
      	if(isPreloading ){			
      		preloading = 1;
      		Console.print(preloading);
      		pnlProgress.startTimer(200);
      		
      		
      	}else{
      		preloading = 0;
      		Console.print(preloading);
      		pnlProgress.setValue(0);
      		pnlProgress.stopTimer();
      		
      	}
      
      });
      

      Please help!

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

        Link Preview Image
        sofiawoodwinds/Scripts/preloadBar.js at master · davidhealey/sofiawoodwinds

        Contribute to davidhealey/sofiawoodwinds development by creating an account on GitHub.

        favicon

        GitHub (github.com)

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

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

          @d-healey Thanks! this is great but it still has the same issue, it doesn't get to 100% each time, is there no way to normalise this and have each sample make the bar hit 100% once it's finished loading?

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

            Maybe you've found a bug, as far as I know Engine.getPreloadProgress() should always return a value between 0 and 1.

            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

            44

            Online

            1.7k

            Users

            11.7k

            Topics

            101.8k

            Posts