org.newdawn.slick.openal
Class DeferredSound

java.lang.Object
  extended by org.newdawn.slick.openal.AudioImpl
      extended by org.newdawn.slick.openal.DeferredSound
All Implemented Interfaces:
DeferredResource, Audio

public class DeferredSound
extends AudioImpl
implements DeferredResource

A sound implementation that can load the actual sound file at a later point.

Author:
kevin

Field Summary
static int AIF
          Indicate a AIF to be loaded
static int MOD
          Indicate a MOD/XM to be loaded
static int OGG
          Indicate a OGG to be loaded
static int WAV
          Indicate a WAV to be loaded
 
Constructor Summary
DeferredSound(java.lang.String ref, java.io.InputStream in, int type)
          Create a new sound on request to load
 
Method Summary
 java.lang.String getDescription()
          Get a description of the resource to be loaded
 boolean isPlaying()
          Check if the sound is playing as sound fx
 void load()
          Load the actual resource
 int playAsMusic(float pitch, float gain, boolean loop)
          Play this sound as music
 int playAsSoundEffect(float pitch, float gain, boolean loop)
          Play this sound as a sound effect
 int playAsSoundEffect(float pitch, float gain, boolean loop, float x, float y, float z)
          Play this sound as a sound effect
 void stop()
          Stop the sound effect
 
Methods inherited from class org.newdawn.slick.openal.AudioImpl
getBufferID, getPosition, pauseMusic, restartMusic, setPosition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OGG

public static final int OGG
Indicate a OGG to be loaded

See Also:
Constant Field Values

WAV

public static final int WAV
Indicate a WAV to be loaded

See Also:
Constant Field Values

MOD

public static final int MOD
Indicate a MOD/XM to be loaded

See Also:
Constant Field Values

AIF

public static final int AIF
Indicate a AIF to be loaded

See Also:
Constant Field Values
Constructor Detail

DeferredSound

public DeferredSound(java.lang.String ref,
                     java.io.InputStream in,
                     int type)
Create a new sound on request to load

Parameters:
ref - The location of the sound to load
type - The type of sound to load
in - The input stream to load from
Method Detail

load

public void load()
          throws java.io.IOException
Description copied from interface: DeferredResource
Load the actual resource

Specified by:
load in interface DeferredResource
Throws:
java.io.IOException - Indicates a failure to load the resource
See Also:
DeferredResource.load()

isPlaying

public boolean isPlaying()
Description copied from interface: Audio
Check if the sound is playing as sound fx

Specified by:
isPlaying in interface Audio
Overrides:
isPlaying in class AudioImpl
Returns:
True if the sound is playing
See Also:
AudioImpl.isPlaying()

playAsMusic

public int playAsMusic(float pitch,
                       float gain,
                       boolean loop)
Description copied from interface: Audio
Play this sound as music

Specified by:
playAsMusic in interface Audio
Overrides:
playAsMusic in class AudioImpl
Parameters:
pitch - The pitch of the play back
gain - The gain of the play back
loop - True if we should loop
Returns:
The ID of the source playing the sound
See Also:
AudioImpl.playAsMusic(float, float, boolean)

playAsSoundEffect

public int playAsSoundEffect(float pitch,
                             float gain,
                             boolean loop)
Description copied from interface: Audio
Play this sound as a sound effect

Specified by:
playAsSoundEffect in interface Audio
Overrides:
playAsSoundEffect in class AudioImpl
Parameters:
pitch - The pitch of the play back
gain - The gain of the play back
loop - True if we should loop
Returns:
The ID of the source playing the sound
See Also:
AudioImpl.playAsSoundEffect(float, float, boolean)

playAsSoundEffect

public int playAsSoundEffect(float pitch,
                             float gain,
                             boolean loop,
                             float x,
                             float y,
                             float z)
Play this sound as a sound effect

Specified by:
playAsSoundEffect in interface Audio
Overrides:
playAsSoundEffect in class AudioImpl
Parameters:
pitch - The pitch of the play back
gain - The gain of the play back
loop - True if we should loop
x - The x position of the sound
y - The y position of the sound
z - The z position of the sound
Returns:
The ID of the source playing the sound
See Also:
Audio.playAsSoundEffect(float, float, boolean, float, float, float)

stop

public void stop()
Description copied from interface: Audio
Stop the sound effect

Specified by:
stop in interface Audio
Overrides:
stop in class AudioImpl
See Also:
AudioImpl.stop()

getDescription

public java.lang.String getDescription()
Description copied from interface: DeferredResource
Get a description of the resource to be loaded

Specified by:
getDescription in interface DeferredResource
Returns:
The description of the resource to be loaded
See Also:
DeferredResource.getDescription()


Copyright © 2006 New Dawn Software. All Rights Reserved.