HISE Logo Forum
    • Categories
    • Register
    • Login

    Loading For SampleMaps

    Scheduled Pinned Locked Moved Scripting
    5 Posts 2 Posters 215 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.
    • CasmatC
      Casmat
      last edited by Casmat

      Hey!

      Kind of a broad question. I have this viewport browser in my plugin which loads a samplemap when it is selected in the viewport. The thing is, the sample maps take time to load and be playable, but the ui is completly open and people can possibily cause an unwanted issue whilst the loading is occuring. I also have this label which whenever a entry in the viewport is clicked, it finds what samplemap is being loaded into the sampler and the label prints the samplemaps name. all this is within the veiwport callback:

      inline function onvptLayerSearch0Control(component, value)
      {
      	local currentSelectedLayerName = vptLayerSearch0.get("items").split("\n")[value].split("-")[1].trim();
      	local currentSelectedLayerSampleMap = layerScreenObject["All"][currentSelectedLayerName]["samplemap"];
      	sampler0.asSampler().loadSampleMap(currentSelectedLayerSampleMap);
      	lblCurrentLayerName0.set("text", sampler0.asSampler().getCurrentSampleMapId().replace(" Sample Map"));
      };
      

      However since the samplemap is loading, the label is set to the previous samplemap that was selected before the loading. I know that I could implement a timer to wait a couple milliseconds, but is there a more precise way to know when something like samplemaps are being loaded. I'd like to also put a panel to grey out the ui whilst the samplemap is loading to stop ui functions, and it to dissapear when the samplemap is done loading. And putting a timer would come with varied succeses since each samplemap would take a certain amount of time to load.

      Edit: probably an easier way to understand it is this: If you change samplemaps, on the top of hise, a loading bar appears whilst the samplemap is loading. I'd like to be able to show a panel when the bar appears and the panel to dissapear when the loading bar is complete and dissapears

      Thanks!

      i make music

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

        Preload callback is what you want

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

        CasmatC 1 Reply Last reply Reply Quote 0
        • CasmatC
          Casmat @d.healey
          last edited by

          @d-healey Hmm, interesting! So is the preload callback technically put into place once the loading bar in hise completes?

          i make music

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

            @Casmat The loading callback will trigger once when loading begins and once when it ends. In between you can block the UI by showing a panel.

            I demonstrated the loading callback in a video on Patreon earlier this month.

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

            CasmatC 1 Reply Last reply Reply Quote 0
            • CasmatC
              Casmat @d.healey
              last edited by Casmat

              @d-healey Ahh, i see! I tried finding it in the docs, but I can only find two functions on getting messages and progress on the preload. Where can I find more info on how to implement this or any example which utilizes this form of callback?

              Edit: Nice, just saw your edit! Will take a look at it!

              i make music

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

              51

              Online

              1.7k

              Users

              11.7k

              Topics

              102.2k

              Posts