HISE Logo Forum
    • Categories
    • Register
    • Login

    Do I not understand the setLoadingCallback?

    Scheduled Pinned Locked Moved General Questions
    45 Posts 5 Posters 2.4k 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.
    • 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 | Scripting | Broadcaster

        An object for implementing the Observer software pattern

        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+gbeb3N7DVWo4XJFrVOHyX6vvJC3oR4KBLYDkWEXonlGoV0znr3hpHQ17YNo1DeUkSwmV8rG3cZM3G7oqel2OMTCLlvpZ7ab1Yfbudbq4PSheCbX3EPp3HChJaMrrH01n87xgrXwzaQpvB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DbIWAmGMQDwcpQjE9fhHnHrufetu4U3z9nkSw.ZJK8+FpnaSMrWMT5q0Yqtf0QO22e7iZBAWedEbi4UvMmWA2ZdE7gyqfOZdE7me+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
                    • d.healeyD
                      d.healey @aaronventure
                      last edited by d.healey

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

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

                      See my post one above

                      I suspect that the loading callback is actually triggered on the UI thread because it seems to block the timer.

                      I did a test where I did the sample loading on a background task and in this case my loading bar worked, but it caused crashes in certain DAWs when loading lots of samples so I'm not trusting that method.

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

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

                        @d-healey here you go, tested with my samplemap. You were nearly there.

                        HiseSnippet 1543.3oc0X0kaabCDdWKuoVpIEMo4g9RAHL5CxsFNR4ezfzHaY6.iZkHH4ZT.CCC5coVQ3UjaI4ZGkh.zSPOK8HjiTuAoCIWIwUV10UMIs0O33Y3PxO9MCmOtosfGRjRtvyu7dCSId9WOn6Plpey9XJyamM87+7fTAIgiinr38HRk2FCSwRIIxy2uzy0Q4WdQOyO+wy1.mfYgjIt771mSCI6RGPUS71twOPSR1FGQ1iNvI562XmPNqIOgmAHpTPMuTb3I3XxKv5vVHvy+ZaEQUbQWEVQjd9KtAOZX297yX132mJoGmPzF085BKj0817jHMh0d8Z1mlD0dzIW544GzdBOTxxC2NnEMhN1uKenG.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LmkZzoyyE7rzom0xMLEE6Ifd4.U3dFeIi.bsx8L1TvkxdvwwrVR2gZmIh0b0DOcHmRDxh9dQ1.Heyfav5dQ995dERhN+RCagUB5qbi1rK01CaxwvyQM10mx9tSYeuoru+T1OXJ6GNk8ilXaIzV3TckwWDr95G0gDSyjO9nM2okohXptqexUq6JrhltXNQtAMd7tY839H5w7tAaNO.eFOk8Zendc8hWsaeW9i++eP+zBeLP4QXrKUmc1hcJbOE7nw3s.sqd3rD0HuE6Yzhy3o84LZXwaEPUdbLQ3h8YdfVWofKkS7b6FcHIDrz4Z8W2XW3oOXQwK6+s3h5+s+vnYlu9x.KbQ5Fcn+I4sOpkYWplXoqjl36c7N+5ieTotOKWoD0U+4B+GOOe8.SucjVJ9eKnZ+b63QxbAfVXWP+Oj3pHtfVk0ZWSaqATWBKxXneTZ9f0GIepGr9nA8BGsTvYK+uMuD2uDgokNLO0KADlSbKokvqLzPBj79nfxA3PA+nP6Wtnw5RFO.JYl+mmJGzRaip6Y9ZFWnN.zqNJLr3RctId24ch2adm38m2I9f4chObdm3il2I93+5IpeNw5YJ9.ayTOuVs2xV.5u03BvRd+IpqL1KC
                        

                        Basically:

                        • store isPreloading into panel data property
                        • check against that in the timer in order to stop it
                        • check against that in the paint routine whether to poll PreloadProgress or to straight up draw 1.0
                        d.healeyD 1 Reply Last reply Reply Quote 0
                        • d.healeyD
                          d.healey @aaronventure
                          last edited by

                          @aaronventure Thanks!, It's interesting, because it works. But this doesn't

                          Panel1.setLoadingCallback(function(isPreloading)
                          {	
                              if (isPreloading)
                          	this.startTimer(50);
                              else
                                  this.stopTimer();
                          });
                          

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

                            It doesn't seem to work reliably in my compiled project, maybe something to do with it being an expansion...

                            @Christoph-Hart Can you make this work reliably, either via a broadcaster or the preload callback?

                            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 Do I not understand the setLoadingCallback?:

                              @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.

                              Bump

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

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

                                @d-healey @aaronventure The new broadcaster works great - I'll post a code sample if anyone needs.

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

                                  @clevername27 For a loading bar?

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

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

                                    @d-healey Good point. I'm wondering if the callback is good enough for the progress bar, and then use the broadcaster to finish it?

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

                                      @Christoph-Hart Could it be the preloading callback isn't working correctly for me because I'm not loading my sample maps from my deferred UI script, instead I'm using a secondary MIDI processor for this?

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

                                        I just found this in the doc on threads, is this why my loading bar isn't working reliably?

                                        With the exception of the latter, all these multithreaded use cases are not synchronised by default (with the rationale of preferring data race conditions over deadlocks and priority inversions). The exception is the user preset load, which locks the scripting thread by default during the operation.

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

                                        clevername27C 1 Reply Last reply Reply Quote 1
                                        • clevername27C
                                          clevername27 @d.healey
                                          last edited by

                                          @d-healey Have you found any resolution on this?

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

                                            Bump bump @Christoph-Hart What's the use case for SampleMapLoaded/changed?

                                            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

                                            21

                                            Online

                                            1.8k

                                            Users

                                            12.0k

                                            Topics

                                            104.8k

                                            Posts