Get Filename while using Sampler
-
Hey Gang,
Im using a modified setup of the CustomSampleImport demo project. It looks as though it brings files in via Absolute Path instead of saving Samplemaps, cool. How do I then display file names via a Label? I see the "getFilename" for the "AudioSampleProcessor" in API. Is this something I can use?
-
It looks like AudioSampleProcessor can only be used with Loop Player and Convolution Reverb (according to the documentation).
Does anyone know a way to call back the absolute path/filename?
-
I think FileSystem is the way to go. Still having some trouble though. Im watching @d-healey filesystem & api video but am having trouble implementing the "FileSystem.Filename" function.
Here is my code
const getSampleLoc1 = FileSystem.getFolder(FileSystem.AudioFiles); const getSampleName1 = getSampleLoc1.getChildFile(getSampleLoc1.Filename); Console.print(getSampleName1);
It compiles and it does print but it prints "Objxc6f952f8" instead of a list of the file names on the given folder.
Where am I going wrong and how far off am I?
-
@trillbilly
FileSystem.Filename
is a constant not a function. https://docs.hise.audio/scripting/scripting-api/file/index.html#tostring -
@d-healey Ok. Maybe going in the right direction? I am now returning "3" in the console print lol...
const var SampleNamecmb1 = Content.getComponent("SampleNamecmb1"); const getSampleLoc1 = FileSystem.getFolder(FileSystem.AudioFiles); const getSampleName1 = getSampleLoc1.Filename; inline function onSampleNamecmb1Control(component, value) { File.toString(getSampleName1); }; Content.getComponent("SampleNamecmb1").setControlCallback(onSampleNamecmb1Control); Console.print(getSampleName1); //Console prints "3"
EDIT: Come to think of it, I think Im doing this all wrong. I need to look for the Absolute Path/FileName so that when a custom sample is loaded, it still reads the correct file name.
-
@trillbilly
Filename
is a constant (actually it's an enum) with the value of 3, so if you print it to the console you will see 3. You need to use it with thetoString
function that I linked to previously. -
@d-healey Thanks. Sorry, I'm away from my studio right now. Do you mean I replace the Filename with the toString function?
-
@trillbilly No you need both, don't I do this in the video?
-
@d-healey Possibly, I went through it via the titles, I was limited on time. Ill have a bit more time early next week to jump on it again. Thanks.
-
@trillbilly I just had a look, timestamp is 17:48, the chapter title is
toString