Page 1 of 3

Folder scanning ?

Posted: Thu Mar 05, 2020 8:34 pm
by lalalandsynth
So I made a "thing" that when I load say a wavefile into a sampler (One shot) It scans the whole folder of wavefiles where the loaded file originates. Then I make knobs that select Next - Previous wave file in that folder.
It works but I am 100% sure that its a hackjob and very inefficient and way too many triggers .

"Works in the sense that it scans the folder , but always starts from the first file and is not aware if the first file loaded was number 5 for example"

Has anyone made one of these or are there maybe preexisting modules that solve this in an elegant way ?

I can upload my hackjob but its from the Alpha.


PS. Wish I had some Ruby skills, seems like that would make this particular task much easier.

Re: Folder scanning ?

Posted: Thu Mar 05, 2020 9:03 pm
by MichaelBenjamin
.

Re: Folder scanning ?

Posted: Thu Mar 05, 2020 9:34 pm
by lalalandsynth
Well , its a hackjob in the sense that I am pretty sure it could be simpler, maybe not ?

I guess the problem is : 10 files in a folder , I load number 5 . As I load that , it will scan the folder .
If I now use the Next Previous it will start on file 1 and advance through the list rather then start from 5.
Apart from that , it works :)

And yeah , I was hoping that someone had dealt with this before and might have a solution that would be more elegant and most of all , be aware of the number for the first loaded file.

in fact I think something like this should be a prim .

my mess.
Mess.jpg
Mess.jpg (142.64 KiB) Viewed 17116 times

Re: Folder scanning ?

Posted: Thu Mar 05, 2020 9:45 pm
by MichaelBenjamin
.

Re: Folder scanning ?

Posted: Thu Mar 05, 2020 9:51 pm
by lalalandsynth
Its a sampler where you can dragndrop files into it when using so the folder is always changing.
So you might start with dragging number 5 from the folder.

Re: Folder scanning ?

Posted: Thu Mar 05, 2020 9:53 pm
by MichaelBenjamin
.

Re: Folder scanning ?

Posted: Thu Mar 05, 2020 10:01 pm
by trogluddite
MichaelBenjamin wrote:or do you just want some fancy ruby oneliner from trog?;)

But you could call the "glob" method! Say it over and over a few times; "glob, glob, glob"- You see? It's worth it just for the name alone! :lol:

Re: Folder scanning ?

Posted: Thu Mar 05, 2020 10:03 pm
by lalalandsynth
My problem is that the list is loaded independent of the selected file , if that makes sense?
I load the file , extract the folder name , scan the folder but that list is not aware of what file was loaded.
I am fully prepared to learn that I am just doing it in a stupid way :P

I cannot know the index of the loaded file...not with my method anyway.

Re: Folder scanning ?

Posted: Thu Mar 05, 2020 10:09 pm
by lalalandsynth
MichaelBenjamin wrote:
edit:
these prims should all that's needed besides some counterfiddling and proper trigger refresh


This is pretty much what I am using, although I am sure I could simplify .

Re: Folder scanning ?

Posted: Thu Mar 05, 2020 10:14 pm
by trogluddite
What's the reason for needing to know which file was dragged first? Do you need to cycle through them in a particular order or something?

EDIT: Ah sorry, I see now - I'd missed the bit where you mentioned it!