HISE Logo Forum
    • Categories
    • Register
    • Login

    Do I not understand the setLoadingCallback?

    Scheduled Pinned Locked Moved General Questions
    45 Posts 5 Posters 2.2k 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.
    • clevername27C
      clevername27 @Lindon
      last edited by

      @Lindon Were you able to make any progress here? I'm having the same issue - and without the callback, everything fails, because my scripts begin processing the sample map before it's loaded. :(

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

        @clevername27 said in Do I not understand the setLoadingCallback?:

        @Lindon Were you able to make any progress here? I'm having the same issue - and without the callback, everything fails, because my scripts begin processing the sample map before it's loaded. :(

        Well I think I got this to work - the product is out there - so I will try and take a look if I get time otherwise Christoph is you man here...

        HISE Development for hire.
        www.channelrobot.com

        clevername27C 1 Reply Last reply Reply Quote 0
        • clevername27C
          clevername27 @Lindon
          last edited by

          @Lindon Thanks - likewise appreciated.

          A 1 Reply Last reply Reply Quote 0
          • A
            aaronventure @clevername27
            last edited by aaronventure

            @clevername27 getPreloadProgress() repeats itself from 0 to 1 and it doesn't return a sample map name, that's getPreloadMessage().

            Panel's getLoadingCallback will return 1 of its preloading. While it will return 0 with the preload not yet finished (but rather at 90-something percent), you can query whether the preload has finished with a timer and if (getPreloadMessage() == ""). Start the timer in the loading callback with if (isPreloading == true)

            clevername27C 2 Replies Last reply Reply Quote 1
            • clevername27C
              clevername27 @aaronventure
              last edited by

              @aaronventure Thank you!

              1 Reply Last reply Reply Quote 0
              • clevername27C
                clevername27 @aaronventure
                last edited by

                @aaronventure On second thought, I can't follow what you're saying here. Could you pls explain it to me like I'm 5?? :)

                A 1 Reply Last reply Reply Quote 0
                • A
                  aaronventure @clevername27
                  last edited by

                  @clevername27 what have you tried so far?

                  clevername27C 1 Reply Last reply Reply Quote 0
                  • clevername27C
                    clevername27 @aaronventure
                    last edited by

                    @aaronventure Mostly sacrificing my collection of rare Creed memorabilia.

                    Appreciated - I'm not sure this is granular enough for me to answer your question. There are so many variables here that I don't how to proceed.…

                    A 1 Reply Last reply Reply Quote 0
                    • A
                      aaronventure @clevername27
                      last edited by

                      @clevername27 the panel's loading callback should, on 1,start the timer. The timer should run at 500ms intervals, checking whether the preload message is an empty string. That way you know the preload is finished (because it can only get started with the preload start, and can only return an empty string if the preload is finished) as the panel callback doesn't properly return a 0 on preload finished, but rather blows its load a bit too soon.

                      The callback starts the timer, the timer checks for preload finished by fishing for an empty string.

                      clevername27C 1 Reply Last reply Reply Quote 1
                      • clevername27C
                        clevername27 @aaronventure
                        last edited by clevername27

                        @aaronventure Thank you - I think I understand. You're saying that with:

                        setLoadingCallback(function(isPreloading)

                        …isPreloading gets set to 1 before preloading is actually complete?

                        The context here is that the Samplemap is being loaded from a saved state when the plugin starts up. After the Samplemap is loaded, I need to do something - but it's always too early.

                        Christoph HartC 1 Reply Last reply Reply Quote 0
                        • Christoph HartC
                          Christoph Hart @clevername27
                          last edited by

                          Oops, a bit late to the party but what's the problem with

                          Panel.setLoadingCallback(function(isPreloading)
                          {
                              if(!isPreloading)
                                  doTheStuffWithSampleMaps();
                          });
                          

                          no timers or preload message hacks necessary, the isPreloading will guarantee that the samples are loaded). That's how I'm using it and it never failed me so far...

                          Christoph HartC 1 Reply Last reply Reply Quote 1
                          • Christoph HartC
                            Christoph Hart @Christoph Hart
                            last edited by

                            Ah nevermind, I looked at the first post.

                            The loading callback is being executed every time when the sample loading callback picks up its work and finishes it, but it might be possible that this will happen multiple times if you load many sample maps as each of those is a single job.

                            It's therefore not 100% precise but I guess that was OK for me because I

                            1. didn't rely on it for doing actual logic
                            2. didn't use it in projects which loaded many samples at once

                            Now the proper solution for this (and I think that was requested by @gorangrooves last year) is to add a event type to the broadcaster that attaches to the event notifications of individual samplemaps - they get notified when a sample map was loaded, a new sample is added and a sample property is changed. This way you can write that logic in the place where it belongs and not a callback that was supposed to hide a loading progress bar and is working overtime since 2016...

                            A 1 Reply Last reply Reply Quote 1
                            • A
                              aaronventure @Christoph Hart
                              last edited by aaronventure

                              @Christoph-Hart https://forum.hise.audio/post/76283

                              This is the primary issue.

                              It's returning 0 before the reloading finishes so if you have a percentage bar that you're refreshing, it stops just shy of 100%. The solution is to check the reload message string with a timer for the bar refresh and set it to 100% when it detects an empty string.

                              Christoph HartC 1 Reply Last reply Reply Quote 1
                              • Christoph HartC
                                Christoph Hart @aaronventure
                                last edited by

                                @aaronventure the primary issue is that this callback does not have a precise execution order.

                                I've added the attachToSampleMap() function here:

                                Link Preview Image
                                HISE | Docs

                                favicon

                                (docs.hise.dev)

                                Remind me in two days to update the broadcaster wizard...

                                clevername27C d.healeyD 3 Replies Last reply Reply Quote 1
                                • clevername27C
                                  clevername27 @Christoph Hart
                                  last edited by

                                  @Christoph-Hart That is fantastic - thank you.

                                  1 Reply Last reply Reply Quote 0
                                  • clevername27C
                                    clevername27 @Christoph Hart
                                    last edited by clevername27

                                    @Christoph-Hart Thanks for the docs, too. Some feedback -

                                    7191144f-2305-4cc5-9c98-c00f047e7845-image.png

                                    I think you meant "The function expects three parameters. The third parameter needs to be a function…"

                                    In the same sentence, you write "either" but the other case is never mentioned. If the two cases are regular and inline functions, consider: "The third parameter needs to be a function (regular or inline) with the exact…".


                                    68fc8f95-b8fa-4b0a-a6bd-cb51520fb4c6-image.png

                                    In line #3, should samplerID and eventType be switched?


                                    3e412207-9f20-414f-bb51-3c6266e26692-image.png

                                    By "SampleMapLoaded" do you perhaps mean "SampleMapChanged"?

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

                                      @Christoph-Hart said in Do I not understand the setLoadingCallback?:

                                      Remind me in two days to update the broadcaster wizard...

                                      Tis time.

                                      Also might want to fix this bug while you're at it (if you haven't already) - https://forum.hise.audio/topic/9746/broadcasters-best-practices/30?_=1718707836936

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

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

                                        @Christoph-Hart How do we use the broadcaster to show a loading bar? It seems to me that the events trigger after they have completed.

                                        Also SampleMapLoaded doesn't work, it needs to be SampleMapChanged.

                                        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
                                          last edited by

                                          Can anyone tell me why this progress/loading bar doesn't work?

                                          HiseSnippet 1429.3ocyXrsaaaCkJNJM1qYXsnOrW1lfwdvYsHvNWZGVQwbhSRQvhSMrSCFPPP.iLsLQkHEHoRa1PA1Gy9.1mP+j1eP2ghx1zxtoNtWVMfMz4F4494H2Rv8IRIWfbJd7UwDjysc6bES0uQeLkgNXWjy23FKHgbbWJK3XhTg14pXrTR5hbbJ7TMWNEWDk94e+0cvgXlOYDJD5DN0mbHMhpFgsU8eiFFtOtK4XZjE2aV+.eNqAOjm.ZTA2pnXr+KvAjivZ1VvE4rzdcoJtniBqHRfmc3cupSe9KYF9OgJoWDRz.0PcfCxfF0nOMraqAVqDgbbaMx1KXr8641j1kNDusOPSvajD19.mEtNUp1MPkbrToEMpzcb63KnwpQTz5yW4d.SQD8vfq1VUL7hVXiBtM3.GL0ZQ3WP1W..CknxCqV8AdvOq93Rk.2sT4cIV30ByHg07dh2.ICHpF7nXNC.pT1PtLHi4o0jD0I3vDRkzyYDxVfSS0lmnnLRkdILeEkypDrZo+rTQ88fgqP0mJ0m+gbeb3N7DVWo4XJFrVOHyX6vvJC3oR4KBLYDkWEXonlGoV0znr3hpHQ17YNo1DeUkSwmV8rG3cZM3G7oqel2OMTCLlvpZ7ab1Yfbudbq4PSheCbX3EPp3HChJaMrrH01n87xgrXwzaQpvBkNOWTYqpSdCoTl77SOSi7Czx8XAfOUq0Y2BjTDHfrhJoFbJyBRr1+Ww3ofPojGRVKVnwcMx6ceux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UvMmWA2ZdE7gyqfOZdE7me+BpWcZ6DEOxL3.gZ1ZOSRnydCSBKf9O.VLRpn.
                                          

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

                                          A clevername27C 2 Replies Last reply Reply Quote 0
                                          • A
                                            aaronventure @d.healey
                                            last edited by aaronventure

                                            @d-healey Because my preloadMessage workaround seems to no longer be working, so your timer stops on the very first iteration.

                                            It's time to implement the broadcaster, I think.

                                            d.healeyD 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            35

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            102.1k

                                            Posts