soundFile.jump(0) starts a new instance of the sound, instead of restarting the sound. · Issue #44 · processing/processing-sound (original) (raw)
to reproduce prepare an mp3 called sound.mp3
, 10 seconds long. Use the following sketch:
import processing.sound.*;
SoundFile sound;
void setup() {
sound = new SoundFile(this, "sound.mp3");
sound.loop();
}
void draw() {
background(255);
}
void mousePressed() {
// sound.stop(); // does not help the problem
sound.jump(0);
}
Run, wait until the sound starts to play. Click the mouse, observe what happens. Wait a few seconds and click the mouse again, observe what happens.
expected behaviour: with every mouse click, the sound restarts at the start of the song.
actual behaviour:
- The first mouse click restarts the sound.
- Subsequent mouse clicks trigger a new instance of the sound, while older instances continue to play.