zombie.openal
Class AudioImpl

java.lang.Object
  extended by zombie.openal.AudioImpl
All Implemented Interfaces:
Audio
Direct Known Subclasses:
DeferredSound, MODSound, StreamSound

public class AudioImpl
extends java.lang.Object
implements Audio

A sound that can be played through OpenAL

Author:
Kevin Glass, Nathan Sweet

Field Summary
static float volDelta
           
 
Method Summary
 int getBufferID()
          get the ID of the OpenAL buffer holding this data (if any).
 float getPosition()
          Return the current playing position in the sound
 float getRange()
           
 AudioImpl initAudioImpl(SoundStore store, int buffer)
           
 boolean isPlaying()
          Check if the sound is playing as sound fx
static void pauseMusic()
          Pause the music currently being played
 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, float radius)
          Play this sound as a sound effect
 int playAsSoundEffectUnbuffered(float pitch, float gain, boolean loop)
           
static void restartMusic()
          Restart the music currently being paused
 void setID(int id)
           
 boolean setPosition(float position)
          Seeks to a position in the music.
 boolean setPosition(float x, float y, float z)
           
 void setRange(float radius)
           
 void setVolume(float volume)
           
 void stop()
          Stop the sound effect
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

volDelta

public static float volDelta
Method Detail

initAudioImpl

public AudioImpl initAudioImpl(SoundStore store,
                               int buffer)

pauseMusic

public static void pauseMusic()
Pause the music currently being played


restartMusic

public static void restartMusic()
Restart the music currently being paused


getBufferID

public int getBufferID()
get the ID of the OpenAL buffer holding this data (if any). This method is not valid with streaming resources.

Specified by:
getBufferID in interface Audio
Returns:
The ID of the OpenAL buffer holding this data

getPosition

public float getPosition()
Description copied from interface: Audio
Return the current playing position in the sound

Specified by:
getPosition in interface Audio
Returns:
The current position in seconds.
See Also:
org.newdawn.slick.openal.Audio#getPosition()

isPlaying

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

Specified by:
isPlaying in interface Audio
Returns:
True if the sound is playing
See Also:
org.newdawn.slick.openal.Audio#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
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:
org.newdawn.slick.openal.Audio#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
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:
org.newdawn.slick.openal.Audio#playAsSoundEffect(float, float, boolean)

playAsSoundEffect

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

Specified by:
playAsSoundEffect in interface Audio
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:
org.newdawn.slick.openal.Audio#playAsSoundEffect(float, float, boolean, float, float, float)

setID

public void setID(int id)
Specified by:
setID in interface Audio

setPosition

public boolean setPosition(float position)
Description copied from interface: Audio
Seeks to a position in the music.

Specified by:
setPosition in interface Audio
Parameters:
position - Position in seconds.
Returns:
True if the setting of the position was successful
See Also:
org.newdawn.slick.openal.Audio#setPosition(float)

setPosition

public boolean setPosition(float x,
                           float y,
                           float z)
Specified by:
setPosition in interface Audio

setVolume

public void setVolume(float volume)
Specified by:
setVolume in interface Audio

stop

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

Specified by:
stop in interface Audio
See Also:
org.newdawn.slick.openal.Audio#stop()

playAsSoundEffectUnbuffered

public int playAsSoundEffectUnbuffered(float pitch,
                                       float gain,
                                       boolean loop)
Specified by:
playAsSoundEffectUnbuffered in interface Audio

setRange

public void setRange(float radius)
Specified by:
setRange in interface Audio

getRange

public float getRange()