org.newdawn.slick
Class Sound

java.lang.Object
  extended by org.newdawn.slick.Sound

public class Sound
extends java.lang.Object

A single sound effect loaded from either OGG or XM/MOD file. Sounds are allocated to channels dynamically - if not channel is available the sound will not play.

Author:
kevin

Constructor Summary
Sound(java.io.InputStream in, java.lang.String ref)
          Create a new Sound
Sound(java.lang.String ref)
          Create a new Sound
Sound(java.net.URL url)
          Create a new Sound
 
Method Summary
 void loop()
          Loop this sound effect at default volume and pitch
 void loop(float pitch, float volume)
          Loop this sound effect at a given volume and pitch
 void play()
          Play this sound effect at default volume and pitch
 void play(float pitch, float volume)
          Play this sound effect at a given volume and pitch
 void playAt(float x, float y, float z)
          Play a sound effect from a particular location
 void playAt(float pitch, float volume, float x, float y, float z)
          Play a sound effect from a particular location
 boolean playing()
          Check if the sound is currently playing
 void stop()
          Stop the sound being played
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sound

public Sound(java.io.InputStream in,
             java.lang.String ref)
      throws SlickException
Create a new Sound

Parameters:
in - The location of the OGG or MOD/XM to load
ref - The name to associate this stream
Throws:
SlickException - Indicates a failure to load the sound effect

Sound

public Sound(java.net.URL url)
      throws SlickException
Create a new Sound

Parameters:
url - The location of the OGG or MOD/XM to load
Throws:
SlickException - Indicates a failure to load the sound effect

Sound

public Sound(java.lang.String ref)
      throws SlickException
Create a new Sound

Parameters:
ref - The location of the OGG or MOD/XM to load
Throws:
SlickException - Indicates a failure to load the sound effect
Method Detail

play

public void play()
Play this sound effect at default volume and pitch


play

public void play(float pitch,
                 float volume)
Play this sound effect at a given volume and pitch

Parameters:
pitch - The pitch to play the sound effect at
volume - The volumen to play the sound effect at

playAt

public void playAt(float x,
                   float y,
                   float z)
Play a sound effect from a particular location

Parameters:
x - The x position of the source of the effect
y - The y position of the source of the effect
z - The z position of the source of the effect

playAt

public void playAt(float pitch,
                   float volume,
                   float x,
                   float y,
                   float z)
Play a sound effect from a particular location

Parameters:
pitch - The pitch to play the sound effect at
volume - The volumen to play the sound effect at
x - The x position of the source of the effect
y - The y position of the source of the effect
z - The z position of the source of the effect

loop

public void loop()
Loop this sound effect at default volume and pitch


loop

public void loop(float pitch,
                 float volume)
Loop this sound effect at a given volume and pitch

Parameters:
pitch - The pitch to play the sound effect at
volume - The volumen to play the sound effect at

playing

public boolean playing()
Check if the sound is currently playing

Returns:
True if the sound is playing

stop

public void stop()
Stop the sound being played



Copyright © 2006 New Dawn Software. All Rights Reserved.