HISE Logo Forum
    • Categories
    • Register
    • Login

    New API: Server and FileSystem

    Scheduled Pinned Locked Moved General Questions
    71 Posts 8 Posters 5.8k 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.
    • Christoph HartC
      Christoph Hart
      last edited by

      Damn that‘s annoying ;)

      Change line 4389 from 6 to 9, it ran out of the predefined slots...

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

        Never mind, I've fixed it, so you can just pull.

        A 1 Reply Last reply Reply Quote 1
        • A
          arminh @Christoph Hart
          last edited by arminh

          @Christoph-Hart thanks! :) And how to exctract name or path from object? I don't see any method in API to do this :)
          Using trace gives me empty Interface log.

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

            Link Preview Image
            HISE | Scripting | File

            A object for accessing a file on disk

            favicon

            (docs.hise.audio)

            A 1 Reply Last reply Reply Quote 0
            • A
              arminh @Christoph Hart
              last edited by arminh

              @Christoph-Hart thanks a lot. I also used Filename but the result is the same as with FullPath.

              Using this

              for (f in files)
              {
                  var p = f.toString(Filename);
                  audioArr.push(p);
              }
              

              gives me links like this

              "/Users/armin/Library/Application Support/My Company/test/filez/pluck5.wav",
              
              1 Reply Last reply Reply Quote 1
              • B
                BWSounds @Christoph Hart
                last edited by BWSounds

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • A
                  arminh
                  last edited by

                  @Christoph-Hart can you add option to set own headers in Server API?

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

                    There already is Server.setHttpHeader:

                    Link Preview Image
                    HISE | Scripting | Server

                    The API class to communicate with a server

                    favicon

                    (docs.hise.audio)

                    1 Reply Last reply Reply Quote 1
                    • Dan KorneffD
                      Dan Korneff
                      last edited by

                      Is there a way to set the FileSystem.browse() startFolder to be a sub-folder?
                      I'm looking to use a button to browse to the UserPresets folder of an Expansion.

                      FileSystem.Expansions
                      

                      gets me to the root..

                      I've tried:

                      FileSystem.Expansions.UserPresets
                      FileSystem.Expansions/UserPresets
                      

                      no go.

                      Dan Korneff - Producer / Mixer / Audio Nerd

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

                        @dustbro

                        I think you just need to do something like this:

                        var folder = FileSystem.getFolder(FileSystem.Expansions).getChildFile("UserPresets");
                        FileSystem.browse(folder, false, "", function() {});
                        

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

                        1 Reply Last reply Reply Quote 1
                        • Dan KorneffD
                          Dan Korneff
                          last edited by

                          Is there anything special I have to do while using getParentDirectory?

                          I'm trying to get the directory of a file, but it's returning the full file path with file name.
                          e.g. C://Folder/audio.wav

                          Same as if I call FullFilePath

                          Dan Korneff - Producer / Mixer / Audio Nerd

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

                            @dustbro Example please

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

                            Dan KorneffD 1 Reply Last reply Reply Quote 0
                            • Dan KorneffD
                              Dan Korneff @d.healey
                              last edited by

                              @d-healey Trying to get a label to display the parent directory of some audio files.

                              const var DirectoryLabel = Content.getComponent("DirectoryLabel");
                              const var Browse = Content.getComponent("Browse");
                              
                              const var FullPath = [];
                              const var ParentDirectory = [];
                              
                              inline function onBrowseControl(component, value)
                              {
                                  if(value) //if button clicked
                                  {
                                      //open file broswer
                                      FileSystem.browseForDirectory("", function(directory)
                                          {
                                              
                                              local files = FileSystem.findFiles(directory, "*.wav", false);
                              
                                              for(f in files)
                                              {
                                                  FullPath.push(f.toString(File.FullPath));                   //push full path
                                                  ParentDirectory.push(f.toString(File.getParentDirectory));  //push parent directory
                                              }
                                          });     
                                             
                                  }
                              	
                              };
                              
                              Content.getComponent("Browse").setControlCallback(onBrowseControl);
                              
                              HiseSnippet 1096.3ocsV01aaaCDlxwpH1cdnEXec.B9SxCY9kt1tADTTu3DODrlTi3rhALLzRKQESDJRAR5jYTDf8Sa+j1+fsihRVx1JYsFX7a26O2wi2wIRQ.QoDRjSiKWlPPNeg6zkb87QywTN5ziMLRvRBWeIQoQGsLAqTjPjiyd+jQCmF0Qom+90GgYXd.ofEB8NAMf7FZLUWvcxvelxXiwgjKowkz94COMPvGIXhE.Z1ysOJAGbM9Jx4XiZ0bQNO5jPpVHmpwZhBz4HQ3xoyE2xs5+NphNiQLDCPSAGYYiFMmxBmjmoJDxo9jh7dOad+UtmQCoq3Wj+OIUfWgEkqAN0VGR0WCRCtOHMVvBMN3dfmSI3U2Bum5NMPRSzERLX6wtmx0DYDFJ6kgkUWTsWT2cj.zfq6FiulLVBDqrv+k86ef2y52uygsZ1pIT7UZuavRuioRR.jTKeCdFg48JubebEQORDmH3.ge60UqswKE93Ho3VE4ds0Jt8lQd7BFaBVOGr6298072jzdvUgLWgVMobFkS7hVvCzTA2Svs91DWof4GjGzC.+vVP5zp4Ga0zCNzHeKGud8nQdyVn0f8ALZv0jPqJYZZN85IRHbuHJi3MSJT2RjEBGCbmtToIwcmkF8wB4Jr52t8AqvmeXN6NEluQnxOaygIBvrTLnfJPonFQ4gFRUg+Ovq82z8V7MlfiYJhsVuoGiDR+HOpMwTc1VgJvUZFmcS0MYgZteTWsXpVR4W4aPQ2boc5bXE11qmwHnjvXdIfVUGgMtwqNPPW0F5kFxrHXGb4spjrUbta8PeWFb2BPVFf1MZ07tz53C2V2UYXm1.NByXyfAY9azX14vRsrmKzj2x86z7iMaz7tldaJJJpRYYthQjUJ1LeU9PF5yWDOiHyeYjqHLzY8oZO9SapVfslTRQA+TNU+V3giktXtmQlMqyk1GsJYKypHGKyMM0pPsBVaOVEkcmYFvloNnpNc75WlMd8nzg.HJfw8cs2WnzhS4sZne4ziwZbte.WBgIgH0TSwx4XxMvVO6X6FtGSTWqEIvBrU8IHG2+6n9GEQb3vkqH9qKFRUmIhA2fk.amZnR9ceqeak42zAyot8ItqOstj6+PTI2+mWL7VZndN.QmqcPn4D5UyM.14qAoDnq.mdw6rGlQuhGmF0G4xHQPYc6sVvtSQ3BFVu9BUyOGxD.8iqs4xrchqn5kk+YwmwV19UtkcPUsCehv8otSn5f4Ui2ZUfWnu3+a7l8mkVtmDEA2pEfst63ecW+fxmATtPrPCyfOCCihgNI2yWDOE91V.APBmSXJSGSMySNKceCsoxLkvCSI9G3jIbfg1IS3fbgnXbfT79.6CUyuh1OkCfId5GBa3dlg1aP9CTW29c6ihgOq89f.So3aArWsMOaGr461Aad9NXyK1Aad4NXy2uC17COnMl+I+iKzhX6yDfwjSRGT53bB2L2HsiD8uvBkWeC
                              

                              Dan Korneff - Producer / Mixer / Audio Nerd

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

                                The toString() function takes a single number as a parameter, for example File.FullPath is a built in constant that returns 0 - you can test this with Console.print(File.FullPath);. Docs - https://docs.hise.audio/scripting/scripting-api/file/index.html#tostring

                                File.getParentDirectory() returns a file object. Passing this to the toString() function which expects an integer is going to give the same result as passing the number 0 or undefined to toString() because it doesn't know what to do with a file object.

                                What you probably want is ParentDirectory.push(f.getParentDirectory().toString(File.FullPath));

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

                                Dan KorneffD 1 Reply Last reply Reply Quote 1
                                • Dan KorneffD
                                  Dan Korneff @d.healey
                                  last edited by Dan Korneff

                                  @d-healey said in New API: Server and FileSystem:

                                  What you probably want is ParentDirectory.push(f.getParentDirectory().toString(File.FullPath));

                                  :clinking_beer_mugs:

                                  Dan Korneff - Producer / Mixer / Audio Nerd

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

                                  30

                                  Online

                                  1.8k

                                  Users

                                  12.0k

                                  Topics

                                  104.6k

                                  Posts