HISE Logo Forum
    • Categories
    • Register
    • Login

    Samples preloading - a visual indication

    Scheduled Pinned Locked Moved General Questions
    7 Posts 2 Posters 427 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.
    • T
      tomekslesicki
      last edited by

      Would it be possible to add some sort of a visual indication that the samples are preloading? Like a little blinking two-state button that disappears after they are loaded?

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

        @tomekslesicki https://forum.hise.audio/topic/749/remaking-monolith/13 and https://github.com/davidhealey/HISE-Scripting-Framework/blob/master/modules/preloadBar.js

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

        T 1 Reply Last reply Reply Quote 2
        • T
          tomekslesicki @d.healey
          last edited by

          @d-healey Awesome, thank you!

          1 Reply Last reply Reply Quote 0
          • T
            tomekslesicki
            last edited by

            If some of you would like to do a similar thing, here's a code I've ended up with:

            // ****** IMAGE PRELOADER ****** //
            const var preloadBar = Content.getComponent("preloadBar");
            preloadBar.loadImage("{PROJECT_FOLDER}loader.png", "filmstrip");
            preloadBar.setImage("filmstrip", 0, 0);
            
            preloadBar.setTimerCallback(function()
            {
                this.data.progress = Engine.getPreloadProgress();
                this.setImage("filmstrip", 0, parseInt(this.data.progress * 8) * 14); // number of frames * frame height
            });
            
            preloadBar.setLoadingCallback(function(isPreloading)
            {
                this.data.progress = 0.0;
                this.set("visible", isPreloading);
            	if(isPreloading)
                    this.startTimer(50);
                else
                    this.stopTimer();
            });
            
            1 Reply Last reply Reply Quote 1
            • T
              tomekslesicki
              last edited by

              The strange thing is that sometimes the animation happens and sometimes only the first frame is displayed. It disappears when the loading is finished so I guess it kind of serves the purpose. I can live with that, but maybe there's something wrong with the code after all?

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

                @tomekslesicki said in Samples preloading - a visual indication:

                The strange thing is that sometimes the animation happens and sometimes only the first frame is displayed

                Could it be that sometimes it's loading really quickly so you're only seeing a quick flash of animation before the panel vanishes?

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

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

                  @d-healey I don't think so, when it doesn't animate, there's just no motion at all.

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

                  47

                  Online

                  1.7k

                  Users

                  11.7k

                  Topics

                  102.0k

                  Posts