I try to load multiple sounds with an array of SoundFile, but I keep getting a Error: Soundfile doesn't exist. Pleae check path when I try to initalize the array.
Here’s my function (I want it to return a SoundFile array in order to give it to an object):
SoundFile[] loadSoundFiles(String path, String[] fileList) {
SoundFile[] soundFile = new SoundFile[fileList.length]; // initialize the array
for (int i=0; i<fileList.length; i++) {
soundFile[i] = new SoundFile (this, path + "/" + fileList[i]);
}
return soundFile;
}
The error seems to be on this line:
SoundFile[] soundFile = new SoundFile[fileList.length]
fileList contains the file names, for example: {"file0.wave", "file2.wav}
The default path seems to be data/ so I need to specify ../data to go one level up, then back into data, then find the files there. If I specify data instead of ../data, it’s probably looking for data/data/vibraphon.aiff which returns the error you mention.
Thank you for the answer! Actually my code was working, the error was because I made a typo on the “path” variable… And I didn’t need to specify the data folder.