HISE Logo Forum
    • Categories
    • Register
    • Login

    Custom Mini Preset Browser Example using FileSystem API

    Scheduled Pinned Locked Moved Scripting
    17 Posts 9 Posters 1.3k 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.
    • Casey KolbC
      Casey Kolb @musictop
      last edited by

      @musictop I think that would be precisely the use case for this kinda thing! This will work best for smaller sub-presets within a larger plugin.

      Casey Kolb
      Founder & CEO of Lunacy Audio
      Composer | Producer | Software Developer

      musictopM 1 Reply Last reply Reply Quote 1
      • B
        BWSounds @Christoph Hart
        last edited by

        @Christoph-Hart
        Legend 👐 👏

        1 Reply Last reply Reply Quote 0
        • musictopM
          musictop @Casey Kolb
          last edited by

          @Lunacy-Audio great! Thank you.

          my website: https://musictop69.wixsite.com/ilirbajri
          https://musictop69.wixsite.com/creatools
          https://musictop69.wixsite.com/orchestools

          1 Reply Last reply Reply Quote 0
          • DalartD
            Dalart
            last edited by

            Nice one, this will be useful. thanks for sharing. :)

            1 Reply Last reply Reply Quote 0
            • M
              Mwins @Christoph Hart
              last edited by Mwins

              @Christoph-Hart said in Custom Mini Preset Browser Example using FileSystem API:

              @BWSounds Have you tried this:

              FileSystem.browse(FileSystem.Desktop, true, "*.mid", function(f)
              {
                  MIDIPlayer1.saveAsMidiFile(f.toString(0), 1);
              });
              

              Track indexes are not zero-based (super confusing, but it's the MIDI standard) and you need to convert the file object that is passed into the result function to a String containing the full path.

              @Christoph-Hart I have a project that allows users to drag/drop midi files onto the interface and the plugin plays the files. This looks like what I need to actually save those MIDI files so that when the user saves their project in the DAW and re-opens the project, those MIDI files are still available. Currently, the files disappear on reload of the plugin unless they were compiled with the plugin.

              Could this be used to save and recall multiple user MIDI files? Then, to recall multiple midi files on init, could setFile be used?

              1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart
                last edited by Christoph Hart

                No if you want a midi player to be restored with the user preset you will have to connect it like a EQ with this:

                Link Preview Image
                HISE | Docs

                favicon

                (docs.hise.audio)

                DanHD 1 Reply Last reply Reply Quote 2
                • DanHD
                  DanH @Christoph Hart
                  last edited by

                  @Christoph-Hart So I've built two mini-preset browsers (thanks @Lunacy-Audio!) within the same plug in. I'm basically trying to save an LFO shape using one of the browsers, and then load it into a second LFO using the second browser.

                  Everything works, except that when I save a new .preset file in one browser, and then go into the second browser to load it into the other LFO table, the preset list has not updated to include the new .preset file.

                  So basically I'm looking for a callback function that will fetch all the relevant preset names to populate the list. I'm pretty sure its all in this script, but when I try and load bits into a button callback, I get errors.

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

                  1 Reply Last reply Reply Quote 0
                  • Casey KolbC
                    Casey Kolb
                    last edited by

                    You'll need a timer for this sort of thing where it repopulates the list every so often, like every 2000 ms or something. You could also add a refresh button like the one you describe for which you'll just need to add a button callback and then add the function populatePresetList() to that callback from the original snippet above.

                    The timer approach will require some more testing. I tried this in one of my projects and it would occasionally crash the plugin, but worth a shot!

                    Casey Kolb
                    Founder & CEO of Lunacy Audio
                    Composer | Producer | Software Developer

                    DanHD 1 Reply Last reply Reply Quote 0
                    • DanHD
                      DanH @Casey Kolb
                      last edited by DanH

                      @Lunacy-Audio Yeah I looked at a timer but then realised a callback would be perfect. I tried to use populatePresetList() but kept getting errors.... said it wasn't a function.

                      inline function onLOAD_LFO1Control(component, value)
                      {
                      	TABLEBROWSER1.showControl(1);
                      	LFOCLOSE1.showControl(1);
                      	populatePresetList();
                      		
                      };
                      
                      Content.getComponent("LOAD_LFO1").setControlCallback(onLOAD_LFO1Control);
                      
                      

                      This is the callback on the button which brings up one of the browsers. If it refreshes the list at the same time that solves my problem. It felt a bit crude just sticking in populatePresetList(); and looks like it was :face_with_tears_of_joy:

                      Interface:! Line 386, column 20: This expression is not a function! {SW50ZXJmYWNlfHwxMjQwOXwzODZ8MjA=}
                      

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

                      1 Reply Last reply Reply Quote 0
                      • Casey KolbC
                        Casey Kolb
                        last edited by

                        Ah, I forgot to mention you just need to include the namespace that encapsulates the function, so PresetBrowser.populatePresetList();. Anything outside the PresetBrowser namespace doesn't know what that function is.

                        Casey Kolb
                        Founder & CEO of Lunacy Audio
                        Composer | Producer | Software Developer

                        DanHD 1 Reply Last reply Reply Quote 0
                        • DanHD
                          DanH @Casey Kolb
                          last edited by

                          @Lunacy-Audio Brilliant thank you!

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

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

                          48

                          Online

                          1.7k

                          Users

                          11.7k

                          Topics

                          102.3k

                          Posts