HISE Logo Forum
    • Categories
    • Register
    • Login

    LAF + Sampler Functions

    Scheduled Pinned Locked Moved General Questions
    samplerlaflook and feelaudiowavformdraw
    43 Posts 5 Posters 3.8k 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.
    • DanHD
      DanH @Lindon
      last edited by

      @Lindon thanks, timer seems to be the way. Although does this mean that the post callback is slightly flawed, in that it should probably wait until the samples have loaded before triggering @Christoph-Hart ?

      DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
      https://dhplugins.com/ | https://dcbreaks.com/
      London, UK

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

        @trillbilly said in LAF + Sampler Functions:

        const uph = Engine.createUserPresetHandler();
        					    
        
        uph.setPostCallback(function()
        {
        	UserPresetHandler.setPostCallback(samplestart);
        
        });
        

        Ok so UserPresetHandler is the name of a class - that's a collection of functions and variables in C++.

        In HISE you create a variable that has the type UserPresetHandler, just like you can create a variable that has the type String or Number. Then through this variable you have access to that class's functions and variables.

        Can you see in the code above you have called setUserPreset on the variable we created uph, that will work, because that variable is of the type UserPresetHandler. That function takes one parameter, and that parameter needs to be a callback function, exactly like you use for a paint routine or mouse callback - anytime you see a parameter with callback in the name you need to pass in a function.

        But then you've tried to call that function again directly on the type UserPresetHandler instead of on the variable uph and this second time you've tried to pass in the samplestart array as a parameter. This of course makes no sense from a program logic point of view and won't work.

        The callback function (which you've assigned correctly with uph.setPostCallback(function(){});) is triggered after a preset is loaded. So any action you want to perform after a preset is loaded should go in there.

        So what do you want to do with your samplestart array after the preset is loaded?

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

        trillbillyT 1 Reply Last reply Reply Quote 0
        • trillbillyT
          trillbilly @d.healey
          last edited by

          @d-healey it's all starting to make much more sense.

          As @Lindon pointed out, the samples/maps dont load instantly, which in turn, makes it so the samplestart/end times dont load properly either. The idea is to have the SampleStart/End load AFTER the samplemap/preset is loaded so the correct location is placed.

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

            @trillbilly I'd have thought the loading callback would be the solution for this.

            Link Preview Image
            HISE | Docs

            favicon

            (docs.hise.audio)

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

            LindonL 1 Reply Last reply Reply Quote 0
            • LindonL
              Lindon @d.healey
              last edited by

              @d-healey said in LAF + Sampler Functions:

              @trillbilly I'd have thought the loading callback would be the solution for this.

              Link Preview Image
              HISE | Docs

              favicon

              (docs.hise.audio)

              @trillbilly - yep thats exactly what I do....

              CirclePanel.setLoadingCallback(function(isPreloading)
              {
              	var postLoadZones;
              	var postLoadStartPos;
              	var postLoadEndPos;
              	if(!isPreloading)
              	{
              		//OK so if we have just added a sound using the viewports then
              
              		if (loadingFromViewport)
              		{
              			loadingFromViewport = false;			
              			postLoadZones = theSamplers[SamplerSelector.getValue() -1].createSelection(".*");
              			for (k = 0; k<postLoadZones.length; k++)
              			{
              				postLoadZones[k].set(theSamplers[SamplerSelector.getValue() -1].SampleStart,0);
                                             // etc. etc.
              			}
              
              			
              		};
              
                  }else{
              	    Console.print("Starting to load something.....");
              	};
                        
                      
              });```

              HISE Development for hire.
              www.channelrobot.com

              DanHD trillbillyT 2 Replies Last reply Reply Quote 1
              • DanHD
                DanH @Lindon
                last edited by DanH

                @Lindon @d-healey I thought there was a loading callback :)

                So one unintended consequence of changing the sample map data with ui controls is that (in HISE at least, not tested in exported) my sample maps will be overwritten at some point with the new data. I'm not resaving anything in the sample editor, it somehow does it by itself...

                I can't help but feel this approach is a bit hacky

                DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                https://dhplugins.com/ | https://dcbreaks.com/
                London, UK

                trillbillyT 1 Reply Last reply Reply Quote 0
                • trillbillyT
                  trillbilly @Lindon
                  last edited by

                  @Lindon @d-healey man, I'm all over the place with this lol. Thanks for the script snippet. So this is what is needed in conjunction WITH the presethandler, correct?

                  d.healeyD LindonL 2 Replies Last reply Reply Quote 0
                  • trillbillyT
                    trillbilly @DanH
                    last edited by

                    @DanH Uh oh, let's hope the compiled plugins have a touch of magic and just maybe don't have the issue lol

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

                      @trillbilly No, the preset handler shouldn't be required in this case.

                      The loading callback is triggered when sample loading starts, and triggered again when sample loading ends.

                      The preset callback is triggered when a preset is loaded. This no longer seems to be relevant for what you're trying to do because the sample map is the thing we're interested in rather than the preset.

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

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

                        @trillbilly said in LAF + Sampler Functions:

                        @Lindon @d-healey man, I'm all over the place with this lol. Thanks for the script snippet. So this is what is needed in conjunction WITH the presethandler, correct?

                        it depends....

                        If you are loading a sample and once its loaded you want to do something then yeah - just the loading callback,

                        but if you want to save the sample positions and reapply them in each preset ... then you might need to look at the preset post callback, ....

                        HISE Development for hire.
                        www.channelrobot.com

                        trillbillyT 1 Reply Last reply Reply Quote 0
                        • trillbillyT
                          trillbilly @Lindon
                          last edited by

                          @Lindon Man oh man, ok.

                          If I'm not back in a few hours, send a search party...

                          LindonL 1 Reply Last reply Reply Quote 1
                          • trillbillyT
                            trillbilly @d.healey
                            last edited by

                            @d-healey Thanks! I've been trying to comprehend everything all at once. I think I need to step back and focus on one part of this issue at a time. Yesterday still has my brain fried...

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

                              @trillbilly said in LAF + Sampler Functions:

                              @Lindon Man oh man, ok.

                              If I'm not back in a few hours, send a search party...

                              Well its conceptually quite simple (well ish)

                              HISE and every other "windowing" system is event based, we have callbacks, so named because they get called back when something happens....

                              When a user clicks on or moves a control then its onControlCallback gets called, and does something.

                              So we have events - things that happen - and we have callbacks for them - so as well as the mouse click/drag etc. events there are system based events too...

                              like for instance the onTimer callbacks, all we are talking about here is two other callbacks, one when all the samples are finished loading, and one when the preset is finished loading...

                              The BIG problem is that we have to realise that more than one event can happen at (nearly) the same.... so as programmers we have to think about what's happening(or might be happening) when... and that can get a bit complicated...

                              HISE Development for hire.
                              www.channelrobot.com

                              trillbillyT 1 Reply Last reply Reply Quote 0
                              • trillbillyT
                                trillbilly @Lindon
                                last edited by

                                @Lindon I understand what you're saying but I can't quite put it into script just yet lol.

                                I'll get there. It's beginning to make more and more sense, its just a slow process for an ape like me.

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

                                  @trillbilly Did you watch this one?

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

                                  trillbillyT 1 Reply Last reply Reply Quote 0
                                  • trillbillyT
                                    trillbilly @d.healey
                                    last edited by

                                    @d-healey That would definitely be the one to watch. How I missed this one, we'll never know.

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

                                    54

                                    Online

                                    1.7k

                                    Users

                                    11.7k

                                    Topics

                                    102.1k

                                    Posts