The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > javax.sound.sampled  [9 examples] > Events  [1 examples]

e731. Determining When a Sampled Audio Player Has Finished Playing

An audio clip fires a line event when the audio sample has finished playing. If the audio clip is played in a loop (see e725 Continuously Playing a Sampled Audio File), the event is fired only after the loop is finished.
    // To create a Clip object, see e723 Loading and Playing Sampled Audio
    
    // Add a listener for line events
    clip.addLineListener(new LineListener() {
        public void update(LineEvent evt) {
            if (evt.getType() == LineEvent.Type.STOP) {
            }
        }
    });

 Related Examples

See also: Playing    Properties   


© 2002 Addison-Wesley.