Hello,
I am developing a plugin and I need to load a complete folder since the beginning of the code, not with a button. Something with relative routes or similar. How can I do that?
The plugin has to work in any computer.
Thank you very much!!
Hello,
I am developing a plugin and I need to load a complete folder since the beginning of the code, not with a button. Something with relative routes or similar. How can I do that?
The plugin has to work in any computer.
Thank you very much!!
What do you mean when you say you need to load a folder? What are you trying to do?
We are trying to load 612 HRTF .wav files from a folder. We are loading that folder with a filebutton, but now we need to do it automatically.
Here is the way we are doing that.
SFilepath chnget “loadfolder”
if changed:k(SFilepath) == 1 then
gSSamplePath = SFilepath
printks SFilepath, 0
event “i”, 1001, 0, 0.1
endif
;when user has selected folder, load them into function tables
instr 1001
prints “Loading files to function tables”
iFirstTableNumber = 10
SFilepath chnget “loadfolder”
kTrig = 1 ;using k-rate version because of bug with i-rate version
gkNumTables ftsamplebank SFilepath, iFirstTableNumber, kTrig, 0, 4, 1
gSFiles[ ] directory SFilepath, “.wav”
giHRTF ftgen 2,0,0,1,gSFiles[0],0,0,0
endin
If you know where the folder will be located in relation to the .csd you can hard code SFilepath yourself? For example:
instr 1001
prints "Loading files to function tables"
iFirstTableNumber = 10
SFilepath = "/Samples"
kTrig = 1 ;using k-rate version because of bug with i-rate version
gkNumTables ftsamplebank SFilepath, iFirstTableNumber, kTrig, 0, 4, 1
gSFiles[ ] directory SFilepath, ".wav"
giHRTF ftgen 2,0,0,1,gSFiles[0],0,0,0
endin
In this case Csound should load all the files in a folder called Samples that resides in the same folder as your .csd file.
If i do it this way… it works.
prints "Loading files to function tables"
iFirstTableNumber = 10
SFilepath = "/Users/thomasviana/Documents/Thomas Viana/Universidad/Proyecto de Grado/Samples"
kTrig = 1 ;using k-rate version because of bug with i-rate version
gkNumTables ftsamplebank SFilepath, iFirstTableNumber, kTrig, 0, 4, 1
gSFiles[ ] directory SFilepath, ".wav"
giHRTF ftgen 2,0,0,1,gSFiles[0],0,0,0
But, it doesn’t work just by typing …SFilepath = “/Samples”. There is an error opening directory.
Any help?
Try “Samples/”
What you were using “/Samples” is probably trying to look at the root of your file system for a folder called samples, rather than in the relative location.
Perfect! It worked!
Thank you!
No problem, easily overlooked by anyone.