Genuts API

com.genuts.audio
Class SoundList

java.lang.Object
  |
  +--com.genuts.audio.SoundList

public class SoundList
extends java.lang.Object

Loads and holds a bunch of audio files whose locations are specified relative to a fixed base URL.

Once an instance of SoundList is created, each audio clip is loaded with the method startLoading. Then you can choose to play it one time or in loop.

A sound list can be muted. In mute mode, all audio clips in loop are stopped and no more sounds are played. When the mute mode is leaved, all audio clips in loop are started and new audio clips are played.

AudioClip loading is done asynchronously. First, the relative URL is used, in resources, to try to get the AudioClip from the jarfile. If it doesn't work, the URL formed with the base URL and the relative URL is used. If once again, it doesn't work, the URL formed with only the relative URL is used.
If the AudioClip is not found, an error is writen to the error output stream.

This object can be used in an Applet (using java 1.1) or in an application (using java 2).


Constructor Summary
SoundList(java.applet.Applet applet, java.net.URL baseURL)
          Creates a new sound list for an Applet.
SoundList(java.net.URL baseURL)
          Creates a new sound list for an Application.
 
Method Summary
 boolean isMute()
          Indicates if this sound list is in mute mode.
 void loopClip(java.lang.String relativeURL)
          Starts playing the audio clip with the specidied relative URL in a loop.
 void playClip(java.lang.String relativeURL)
          Starts playing the audio clip with the specidied relative URL.
 void setMute(boolean mute)
          Sets the mute mode for this sound list.
 void startLoading(java.lang.String relativeURL)
          Starts loading an audio clip.
 void stopClip(java.lang.String relativeURL)
          Stops playing the audio clip with the specidied relative URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoundList

public SoundList(java.applet.Applet applet,
                 java.net.URL baseURL)
Creates a new sound list for an Applet.

Parameters:
applet - Applet associated with this sound list.
baseURL - Base URL from which audio clips will be loaded.

SoundList

public SoundList(java.net.URL baseURL)
Creates a new sound list for an Application.

Parameters:
baseURL - Base URL from which audio clips will be loaded.
Method Detail

startLoading

public void startLoading(java.lang.String relativeURL)
Starts loading an audio clip.

Parameters:
relativeURL - Relative URL from which the audio clip will be load.

stopClip

public void stopClip(java.lang.String relativeURL)
Stops playing the audio clip with the specidied relative URL.

Parameters:
relativeURL - Relative URL of the audio clip which has to be stopped.

playClip

public void playClip(java.lang.String relativeURL)
Starts playing the audio clip with the specidied relative URL. Each time this method is called, the clip is restarted from the beginning.

If this sound list is in mute mode, this method does nothing.

Parameters:
relativeURL - Relative URL of the audio clip which has to be played.

loopClip

public void loopClip(java.lang.String relativeURL)
Starts playing the audio clip with the specidied relative URL in a loop. If the audio clip is already playing in loop, or if this sound list is in mute mode this method does play anything.

Parameters:
relativeURL - Relative URL of the audio clip which has to be played in loop.

setMute

public void setMute(boolean mute)
Sets the mute mode for this sound list.

Parameters:
mute - true to mute all audio clips which were muted, otherwise mutes all audio clips which are played in loop.

isMute

public boolean isMute()
Indicates if this sound list is in mute mode.

Returns:
true if this sound list is in mute mode, false otherwise.

Genuts API

Genuts API