org.newdawn.slick.openal
Class AudioImpl

java.lang.Object
  extended by org.newdawn.slick.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

Constructor Summary
protected AudioImpl()
           
 
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
 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)
          Play this sound as a sound effect
static void restartMusic()
          Restart the music currently being paused
 boolean setPosition(float position)
          Seeks to a position in the music.
 void stop()
          Stop the sound effect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioImpl

protected AudioImpl()
Method Detail

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

stop

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

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

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:
Audio.isPlaying()

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:
Audio.playAsSoundEffect(float, float, boolean)

playAsSoundEffect

public int playAsSoundEffect(float pitch,
                             float gain,
                             boolean loop,
                             float x,
                             float y,
                             float z)
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:
Audio.playAsSoundEffect(float, float, boolean, float, float, float)

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:
Audio.playAsMusic(float, float, boolean)

pauseMusic

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


restartMusic

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


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:
Audio.setPosition(float)

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:
Audio.getPosition()


Copyright © 2006 New Dawn Software. All Rights Reserved.