HISE Logo Forum
    • Categories
    • Register
    • Login

    How to Save a Preset?

    Scheduled Pinned Locked Moved Solved Scripting
    5 Posts 3 Posters 476 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.
    • clevername27C
      clevername27
      last edited by

      I realise this may be obvious, but I can't seem to save a preset. I simply have this statement in my code…

      Engine.saveUserPreset("Test Preset");

      …but no file is written. (I'm expecting a file to be created with component values I've set the save-in-preset flag to, and addModuleStateToUserPreset data.)

      What am I missing? 😂😂😂

      Thank you.

      ustkU 1 Reply Last reply Reply Quote 0
      • ustkU
        ustk @clevername27
        last edited by

        @clevername27 This function saves onto a currently loaded file. This means the file has to exist first.

        Can't help pressing F5 in the forum...

        clevername27C 1 Reply Last reply Reply Quote 1
        • clevername27C
          clevername27 @ustk
          last edited by

          @ustk Thank you for your reply. If Engine.saveUserPreset doesn't create a file, then how does it get created?

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

            File/FileSystem API

            	inline function savePresetAs()
            	{
            		FileSystem.browse(FileSystem.getFolder(FileSystem.UserPresets), true, "*.preset", function(f)
            		{
            			var filePath = f.toString(File.FullPath);
            			var parentDirectory = f.getParentDirectory().toString(File.FullPath);
            			var userPresetsDirectory = FileSystem.getFolder(FileSystem.UserPresets).toString(File.FullPath);
            			
            			if (parentDirectory == userPresetsDirectory)
            				return Engine.showMessageBox("Invalid Location", "Please choose a sub folder to store the preset.", 0);
            				
            			if (!filePath.contains(userPresetsDirectory))
            				return Engine.showMessageBox("Invalid Location", "Please save the preset within the User Presets folder.", 0);
            
            			Engine.saveUserPreset(f.toString(File.FullPath).replace(".preset"));
            		});
            	}
            

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

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

              @d-healey I don't care if you are using HISE to make "virtual instruments" (as if that's a real thing). You're alright.

              1 Reply Last reply Reply Quote 1
              • clevername27C clevername27 has marked this topic as solved on
              • First post
                Last post

              20

              Online

              1.7k

              Users

              11.8k

              Topics

              102.5k

              Posts