nip
Class Sound

java.lang.Object
  extended by nip.Sound

public class Sound
extends java.lang.Object

The Sound class provides methods for playing audio clips with an .au file extension. Students are advised that headphones are generally required in university computer centers.

Author:
Kenneth J. Goldman
Created Jul 5, 2005

Constructor Summary
Sound()
           
 
Method Summary
static java.applet.AudioClip getSound(java.lang.String filename)
          Loads, but does not play, an audio clip from the given file
static void loop(java.lang.String filename)
          Plays the audio clip repeatedly from the given file, loading the audio clip if necessary.
static void main(java.lang.String[] args)
           
static void play(java.lang.String filename)
          Plays the audio clip from the given file, loading the audio clip if necessary.
static void stop(java.lang.String filename)
          Stops playing the named audio clip, if it is currently playing.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sound

public Sound()
Method Detail

getSound

public static java.applet.AudioClip getSound(java.lang.String filename)
Loads, but does not play, an audio clip from the given file

Parameters:
filename - the name of the audio file
Returns:
the loaded AudioClip

play

public static void play(java.lang.String filename)
Plays the audio clip from the given file, loading the audio clip if necessary. (If the audio clip has been previously loaded, it will play the clip that has already been loaded.)

Parameters:
filename - the name of the audio file

loop

public static void loop(java.lang.String filename)
Plays the audio clip repeatedly from the given file, loading the audio clip if necessary. (If the audio clip has been previously loaded, it will play the clip that has already been loaded.)

Parameters:
filename - the name of the audio file

stop

public static void stop(java.lang.String filename)
Stops playing the named audio clip, if it is currently playing.

Parameters:
filename - the name of the audio file

main

public static void main(java.lang.String[] args)