Greetings,
This might also belong in the New-Ideas thread.
I wanted to load a bunch of sound files, but realized they were not in the same folder (or even on the same hard drive), but I like what FluidLoadFolder returns so much. So I hacked it a bit to allow for the user to provide the array of SoundFile instances, rather than have the class create it from the folder.
My FluidLoadFolder class now looks like this (just the first 23 lines or so as that’s where the changes are):
FluidLoadFolder {
var path, labelFunc,channelFunc;
var < files;
var < index;
var < buffer;
*new{ |path, labelFunc, channelFunc |
^super.newCopyArgs(path, labelFunc,channelFunc);
}
setFilesArray {
arg files_array;
files = files_array;
}
play { |server, action|
var sizes,channels,maxChan, startEnd,counter;
server ?? server = Server.default;
//"files: %".format(files).postln;
if(files.isNil,{
files = SoundFile.collect(path +/+ '*');
});
and usage might look like this (~paths
is an array of strings that are file paths):
~files = ~paths.collect({
arg path;
SoundFile.openRead(path);
});
s.sync;
~loader = FluidLoadFolder();
~loader.setFilesArray(~files);
~loader.play(s,{"done".postln;});