HISE Logo Forum
    • Categories
    • Register
    • Login

    Presets and JSON

    Scheduled Pinned Locked Moved Feature Requests
    5 Posts 2 Posters 232 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.
    • LindonL
      Lindon
      last edited by Lindon

      OK so a couple of requests - uncovered whilst building my own tag based preset system :

      Can we have an async version of the load and dumpJSON ?

      so sort of:

      Engine.loadFromJSON(data,location, function());
      Engine.dumpAsJSON(location, function());
      

      and can we have a delete for presets:

      Engine.deleteUserPreset(presetname);
      

      but perhaps this works:

      File.deleteFileOrDirectory()
      

      ..but no I cant load presets as Files...or at least know what I've loaded if I do...

      and finally is there a way to turn OFF the dialog warning about overwriting presets?

      HISE Development for hire.
      www.channelrobot.com

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

        @Lindon -- Ok In case anyone is interested I got the preset delete to work...

        inline function onButton1Control(component, value)
        {
        	var myDir = FileSystem.getFolder(FileSystem.AppData);
        	var myFiles = FileSystem.findFiles(myDir, "*.preset", true);
        	var myString;
        	if(value)
            {
                for(f in myFiles)
                {
                    myString = f.toString(3); 
                    Console.print(myString);
                    if(f.toString(3) == "yourpresetnamehere.preset")
                        f.deleteFileOrDirectory();
                };
            };
        };
        

        HISE Development for hire.
        www.channelrobot.com

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

          One suggestion, never use var in an inline function. Use local. Otherwise the variable is not scoped to the function.

          Content.makeFrontInterface(600, 500);
          
          inline function myFunction()
          {
              var myVariable = 10;
              return myVariable;
          }
          
          myFunction();
          
          Console.print(myVariable); // 10
          

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

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

            @d-healey yes - thanks I know this - this is just an example - I was just being lazy.

            HISE Development for hire.
            www.channelrobot.com

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

              @Lindon as an aside -- this (lazy) example above is also an example of how not allowing AppData to resolve to the project dir in development is massively inconvenient.

              In development I can create as many presets as I like - and they are held in the project dir and I can load and save them. But the only way to delete them is to use the above code - which resolves to the compiled plug-ins App Data structure- where these presets are not yet saved.

              Worse I can even (conceptually) get around the "dialog warning about overwriting presets" by deleting a preset (before saving it) and then saving anew with my new meta data, but of course it saves on one spot(project dir) and deletes in another(compiled plugin dir)...

              So let me ask for another "Special Location" in:

              FileSystem.getFolder(var locationType)
              
              • can we please add project folder, which would resolve to - {PROJECT_FOLDER} as an option?

              HISE Development for hire.
              www.channelrobot.com

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

              65

              Online

              1.7k

              Users

              11.7k

              Topics

              102.1k

              Posts