Continuously Playing a Sampled Audio File
Only DataLine objects that are of type Clip can be repeated.
To create a clip, see Loading and Playing Sampled Audio.
// Play once
clip.start();
// Play and loop forever
clip.loop(Clip.LOOP_CONTINUOUSLY);
// Play and repeat for a certain number of times
int numberOfPlays = 3;
clip.loop(numberOfPlays-1);
Post a comment