HISE Logo Forum
    • Categories
    • Register
    • Login

    Deleting a preset

    Scheduled Pinned Locked Moved Scripting
    5 Posts 2 Posters 95 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.
    • S
      Sampletekk
      last edited by

      Let's say that I want to delete a preset named "half.preset", what would I put in "deadFile" and how?

      HiseSnippet 993.3ocsV08aaaCDmxIZqx6CrBz+.D7SxCAt1NowoXnnd9qMiMmHLm1s8TGszoXhHQZPRkTggBr+j2K64siRx1xKtaCFq9ACe286t6Gui2Q6KEAfRIjDq5WmsBHVep87Ltd4vkTFmLcDw5Sr8GbMnzifXxfrUTkBBIVVG8MF.VNGSx+76ub.MlxCfspHjWKXAv2yRX5sZ86+cr33IzP3ZVREzm0eZffOTDKRQxbjcaxJZvszafKoFX0rIeKUsjX8k1sOqSTzy6Q6E.cOKr24c6AgKftQmFEbQuvvSi5DE184W7Lh0GMNjoEx4ZpFTDqiGHByluTbOuHAuloXKhAiPGxbLyEpmHhCMGQiVxvkr3P+0UIEAih+1Z1QE0rmXOiEx1neas6KxM3t0ipEPqZ6Rui1gdcpRu1Un2dnjUEJcbAkdr87.Iakdqkhd4TtFjQTrOUkJEXI09iZ1CEHBttUB8VXhDE13g24saehK9Uyupd86nR2IrXXDSBA3gHy8E4xyyTZHo0MfNuLJ8pn7UJP5KAEnUMMH7oRLSahfGFW7JfR6ZB9pbf9T8xxHuAWKsXtVx323sq5IowwF7F5UmwiYbvMJkGnYBtaHDCZXXpzjxBR30r9uV2YL+FDXKEV2+YPco3GY7Pw8dMv5PDSlz3D2FiDtYhT26obsqVTFJW8RvMnHdkj8kH30IzC0rBOLPy5NXVbXQtUU43DBzPC+aUDNyOuRtSsv4c3Wuqd8m9zQEYb2r8finfuPyKfZZhRQrWfHAyH5yIXMMNExOw4boTzw000vk8TbvbiEx0WGv10v0AyqwlD0nYKkwRd5FRiiWfCsdOjIldREhdoPCWwKZ.3Qz8uaJJZu1JCVLdsZelMKTj+SN5wSSV.xpECCPbnY2IQ62+jX0EEAE0lJ.E7obl9pU.+8s9fTVPwe8poinZpY7sTGhaEH0LCErFA2gKOKFlcrGApa0hU4XK6BDqOVma8yKG0Gjp0BNgEZly2z.HucyN1e619YaD5+K80vawn7H6RfJ5cvTdQ6u3.xTyDIXpnxrxyyCWzfq3DgowT8t68LuNTZ.aA6rrwrPgqX5rpud7+1xv+qT7w19Lcvx8ywZ6giXi5CAGKeB4yrGGEgy9aI3w1S9oOLuWP9AQpF2eNihqQwqG1WllLGe1M.vry4PrYDvpl4xZgbairoBLG3g4B+I9ozXGirUowNqMRRnARwaBJF7LOR8nbMHm34On6XOyH61gjOLVsNmfuY9lffcC0Cbr6g53oGpimcnN9rC0wyOTG6cnNdw+til+RyWmpEIEiMDxL+w4axrrFyo3Mv7aqj+hrx..o
      
      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @Sampletekk
        last edited by d.healey

        @Sampletekk Use the preset handler's post callback to keep track of the currently loaded preset file.

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

        S 1 Reply Last reply Reply Quote 0
        • S
          Sampletekk @d.healey
          last edited by

          @d-healey Yes, but what goes in the deadFile? Full path to preset as a string? Like:
          deadFile = "/Users/PersMac/Desktop/Utvecklingsprojekt/Hise Projects/CustomPreset/Bank1/Cat1/half.preset"

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

            @Sampletekk said in Deleting a preset:

            Yes, but what goes in the deadFile? Full path to preset as a string? Like:

            A file object.

            When you change preset the preset handler's post callback will give you a file object reference to the preset that was loaded. You can store this in a variable. Then when you want to delete the current preset you will call currentPresetFile.deleteFileOrDirectory();

            You can see an example here of using the post callback - https://codeberg.org/LibreWave/RhapsodyBoilerplate/src/branch/main/includes/Presets.js#L40

            If you want to use a path then you first need to convert it to a file object using FileSystem.fromAbsolutePath();

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

            S 1 Reply Last reply Reply Quote 0
            • S
              Sampletekk @d.healey
              last edited by

              @d-healey said in Deleting a preset:

              currentPresetFile.deleteFileOrDirectory();

              Thanks! That worked!

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

              12

              Online

              1.7k

              Users

              11.9k

              Topics

              103.6k

              Posts