HISE Logo Forum
    • Categories
    • Register
    • Login

    Proper Written Documentation of API is needed besides Updates

    Scheduled Pinned Locked Moved Feature Requests
    19 Posts 3 Posters 686 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.
    • Tania GhoshT
      Tania Ghosh
      last edited by Tania Ghosh

      Besides update and fixing bugs a good documentation and Examples is must needed.

      For example : FileSystem >Browse

      FileSystem.browse(var startFolder, bool forSaving, String wildcard, var callback)
      

      Unable to figure out the arguments.

      Same for other APIs e.g

      File, FileSystem

      Example and proper written doc is must needed.

      Tania Ghosh

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

        @Tania-Ghosh how is this (already in the file system documentation) not what you need:?

        FileSystem.browse(var startFolder, bool forSaving, String wildcard, var callback)

        This will create a file browser from the OS that let's the user choose a file for loading or saving (in case of saving it will confirm a overwrite).

        the startFolder parameter can be either a File object or one of the special location constants of the FileSystem API object. If you pass undefined it will choose a sensible default (most likely the most recent location).

        the forSaving parameter decides whether the file is supposed to be overwritten or just read from.

        the wildcard parameter is a file wildcard (like eg. *.txt for all text files) and can be used to filter the files being displayed. If the wildcard is an empty string, it will show all files.

        the callback parameter is a function with one parameter that will be executed when a file has been chosen.

        HISE Development for hire.
        www.channelrobot.com

        Tania GhoshT 1 Reply Last reply Reply Quote 1
        • Tania GhoshT
          Tania Ghosh @Lindon
          last edited by

          @Lindon Hmm.. But unable to figure out var callback and var startFolder

          E.g
          FileSystem.browseForDirectory(var startFolder, var callback)

          Tania Ghosh

          LindonL 2 Replies Last reply Reply Quote 0
          • Tania GhoshT
            Tania Ghosh
            last edited by Tania Ghosh

            @Lindon I would like to Access C:\ from a Button...

            How would I access it from interface?

            Content.makeFrontInterface(500, 400);
            const var Button1 = Content.getComponent("Button1");
            
            inline function onButton1Control(component, value)
            {
               
            };
            
            Content.getComponent("Button1").setControlCallback(onButton1Control);
            

            Tania Ghosh

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

              @Tania-Ghosh
              so the documentation states:

              the startFolder parameter can be either a File object or one of the special location constants of the FileSystem API object.

              So go look in the documentation for the File object, or go look at the documentation for the FileSystem, where you will find:

              FileSystem.getFolder(var locationType)

              You can use this method to access files from one of the given locations (take a look at the Special Locations above for a list of available folders).

              ..and it even links you to the special locations, where you find:

              Special Locations
              In order to access files, you will need to use the constants of the FileSystem object in order to go to special locations.

              Location Description
              AudioFiles The audio file folder. In HISE it will be the repo folder, but in the compiled project it will be a sub folder in the appdata folder.

              Samples The sample folder as specified in the settings (or the subfolder of the HISE project during development).

              AppData The app data directory. This is the main directory for your project which will house the configuration files and user presets.

              UserHome The user home folder. Documents The user's Document folder.

              Desktop The user's desktop folder.

              Downloads The user's download folder.

              HISE Development for hire.
              www.channelrobot.com

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

                @Tania-Ghosh said in Proper Written Documentation of API is needed besides Updates:

                @Lindon I would like to Access C:\ from a Button...

                How would I access it from interface?

                Content.makeFrontInterface(500, 400);
                const var Button1 = Content.getComponent("Button1");
                
                inline function onButton1Control(component, value)
                {
                   
                };
                
                Content.getComponent("Button1").setControlCallback(onButton1Control);
                

                There is no such thing g'teed to be there as "C:" - so you're code will break on some users machines.. use one of the special locations.

                HISE Development for hire.
                www.channelrobot.com

                Tania GhoshT 1 Reply Last reply Reply Quote 0
                • Tania GhoshT
                  Tania Ghosh @Lindon
                  last edited by

                  @Lindon Then C:\Users\Tania\AppData\Roaming\PluginsName

                  Tania Ghosh

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

                    @Tania-Ghosh said in Proper Written Documentation of API is needed besides Updates:

                    @Lindon Hmm.. But unable to figure out var callback and var startFolder

                    E.g
                    FileSystem.browseForDirectory(var startFolder, var callback)

                    if you dont know how to use the var callback - you should go read some javascript documentation about function calls.

                    HISE Development for hire.
                    www.channelrobot.com

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

                      @Tania-Ghosh said in Proper Written Documentation of API is needed besides Updates:

                      @Lindon Then C:\Users\Tania\AppData\Roaming\PluginsName

                      Write. Some. Code.

                      simple console print statements that show you the values for the special locations on your machine...

                      ..and read the documentation it clearly states:

                      AppData The app data directory. This is the main directory for your project which will house the configuration files and user presets.

                      HISE Development for hire.
                      www.channelrobot.com

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

                        so this:

                        FileSystem.browse(FileSystem.AppData, false, "*.txt", function(result)
                        {
                            // the parameter is a File object, so we just show it
                            // in the OS' file browser.
                            result.show();
                        });
                        

                        Which by the way is taken almost entirely from the existing documentation...

                        HISE Development for hire.
                        www.channelrobot.com

                        Tania GhoshT 1 Reply Last reply Reply Quote 1
                        • Tania GhoshT
                          Tania Ghosh @Lindon
                          last edited by Tania Ghosh

                          @Lindon

                          Content.makeFrontInterface(500, 400);
                          const var appDataFolder = FileSystem.getFolder(FileSystem.AppData);
                          const var presetsFolder = appDataFolder.getChildFile("User Presets");
                          
                          const var Button1 = Content.getComponent("Button1");
                          
                          
                          inline function onButton1Control(component, value)
                          {
                          	FileSystem.browse(presetsFolderUser, false, "*.preset", function(file)
                          	
                          };
                          
                          Content.getComponent("Button1").setControlCallback(onButton1Control);
                          

                          What I am doing wrong here?

                          Tania Ghosh

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

                            @Tania-Ghosh The last parameter needs to be a function. A function looks like this function (parameters) {}

                            Remember this is a parameter inside the .browse function call so you also need to put a closing parenthesis like you would for anything other function call.

                            There are plenty of example of this kind of thing on the forum. Here for example: https://forum.hise.audio/topic/2807/new-api-server-and-filesystem?_=1618742189142

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

                            Tania GhoshT 1 Reply Last reply Reply Quote 0
                            • Tania GhoshT
                              Tania Ghosh @d.healey
                              last edited by

                              @d-healey

                              HiseSnippet 962.3ocsV0saaaCElxwpXVctXEXO.B9JkAOC4sztALLrj3XO3skTio1hdWAsDsMQnHEDoRpQQA1i7dC1NTTxhJwsK0.yW4yu76b347QsHWDSjRQNxo2K2lQPNeoazVtZyjMXJGM+BjySbuDKUjbeipy2lgkRRBxw4neUqvoWWT4u+9WNGyv7XRiJD50BZL4OnoTUi1Em96TFaFNg7RZpk2mb57XAehfIJ.7bjaHJCGeMdM4Jr1sNtHmGMMgpD4QJrhHAeNWjrMZi3Vtw+WSkzkLhVXLJBRjQMZxFJKYQcsJQHmtKZp7iLU9W6dIMgtSeSG3qJM32DgcOvoSaH0sEjF+wfzLAKQmfOB7brfWWC7dpaTbNMS0XQisG6NmCWNqvPa2FVFeQcV2wch.7fqFkhulLKGD1EQvyBCG5eRX3w+TeOn0KU92fy8wYYWfU3RHl6+y9ynLRzVXFHczZhxnNvR4YF+amjrbhjnj6RRqjpySYQqyRvfWIAWVXBXfNM1I57BkRvGContPzAKRyDbPHXPk8p356Q4LJm3upfGqnBtufW4gN7bAKHtN1gP9YEji66899d8rJnk4hakjfVkfFiC8WgYRxP+AeyHiwAC2cPAfhBl5XCJ9fFN8z+6+.0ijZ8kHaBlwVBS7A2Ex0kVeOqp5Jgh7Bdvwdu2qm2G77uqoUq1qspTxfqv8YVuQl+oBLfWjtT2JL8tZGgwz16AO9gsGDa5NVNJ3y4T0KxHUxMaJZalpt1ZHZWwZqpoFs0VVZ6wsFU2eQDUc6oWIqbGbUUtP9jpERycEhBXrma0EGpr6XyMhd0b87echfbBmSFIWQ0cKmKH2.DklM8dtWPjWqDYk9VMx.beOfi8cMG4uc51cB+07Sukln1fbbcdCHugPWuQokddIg78Ha.JOQRACqZyCpI7qL.CEsHbzjJbIUs0tn+LHGC2K4338cm7.g6ScWPUwa1Od6rG7B2M+ei2pmZ56Nc0JRrpArccm8lC8ckOCn7mhBEku9RrJmByJtWUjFAu1FS.jv4DlTOSzQO2ajC0x5NSDgmTJ7OvuJii0xNUFGWaDkhiyEuM1rsneL6KJ0.XhW9NdO3CJ.Y+cKIttgiBQovaruMNV2J9V.66Olu6.h46OfXN4.h4YGPLO+.h4GNfX9wOYL5Ou4rBkH0rlzv0ALn.StsfqyiZOQa+AHkm0bdB4c0CCvzatxdCaJOwlfXVAicOezJuieQWSt0Vt7LgRxV2YJXndYghXSHNmeCvwZVoPWtXZIGriyTNFVdLZ+WDiBDfK
                              

                              Not working

                              Tania Ghosh

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

                                @Tania-Ghosh That's the same code in your last post. You haven't written the callback function properly and you haven't put the closing parenthesis on the .browse function call. Take a look at the examples in the link I posted.

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

                                Tania GhoshT 1 Reply Last reply Reply Quote 0
                                • Tania GhoshT
                                  Tania Ghosh @d.healey
                                  last edited by

                                  @d-healey Sorry but didn't understand...

                                  Tania Ghosh

                                  Tania GhoshT 1 Reply Last reply Reply Quote 0
                                  • Tania GhoshT
                                    Tania Ghosh
                                    last edited by

                                    Found from this post

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

                                    Tania Ghosh

                                    1 Reply Last reply Reply Quote 1
                                    • Tania GhoshT
                                      Tania Ghosh @Tania Ghosh
                                      last edited by Tania Ghosh

                                      @d-healey Ok Done... Prob Solved.

                                      Thank you :)

                                      Tania Ghosh

                                      1 Reply Last reply Reply Quote 0
                                      • Tania GhoshT
                                        Tania Ghosh
                                        last edited by

                                        @Lindon . Thank you man for nice Explanation. (y)

                                        Tania Ghosh

                                        LindonL 1 Reply Last reply Reply Quote 1
                                        • LindonL
                                          Lindon @Tania Ghosh
                                          last edited by

                                          @Tania-Ghosh any time.

                                          HISE Development for hire.
                                          www.channelrobot.com

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

                                          53

                                          Online

                                          1.7k

                                          Users

                                          11.7k

                                          Topics

                                          101.8k

                                          Posts