Trying to make a thread sleep (minim)
in
Core Library Questions
•
10 months ago
Hello everyone!
Im quite new to Processing, and im currently experimenting with the minim lib.
The issue is that i want to load the audi files into an array and play them one after one. But the audio was playing all at once.
At the moment im trying to make the thread sleep but without any luck ("Unhandled exception type Interrupted Exception").
Any suggestion on what i could do?
- import ddf.minim.*; //Minim library
- import ddf.minim.analysis.*;
- Minim minim;
- AudioPlayer player[]; //Player array
- //-----------------------------------------------------------------------------------
- void setup() {
- minim = new Minim(this);
- player = new AudioPlayer[8]; //setup Array
- int i = 1;
- //Getting the Audio
- while(i<8){
- player[i] = minim.loadFile(i + ".mp3");
- player[i].play();
- //Trying to stop it
- while(player[i].isPlaying()){
- Thread.sleep(player[i].length());
- }
- i++;
- }
- }
- //---------------------------------------------------------------------------------------
1