As PhiLho said. Perhaps you need some println()'s cause there are two options and both are no good. Either you don't close samples as I assumed (because each sample never stops playing, in fact it's replaced before it ends). Or you do close each sample, but then you also stop minim and the sketch, which is strange, because you keep using it.
To answer your question. You only need to close a sample when you are done with it. You only need to stop Minim when you are done with the whole sketch.
In addition, I suggest moving to Processing 2.01 where you don't need to stop Minim anymore so I suspect some changes have been made in the past years also to the included core version of Minim.
Furthermore I find it very peculiar that there would be a 32 limit on playable files. I've written a test sketch - tested with Processing 2.01's Minim - and I encounter no such problems. I can load all 42 mp3s and play each one of them.
Again, all the code you posted so far has seemed buggy. So I would check twice before your blame it on the library.
Code Example (Processing 2.01)
To answer your question. You only need to close a sample when you are done with it. You only need to stop Minim when you are done with the whole sketch.
In addition, I suggest moving to Processing 2.01 where you don't need to stop Minim anymore so I suspect some changes have been made in the past years also to the included core version of Minim.
Furthermore I find it very peculiar that there would be a 32 limit on playable files. I've written a test sketch - tested with Processing 2.01's Minim - and I encounter no such problems. I can load all 42 mp3s and play each one of them.
Again, all the code you posted so far has seemed buggy. So I would check twice before your blame it on the library.
Code Example (Processing 2.01)
- // press space to go to the next file
- import ddf.minim.*;
- String pathToMp3s = "C:/Media/Music/Collected/"; // contains 42 mp3s of in total 324 MB
- Minim minim;
- AudioPlayer[] mp3s;
- String[] filenames;
- int count;
- void setup() {
- size(300, 300);
- minim = new Minim(this);
- filenames = loadFilenames(pathToMp3s);
- mp3s = new AudioPlayer[filenames.length];
- for (int i=0; i<mp3s.length; i++) {
- mp3s[i] = minim.loadFile(pathToMp3s + filenames[i]);
- }
- mp3s[0].play();;
- println("Number 0 (" + filenames[0] + ") is currently playing.");
- }
- void draw() {
- background(0);
- }
- void keyPressed() {
- if (key == ' ') {
- for (int i=0; i<mp3s.length; i++) {
- if (mp3s[i].isPlaying()) mp3s[i].pause();
- }
- count = ++count%mp3s.length;
- mp3s[count].play();
- println("Number " + count + " (" + filenames[count] + ") is currently playing.");
- }
- }
- String[] loadFilenames(String path) {
- File folder = new File(path);
- java.io.FilenameFilter filenameFilter = new java.io.FilenameFilter() {
- public boolean accept(File dir, String name) {
- String lowcase = name.toLowerCase();
- return lowcase.endsWith(".mp3");
- }
- };
- return folder.list(filenameFilter);
- }