HISE Logo Forum
    • Categories
    • Register
    • Login

    User Specified Sample Folder per Sampler?

    Scheduled Pinned Locked Moved Scripting
    sample foldercustom samplesfolder location
    5 Posts 3 Posters 408 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
      last edited by trillbilly

      Hey Gang,

      I've got a drum plugin that has 6 samplers with the ability to randomize samplemaps individually as well as globally. I have a customer request to allow users to select a custom folder/sampler, which has their own samples in it, and randomize through the samples of the selected folder instead of the samplemaps.

      The plugin would have to default back to the samplemaps folder if none is selected or the custom folder is not found for whatever reason.

      Is this possible? If so, does anybody have an idea where to start? Or even better, a snippet?

      Best!

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

        Yes it's possible. Use the sample import tutorial as a starting point - https://github.com/christophhart/hise_tutorial/tree/master/CustomSampleImport

        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 Hi David, I've seen this and used parts of it. I see within the SampleLoadSave.js how to import the custom samples.

          I'm confused though how I allow a user to choose their own sample folder to be randomized.

          I will be back at the studio tomorrow and can dig a bit deeper into into it.

          Thanks and best!

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

            @trillbilly said in User Specified Sample Folder per Sampler?:

            @d-healey Hi David, I've seen this and used parts of it. I see within the SampleLoadSave.js how to import the custom samples.

            I'm confused though how I allow a user to choose their own sample folder to be randomized.

            I will be back at the studio tomorrow and can dig a bit deeper into into it.

            Thanks and best!

            FileSystem.browseForDirectory(var startFolder, var callback)

            HISE Development for hire.
            www.channelrobot.com

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

              @Lindon said in User Specified Sample Folder per Sampler?:

              FileSystem.browseForDirectory(var startFolder, var callback)

              Yes, thank you. I have added this to the SampleLoadSave.js of the CustomSampleImport project. On Right Click, it opens the directory browser twice. I can select a folder but it does not load the samples in the folder or randomize the folder.

              SampleDropper.setMouseCallback(function(event)
              {
              	// Clear the sample on double click
              	if(event.doubleClick)
              	{
              		Sampler1.clearSampleMap();
              		return;
              		
              	}
              	
              	this.data.hover = event.hover;
              	
              	// Show a directory browser on right click
              	if(event.rightClick)
              	{
              		FileSystem.browseForDirectory(FileSystem.Samples, loadSample);
              		return;		
              		this.repaint();
              	}
              
              });
              

              Here is how I am randomizing some components in case I need something here. I know there is a way to reduce the script, I just don't know it.

              const sampleMapsRAN = Sampler.getSampleMapList();
              
              inline function onShuffleSamplebtn1Control(component, value)
              {
              	if (value)
              	{
              		local index = Math.randInt(0, sampleMapsRAN.length);
              		local sampleMap = sampleMapsRAN[index];
              
              		Sampler1.loadSampleMap(sampleMap);
              		
              		SampleViewer1.setValue(index);
              		SampleName1.setValue(list[index]);
              
              	}
              };
              
              Content.getComponent("ShuffleSamplebtn1").setControlCallback(onShuffleSamplebtn1Control);
              

              Thanks again.

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

              18

              Online

              1.7k

              Users

              11.8k

              Topics

              102.5k

              Posts