HISE Logo Forum
    • Categories
    • Register
    • Login

    Audio files sorting

    Scheduled Pinned Locked Moved General Questions
    12 Posts 3 Posters 658 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.
    • R
      rzrsharpeprod @d.healey
      last edited by

      @d-healey said in Audio files sorting:

      @rzrsharpeprod sortWithFunction is the name of the command you want, I think

      Thankyou! I will give this a go when I get home later

      Much appreciated as always

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

        Here's a function I'm using to sort files by name

        inline function sortFiles(a, b)
        {
            if (a.toString(a.NoExtension) < b.toString(b.NoExtension))
        	return -1;
            else
        	return a.toString(a.NoExtension) > b.toString(b.NoExtension);
        }
        

        And you'd call it like so:

        Engine.sortWithFunction(files, sortFiles);

        Here files is an array of file objects.

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

        ustkU R 2 Replies Last reply Reply Quote 1
        • ustkU
          ustk @d.healey
          last edited by

          @d-healey And I've made my own functions dozens of time... Sometimes I just hate myself, and right now is sometime... 🙄

          Hise made me an F5 dude, browser just suffers...

          1 Reply Last reply Reply Quote 1
          • R
            rzrsharpeprod @d.healey
            last edited by

            @d-healey said in Audio files sorting:

            Here's a function I'm using to sort files by name

            inline function sortFiles(a, b)
            {
                if (a.toString(a.NoExtension) < b.toString(b.NoExtension))
            	return -1;
                else
            	return a.toString(a.NoExtension) > b.toString(b.NoExtension);
            }
            

            And you'd call it like so:

            Engine.sortWithFunction(files, sortFiles);

            Here files is an array of file objects.

            Sorry I took a while to get around to this.

            I have added the inline function to the script and also called it as you suggested. It compiled with no errors but it hasn't done anything in DAW regarding the sorting.

            I am using your convolution reverb CmbIr drop down method if that helps @d-healey.
            I changed file to "items" in the callback as the reverb array is named that as per your tutorial but the reverbs weren't sorted by name as I expected they would be.

            I am almost certainly doing something stupid and not changing a reference in your script or something but I am unsure what.

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

              @rzrsharpeprod Post a snippet

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

              R 1 Reply Last reply Reply Quote 0
              • R
                rzrsharpeprod @d.healey
                last edited by

                @d-healey said in Audio files sorting:

                @rzrsharpeprod Post a snippet

                Why is my snippet so big?!? I know I have done something stupid and silly.

                This is a mega stripped down version from the project. In Hise the files are sorted alphabetically but in FL studio they are sorted in a random way.

                HiseSnippet 2321.3oc6ZEzaabbEdoj1XyM1INNN2ZAlJzCTnxJjxJNwv01qDEYLSojHHokqQPgwvcGRNP6tylYmUVxAFn+C5whbq250donW0g9CoW6M+On8MyrK2conTTDTTrS7BHhcl48l227du48dyrpCm4PhhXbiRk6eXHwnz0L6cXfXb8wXZfQqMMJ8wl8BnggDAZHiK+K12XiCCwQQDWiRkl+KkDVp7BFpmW+nMvd3.GRVWFF6xnNj1TepHq2N1+ApmWSrKoO0OG0qY2xgETm4whAPMuYUiPryd3QjswRxlyznz60vkJX7dBrfDYTZgMXtG1aL6EAZ52kFQG3QjMpYzClHc2MYdtRDK60n9XpmamzEejgQIyNYph40phaYtE0kNo+LUxMTCfx3Hu9nzbEg27EfWs7vqZN3MCHUJGjVPCoOxrmCmFJxFQhm22rUffvGhA0ddnno0Xt+87l0Y.EAhU7w6QZxgFS3nxcqVcYzZqVco6aY8oeZqtH.1BKKvJDIP6i4Hf28YdwBJKnKYeBePMzCPJujUFQDqG6RY8v9gdjInpxh43AkvzhRAnmUJOBlhFAinAjU7XXW0jzj5Qh.bw5vXdUzvA4v7GvPCXGjvpi+fVbf4zEDff5L+PV.znxhpQUBhF3ASNZXbfiBDr.0XR13vr6jxyxvRzKlrj02ZUlNDUQ0B8PT0krJW93q7UhHBINq.KguVS6sQ09SfDKW15UfbOUbI4NAA0wddC.O6JEAlRGIaKIsxhTAwOZwkQKpV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HYNlepf5kgsyIcpf0Vx65TQyO4aUWZNuou5qn3gCkPBRdcofRerCm8bG8E1Jw5UU8.nLPsQrr4Vx1nZo+OAXZVckpvlOW5ycbjAJucMCiYyypmCdty4fm0NG77YmCdt64fmO+bvyWbp7H+pRqGCU5nutCniNMzNVklTHUo4M9+bypmJA

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

                  @rzrsharpeprod Insert it in code tags, this button d2c3ca61-d042-4505-b230-a6be1f6fddb6-image.png

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

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

                    Engine.sortWithFunction("items", sortFiles);}

                    You've passed a string "items" as the first parameter. You need to pass an array. Also you have an extra curly brace at the end.

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

                    R 2 Replies Last reply Reply Quote 0
                    • R
                      rzrsharpeprod @d.healey
                      last edited by

                      @d-healey said in Audio files sorting:

                      Engine.sortWithFunction("items", sortFiles);}

                      You've passed a string "items" as the first parameter. You need to pass an array. Also you have an extra curly brace at the end.

                      See - something silly...

                      I must have left the extra bracket at the end when I removed the rest of the code as I was trying to keep the snippet as small as possible.

                      1 Reply Last reply Reply Quote 1
                      • R
                        rzrsharpeprod @d.healey
                        last edited by

                        @d-healey said in Audio files sorting:

                        Engine.sortWithFunction("items", sortFiles);}

                        You've passed a string "items" as the first parameter. You need to pass an array. Also you have an extra curly brace at the end.

                        I switched it to the array and it now sorted them correctly in the test plugin so I just need to make the change in the actual plugin now.

                        Thankyou for your help. As usual it is very useful and much appreciated

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

                        13

                        Online

                        2.0k

                        Users

                        12.6k

                        Topics

                        109.7k

                        Posts