Forum
    • Categories
    • Register
    • Login

    Custom browser - custom preset file format???

    Scheduled Pinned Locked Moved General Questions
    29 Posts 6 Posters 1.2k 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.
    • OrvillainO
      Orvillain
      last edited by

      Battling a little with extension issues however.

      @Christoph-Hart When saving a user preset am I stuck with the .preset extension??

      Musician - Instrument Designer - Sonic Architect - Creative Product Owner
      Crafting sound at every level. From strings to signal paths, samples to systems.

      1 Reply Last reply Reply Quote 0
      • OrvillainO
        Orvillain @Christoph Hart
        last edited by

        @Christoph-Hart said in Custom browser - custom preset file format???:

        @Orvillain said in Custom browser - custom preset file format???:

        and no-one else really seems to have dove into this.

        I have :)

        No one else with the time to do a tutorial example ;-)

        Musician - Instrument Designer - Sonic Architect - Creative Product Owner
        Crafting sound at every level. From strings to signal paths, samples to systems.

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

          @Orvillain said in Custom browser - custom preset file format???:

          and no-one else really seems to have dove into this.

          I have too... :)

          HISE Development for hire.
          www.channelrobot.com

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

            @Orvillain said in Custom browser - custom preset file format???:

            No one else with the time to do a tutorial example ;-)

            Seemed pretty trivial really - its just taking the values you have assigned to params of a given FX and encoding those with the FX name in a json object...

            HISE Development for hire.
            www.channelrobot.com

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

              @Lindon said in Custom browser - custom preset file format???:

              @Orvillain said in Custom browser - custom preset file format???:

              No one else with the time to do a tutorial example ;-)

              Seemed pretty trivial really - its just taking the values you have assigned to params of a given FX and encoding those with the FX name in a json object...

              Cool, thanks for the help.

              Musician - Instrument Designer - Sonic Architect - Creative Product Owner
              Crafting sound at every level. From strings to signal paths, samples to systems.

              1 Reply Last reply Reply Quote 0
              • OrvillainO
                Orvillain
                last edited by

                Here's a handy line:

                        FileSystem.getFolder(FileSystem.UserPresets).getChildFile("FXChains").getChildFile(PluginSharedData.lastSavedFXChainFileName).move(FileSystem.getFolder(FileSystem.UserPresets).getChildFile("FXChains").getChildFile(PluginSharedData.lastSavedFXChainFileName.replace(".preset", "")));
                

                I've got this in the post save callback. It's job is to take the FXchain file I just saved, and rename it to take off the .preset extension that HISE automatically adds whenever you use Engine.saveUserPreset command.

                So now I can save two types of user preset: a global state preset, with a .preset extension... and an fxchain preset that collects module information for each of my FX slots, UI parameters, and bundles it all up into a .fxchain preset.

                Musician - Instrument Designer - Sonic Architect - Creative Product Owner
                Crafting sound at every level. From strings to signal paths, samples to systems.

                David HealeyD 1 Reply Last reply Reply Quote 0
                • David HealeyD
                  David Healey @Orvillain
                  last edited by

                  @Orvillain You can simplify your chain by including multiple directory levels in the .getChildFile calls.

                  Free HISE Bootcamp Full Course for beginners.
                  YouTube Channel - Public HISE tutorials
                  My Patreon - HISE tutorials

                  OrvillainO 1 Reply Last reply Reply Quote 0
                  • OrvillainO
                    Orvillain @David Healey
                    last edited by Orvillain

                    @David-Healey said in Custom browser - custom preset file format???:

                    @Orvillain You can simplify your chain by including multiple directory levels in the .getChildFile calls.

                    Ohh, more like this I guess?

                    const base = FileSystem.getFolder(FileSystem.UserPresets);
                    
                    base.getChildFile("FXChains/" + PluginSharedData.lastSavedFXChainFileName)
                        .move(
                            base.getChildFile(
                                "FXChains/" +
                                PluginSharedData.lastSavedFXChainFileName.replace(".preset", "")
                            )
                        );
                    
                    

                    ??

                    Musician - Instrument Designer - Sonic Architect - Creative Product Owner
                    Crafting sound at every level. From strings to signal paths, samples to systems.

                    David HealeyD 1 Reply Last reply Reply Quote 0
                    • David HealeyD
                      David Healey @Orvillain
                      last edited by

                      @Orvillain Yeah that's it! I'd break it up a little more to improve the readability and to remove some repetition.

                      const presetDir = FileSystem.getFolder(FileSystem.UserPresets);
                      const filePath = "FXChains/" + pluginSharedData.lastSavedFXChainFileName;
                      const file = presetDir.getChildFile(filePath);
                      const target = presetDir.getChildFile(filePath.replace(".preset"));
                      
                      file.move(target);
                      

                      You could simplify it further by using .rename instead of .move

                      const presetDir = FileSystem.getFolder(FileSystem.UserPresets);
                      const file = presetDir.getChildFile("FXChains/" + pluginSharedData.lastSavedFXChainFileName);
                      
                      file.rename(file.toString(file.Filename).replace(".preset"));
                      

                      Free HISE Bootcamp Full Course for beginners.
                      YouTube Channel - Public HISE tutorials
                      My Patreon - HISE tutorials

                      OrvillainO 1 Reply Last reply Reply Quote 0
                      • OrvillainO
                        Orvillain @David Healey
                        last edited by Orvillain

                        @David-Healey I'll implement that a bit later on. Right now I'm trying to figure out why when I load my fxchain "user preset" it peforms a full state reset!

                        updateSaveInPresetComponents

                        I think it is this call.... I'm willing to bet it has a default fallback mechanism where it resets controls to default, if it isn't specified in the data you feed it.

                        So I change my FXchain load mechanism to iterate over the components manually.

                        Musician - Instrument Designer - Sonic Architect - Creative Product Owner
                        Crafting sound at every level. From strings to signal paths, samples to systems.

                        1 Reply Last reply Reply Quote 0
                        • OrvillainO
                          Orvillain
                          last edited by

                          @Christoph-Hart

                          Can I sanity check this:

                          namespace PluginUserPresetHandling {
                          
                              const UserPresetHandler = Engine.createUserPresetHandler();
                          
                              inline function onPresetSave()
                              {
                                  Console.print("onPresetSave triggered");
                              }
                          
                              inline function onPresetLoad(obj)
                              {
                                  Console.print("onPresetLoad triggered");
                              }
                          
                              inline function preLoadCallback()
                              {
                                  Console.print("preLoadCallback triggered");
                              }
                          
                              inline function postLoadCallback()
                              {
                                  Console.print("postLoadCallback triggered");
                              }
                          
                              inline function postSaveCallback()
                              {
                                  Console.print("postSaveCallback triggered");
                              }
                          
                          
                              inline function init() {
                                  UserPresetHandler.setUseCustomUserPresetModel(onPresetLoad, onPresetSave, false);
                                  UserPresetHandler.setPreCallback(preLoadCallback);
                                  UserPresetHandler.setPostCallback(postLoadCallback);
                                  UserPresetHandler.setPostSaveCallback(postSaveCallback);
                              }
                          }
                          

                          In what order are these called, and which ones are synchronous versus asynchronous??

                          Musician - Instrument Designer - Sonic Architect - Creative Product Owner
                          Crafting sound at every level. From strings to signal paths, samples to systems.

                          1 Reply Last reply Reply Quote 0
                          • OrvillainO Orvillain referenced this topic
                          • First post
                            Last post

                          14

                          Online

                          2.2k

                          Users

                          13.4k

                          Topics

                          117.1k

                          Posts