HISE Logo Forum
    • Categories
    • Register
    • Login

    LAF + Sampler Functions

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

      @DanH Ahhhh, that does pose a bigger issue then. Ive been stuck creating some MIDI Packs for my site. I've got a few hours now, I'll mess with it now.

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

        @DanH Couldn't you reload the values after changing sample map?

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

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

          @Lindon Awesome! Im going to try this out now.

          Have you had an issue with what @DanH said regarding the Start/End times saving to what is set in the samplemap rather than the UI?

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

            @DanH I've only saved a few demo presets but as of right now it all seems to be working as expected. I know you said "reliably", how often did it fail for you?

            EDIT: Scratch that, I see what you're saying. It saves them but does not load them correctly all the time, at least on my end.

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

              @d-healey Yeah I'm thinking of trying to do it in the preset handler post callback.

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

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

                @trillbilly said in LAF + Sampler Functions:

                @Lindon Awesome! Im going to try this out now.

                Have you had an issue with what @DanH said regarding the Start/End times saving to what is set in the samplemap rather than the UI?

                nope - i want to save the start end values the user selects...

                HISE Development for hire.
                www.channelrobot.com

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

                  @trillbilly said in LAF + Sampler Functions:

                  @DanH I've only saved a few demo presets but as of right now it all seems to be working as expected. I know you said "reliably", how often did it fail for you?

                  EDIT: Scratch that, I see what you're saying. It saves them but does not load them correctly all the time, at least on my end.

                  so this I think is probably the problem I ran into - it basically a timing issue - the sample map is not loaded instantly - so you are probably trying to set the start end values for zones not even loaded yet...and yes @DanH I ended up doing a o lot of this stuff in preset handler post callback

                  HISE Development for hire.
                  www.channelrobot.com

                  trillbillyT DanHD 2 Replies Last reply Reply Quote 0
                  • trillbillyT
                    trillbilly @Lindon
                    last edited by trillbilly

                    @Lindon Ahhh, that makes sense. Because if I click the same preset multiple times, the start/end values will eventually get to where they need to be.

                    So doing it in the Preset Handler Post Callback, Im having some newb issues.

                    Here is the code from documentation

                    UserPresetHandler.setPostCallback(var presetPostCallback)
                    

                    Im not understanding something because I get "Unknown function 'setPostCallback'" error. Here is my jumble.

                    const var samplestart = [Content.getComponent("SampleStart1"),
                                             Content.getComponent("SampleStart2"),
                    		         Content.getComponent("SampleStart3"),
                    			 Content.getComponent("SampleStart4")];
                    
                    UserPresetHandler.setPostCallback(samplestart, presetPostCallback);
                    

                    Am I not calling for the variable correctly? Or the right variable? These are the knobs on my UI controlling Sample Start times.

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

                      @trillbilly You need to create a user preset handler first. const uph = Engine.createUserPresetHandler() then you can call the function on that object

                      uph.setPostCallback(function()
                      {
                      });
                      

                      UserPresetHandler.setPostCallback(samplestart, presetPostCallback);

                      If you take a look at the documentation again you'll see the setPostCallback function only takes one parameter, you've tried passing in two which won't work.

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

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

                        @d-healey Ok, I get it to compile. But then when I use the function (in this case the sample start time) it then spits out the same "Uknown function 'setPostCallback" error.

                        const var samplestart = [Content.getComponent("SampleStart1"),
                                                 Content.getComponent("SampleStart2"),
                        		         Content.getComponent("SampleStart3"),
                        			 Content.getComponent("SampleStart4")];
                        
                        const uph = Engine.createUserPresetHandler();
                        					    
                        
                        uph.setPostCallback(function()
                        {
                        	UserPresetHandler.setPostCallback(samplestart);
                        
                        });
                        
                        d.healeyD 2 Replies Last reply Reply Quote 0
                        • d.healeyD
                          d.healey @trillbilly
                          last edited by d.healey

                          @trillbilly It's late here so I'll give you an answer in the morning, but reread your code and look up each function you're using in the documentation in the meantime.

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

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

                            @Lindon Thanks :) Can I ask what you did in the post callback? I'm simply grabbing the values of the loop start/end knobs and then loading those values back into those knobs. It works sometimes and not others, leading me to suspect timing issues (poss related to sample loading time?!)

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

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

                              @d-healey it was getting late here too. I will be back in studio in a few hours to continue going over documentation.

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

                                @DanH - what I did was I waited.... 2 seconds works here... so on preset postcallback I did the following:

                                1. tried to set the sample start and ends...it probably wont have worked but hey - no loss to try..
                                2. Started a timer on the panel its in (clearly the UI is visible otherwise we cant have selected a preset to load..)....so essentially this:
                                Circle.sampleLoadTimer.startTimer(2000);
                                

                                in the timer... I did the following:

                                1. stopped the timer...as we only need to do this timer activity once...
                                2. reset the sample start and end times...as with luck the samples will actually now be loaded..

                                You may be using bigger(or smaller) sample sets than me (its only 12 waves) so the timing might need to be different, and I checked my timing loading from an external USB 2 drive..(very slow)

                                I am using a whole truckload of AudioWaveforms (I have 16 samplers) and I found I would need to "reset" these to show the new start and end values.. so I simply
                                call:

                                theAudioWaveForms[<someindex>].set("sampleIndex",<the zone index you want>);
                                

                                HISE Development for hire.
                                www.channelrobot.com

                                DanHD 1 Reply Last reply Reply Quote 0
                                • 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 | Scripting | ScriptPanel

                                        The ScriptPanel API methods

                                        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 | Scripting | ScriptPanel

                                          The ScriptPanel API methods

                                          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
                                            • First post
                                              Last post

                                            26

                                            Online

                                            1.8k

                                            Users

                                            12.1k

                                            Topics

                                            105.6k

                                            Posts