When playing many AudioClip, the JVM crashes brutally.
Don't know is it's related to playing always the same or just very frequently.
In this test, the period is set to 50ms but with 500ms or more it crashes on not very recent PCs.
Only tested under Windows 7 and 8.
I think this test will work for you. If it doesn't, the mp3 file maybe involved and I'll provide it.
Test :
URL soundUrl = Main.class.getResource("/application/sound.mp3");
final AudioClip clip = new AudioClip(soundUrl.toString());
new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
Platform.runLater(new Runnable() {
@Override
public void run() {
clip.play();
}
});
}
}
}).start();
Don't know is it's related to playing always the same or just very frequently.
In this test, the period is set to 50ms but with 500ms or more it crashes on not very recent PCs.
Only tested under Windows 7 and 8.
I think this test will work for you. If it doesn't, the mp3 file maybe involved and I'll provide it.
Test :
URL soundUrl = Main.class.getResource("/application/sound.mp3");
final AudioClip clip = new AudioClip(soundUrl.toString());
new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
Platform.runLater(new Runnable() {
@Override
public void run() {
clip.play();
}
});
}
}
}).start();