Reputation: 23
I am having some trouble importing audio for my game in processing. I was using the processing sound library, but I cannot manage to sucesfully load the audio file.
int scl = 20;
PImage playerPupper;
SoundFile inGameMusic;
SoundFile mainTitleMusic;
PFont titleFont;
PFont bodyFont;
int currentScene;
void setup(){
fullScreen();
player = new Player(new PVector(scl*2, height/2), new PVector(scl*2, scl*2));
frameRate(24);
inGameMusic = new SoundFile(this, "SoundAssets/Music/Dogstorm.mp3");
mainTitleMusic = new SoundFile(this, "BloodyTears.mp3");
titleFont = createFont("Fonts/PixelByzantine.ttf", 64);
bodyFont = createFont("Fonts/HelvetiPixel.ttf", 32);
currentScene = 1;
}
I didn't had problems with the fonts, but each time I run the program, trying to execute any method on the SoundFile objects makes it crash. If I just instantiate them and don't run any methods on them, the program runs but when I close it, I get the following message in the console:
Error: Soundfile doesn't exist. Pleae check path
ERROR: /node/free: Node id -1 out of range
ERROR: /node/free: Node id -1 out of range
I've already tried taking them out of their folders and placing them in the same place as the processing files, but it doesn't seems to work, any idea what the problem might be?
Directory structure:
Upvotes: 2
Views: 760
Reputation: 42174
Like I said in my comments, the Processing editor is looking for files inside a data
subdirectory. Since you placed them yourself, you didn't put them in a data
subdirectory, so Processing can't find them.
To fix the problem, you either need to manually move the files into a data
subdirectory, or add them through the Processing editor which will do it for you.
Generally I would say it's a bad idea to use two different editors to edit the same code. Each of them will have different rules and expectations, so it's best to just stick with one.
Upvotes: 2