We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello!
Following code creates after every fourth, new startet file this error:
==== JavaSound Minim Error ==== ==== Error invoking createInput on the file loader object: null
CODE:
import processing.serial.*;
import ddf.minim.*;
// The serial port:
Serial myPort;
// Audio player Objects
Minim minim;
AudioPlayer player;
// Input String Serial Port
String dataReading = "";
String playlist[] = {"19_Adler_Taste A1_B1.mp3",
"19_Adler_Taste C1_D1.mp3",
"19_Adler_Taste G1_H1.mp3",
"09_Bahnho_fli_Taste L1_M1.mp3",
"09_Bahnho_fli_Taste N1_P109.mp3",
"09_Bahnho_fli_Taste Q1_R1.mp3",
"09_Bahnho_fli_Taste S1_T1.mp3"
};
int counter = 0;
boolean newone = false;
//Setup routine
void setup() {
//Size of Frame equal to screen size
size(100, 100);
//background black, value in RGB
background(0);
// Open the port you are using at the rate you want:
//println(Serial.list());
myPort = new Serial(this, Serial.list()[0], 9600);
//read stream until carriage return
myPort.bufferUntil('\n');
//we pass this to Minim so that it can load files from the data directory
minim = new Minim(this);
player = minim.loadFile("19_Adler_Taste A1_B1.mp3");
}
//Draw routine
void draw() {
if(newone == true){
println(dataReading);
if (counter >= 7){
counter = 0;
}
playSong(playlist[counter++]);
newone = false;
}
}
//Serial Event Routine
void serialEvent(Serial myPort) {
dataReading = myPort.readString();
if(dataReading!=null){
//clear current view
//set flag for draw routine
newone = true;
}
}
void playSong(String Filename)
{
if(Filename.length() > 0){
if(player.isPlaying()){
player.close();
minim.stop();
}
print("play new..");
print(Filename);
player = minim.loadFile(Filename);
player.play();
}
}
Any ideas?
Answers
first of all, I'd load all files into an Array songs[] in setup[]
and then play from there
maybe you have a typo in your 4th file?