New API: Server and FileSystem
-
I'll take a look tomorrow.
-
@Christoph-Hart said in New API: Server and FileSystem:
You need to create a reference to the folder first:
const var audioFiles = FileSystem.getFolder(FileSystem.AudioFiles); FileSystem.findFiles(audioFiles, "*.wav", true);
Also use the constant
FileSystem.AudioFiles
instead of"AudioFiles"
.Can we do this with MIDI FILES?
-
Are you talking about embedded Midi files or files on the user‘s disk?
Embedded files should be retrievable with MidiPlayer.getMidiFileList() - it‘s not implemented yet but it will follow the same logic as Sampler.getSampleMapList().
-
@Christoph-Hart you had a chance to check why consts not working properly?
-
@Christoph-Hart said in New API: Server and FileSystem:
Are you talking about embedded Midi files or files on the user‘s disk?
Embedded files should be retrievable with MidiPlayer.getMidiFileList() - it‘s not implemented yet but it will follow the same logic as Sampler.getSampleMapList().
Files on a user's disk. Really a way to save or create a path for midi files.
-
-
@Christoph-Hart ok audio files work but desktop not :)
constant not found: FileSystem.Desktop {SW50ZXJmYWNlfHwyMzJ8MTB8NjU=}
Is there option to show file name of object?
-
Damn that‘s annoying ;)
Change line 4389 from 6 to 9, it ran out of the predefined slots...
-
Never mind, I've fixed it, so you can just pull.
-
@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. -
-
@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",
-
This post is deleted! -
@Christoph-Hart can you add option to set own headers in Server API?
-
There already is
Server.setHttpHeader
:https://docs.hise.audio/scripting/scripting-api/server/index.html#sethttpheader
-
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.
-
@dustbro
I think you just need to do something like this:
var folder = FileSystem.getFolder(FileSystem.Expansions).getChildFile("UserPresets"); FileSystem.browse(folder, false, "", function() {});
-
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.wavSame as if I call FullFilePath
-
@dustbro Example please
-
@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.+vVP5zp4Ga0zCNzHeKGud8nQdyVn0f8ALZv0jPqJYZZN85IRHbuHJi3MSJT2RjEBGCbmtToIwcmkF8wB4Jr52t8AqvmeXN6NEluQnxOaygIBv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