org.deken.game.sound
Class BaseSound

java.lang.Object
  extended by org.deken.game.sound.BaseSound
All Implemented Interfaces:
AudioListener, Sound, Updateable
Direct Known Subclasses:
LoopedSound, RandomSound, SingleSound, TimeListeningSound

public abstract class BaseSound
extends java.lang.Object
implements Sound, AudioListener

Title: BaseSound

Description: A base Sound class for storing SoundListeners for subclasses.

Copyright: Copyright (c) Nov 9, 2011 Gary Deken

Version:
1.0
Author:
Gary Deken

Nested Class Summary
static class BaseSound.SEQUENCE
           
 
Field Summary
protected  Audio audio
           
protected  java.util.List<SoundListener> listeners
           
protected  java.lang.String name
           
protected  boolean playing
           
 
Constructor Summary
protected BaseSound()
           
  BaseSound(Audio audio, java.lang.String name)
           
 
Method Summary
 void addAudio(Audio audio)
           
 void addSoundListener(SoundListener soundListener)
          Add a SoundListener to this sound.
protected  BaseSound copyParent(BaseSound newSound)
           
 java.lang.String getName()
          Name of the sound object.
 boolean isPlaying()
           
protected  void notifyListeners(BaseSound.SEQUENCE sequence)
           
 void update(long elapseTime)
          The update method is used for filter updates, when sound does have regular updates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.deken.game.sound.Sound
copy, pause, play, resume, stop
 
Methods inherited from interface org.deken.game.sound.audio.AudioListener
audioStop
 

Field Detail

listeners

protected java.util.List<SoundListener> listeners

playing

protected boolean playing

name

protected java.lang.String name

audio

protected Audio audio
Constructor Detail

BaseSound

public BaseSound(Audio audio,
                 java.lang.String name)

BaseSound

protected BaseSound()
Method Detail

addAudio

public void addAudio(Audio audio)
Specified by:
addAudio in interface Sound

addSoundListener

public void addSoundListener(SoundListener soundListener)
Description copied from interface: Sound
Add a SoundListener to this sound.

Specified by:
addSoundListener in interface Sound

update

public void update(long elapseTime)
The update method is used for filter updates, when sound does have regular updates. Such as Clip audio.

Specified by:
update in interface Sound
Specified by:
update in interface Updateable
Parameters:
elapseTime -

getName

public java.lang.String getName()
Description copied from interface: Sound
Name of the sound object.

Specified by:
getName in interface Sound
Specified by:
getName in interface Updateable
Returns:
String name.

isPlaying

public boolean isPlaying()
Specified by:
isPlaying in interface Sound
Returns:
if this sound object is play the sound or not.

notifyListeners

protected void notifyListeners(BaseSound.SEQUENCE sequence)

copyParent

protected BaseSound copyParent(BaseSound newSound)
Parameters:
newSound -
Returns:
BaseSound