zombie.core.sound
Class Stream

java.lang.Object
  extended by zombie.core.sound.Stream
All Implemented Interfaces:
Sound

public class Stream
extends java.lang.Object

A sound wave that is streamed from an input stream.


Field Summary
 boolean bPreserve
           
 
Constructor Summary
Stream()
          C'tor
Stream(java.lang.String url, float gain, float pitch, int priority, boolean looped)
          C'tor.
Stream(java.lang.String url, float gain, float pitch, int priority, boolean looped, Attenuator attenuator)
          C'tor
Stream(java.lang.String url, int priority)
          C'tor.
Stream(java.lang.String url, int priority, boolean looped)
          C'tor.
 
Method Summary
 void create()
          Creates this Stream.
 void create(boolean bPreserve)
           
 void destroy()
          Destroys this instance and any resources it holds.
 Attenuator getAttenuator()
          Returns the Attenuator to use for this Sound.
 int getFormat()
           
 float getGain()
          Returns the gain.
 StreamInstance getInstance(zombie.core.sound.Source source)
          get or create a stream instance from our pool
 float getPitch()
          Returns the pitch.
 int getPriority()
          Returns the priority.
 java.lang.String getURL()
           
 boolean isCreated()
           
 boolean isLooped()
          Returns looped status
 boolean isStereo()
           
 void setAttenuator(Attenuator attenuator)
          Sets the Attenuator to use for this Sound.
 void setGain(float gain)
          Sets the default gain for this buffer
 void setLooped(boolean looped)
          Sets whether this buffer should be looped by default
 void setPitch(float pitch)
          Sets the default pitch for this buffer
 void setPriority(int priority)
          Sets the default priority for this buffer relative to all other buffers.
 void setURL(java.lang.String url)
          Sets the URL from where this AbstractSound will read Ogg Vorbis data
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bPreserve

public boolean bPreserve
Constructor Detail

Stream

public Stream()
C'tor


Stream

public Stream(java.lang.String url,
              int priority)
C'tor. Pitch and gain are at 1.0f and the sound is looped and uses the sound engine default attenuator.

Parameters:
url -
priority -

Stream

public Stream(java.lang.String url,
              int priority,
              boolean looped)
C'tor. Pitch and gain are at 1.0f and uses the sound engine default attenuator.

Parameters:
url -
priority -
looped -

Stream

public Stream(java.lang.String url,
              float gain,
              float pitch,
              int priority,
              boolean looped)
C'tor. Uses the sound engine default attenuator

Parameters:
url -
gain -
pitch -
priority -
looped -

Stream

public Stream(java.lang.String url,
              float gain,
              float pitch,
              int priority,
              boolean looped,
              Attenuator attenuator)
C'tor

Parameters:
url -
gain -
pitch -
priority -
looped -
attenuator -
Method Detail

create

public void create()
Creates this Stream. If AL is not created, or if this Stream is already created, does nothing.

See Also:
destroy()

create

public void create(boolean bPreserve)

destroy

public void destroy()
Destroys this instance and any resources it holds. Does nothing if it hasn't been created yet.

See Also:
create()

isCreated

public boolean isCreated()
Returns:
true if we've been created

getFormat

public int getFormat()
Returns:
the OpenAL format

isStereo

public boolean isStereo()
Returns:
true if the sound is stereo

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getInstance

public StreamInstance getInstance(zombie.core.sound.Source source)
get or create a stream instance from our pool


setGain

public final void setGain(float gain)
Description copied from interface: Sound
Sets the default gain for this buffer

Specified by:
setGain in interface Sound
Parameters:
gain - (must be ≥ 0.0f and ≤ 1.0f)

setPitch

public final void setPitch(float pitch)
Description copied from interface: Sound
Sets the default pitch for this buffer

Specified by:
setPitch in interface Sound
Parameters:
pitch - (must be > 0.0f)

setPriority

public final void setPriority(int priority)
Description copied from interface: Sound
Sets the default priority for this buffer relative to all other buffers.

Specified by:
setPriority in interface Sound
Parameters:
priority - (must be >= 0)

setLooped

public final void setLooped(boolean looped)
Description copied from interface: Sound
Sets whether this buffer should be looped by default

Specified by:
setLooped in interface Sound

setURL

public final void setURL(java.lang.String url)
Description copied from interface: Sound
Sets the URL from where this AbstractSound will read Ogg Vorbis data

Specified by:
setURL in interface Sound
Parameters:
url - May ne null

getGain

public final float getGain()
Description copied from interface: Sound
Returns the gain. Gain defaults to 1.0f

Specified by:
getGain in interface Sound
Returns:
float (≥0.0f and ≤1.0f)

getPitch

public final float getPitch()
Description copied from interface: Sound
Returns the pitch. Pitch defaults to 1.0f

Specified by:
getPitch in interface Sound
Returns:
float (>0.0f)

getPriority

public final int getPriority()
Description copied from interface: Sound
Returns the priority. Priority defaults to 0.

Specified by:
getPriority in interface Sound
Returns:
int

isLooped

public final boolean isLooped()
Description copied from interface: Sound
Returns looped status

Specified by:
isLooped in interface Sound
Returns:
boolean

getURL

public final java.lang.String getURL()
Specified by:
getURL in interface Sound
Returns:
Returns the url.

getAttenuator

public Attenuator getAttenuator()
Description copied from interface: Sound
Returns the Attenuator to use for this Sound. The default Attenuator is specified by the SoundEngine itself, so if no attenuator has been set with Sound.setAttenuator(Attenuator) then the default returned by SoundEngine.getDefaultAttenuator() will be used instead when playing the sound.

Specified by:
getAttenuator in interface Sound
Returns:
an Attenuator (never null)
See Also:
Sound.setAttenuator(Attenuator), SoundEngine.getDefaultAttenuator()

setAttenuator

public void setAttenuator(Attenuator attenuator)
Description copied from interface: Sound
Sets the Attenuator to use for this Sound. If set to null, then the default attenuator as returned by SoundEngine.getDefaultAttenuator() will be used when playing this sound.

Specified by:
setAttenuator in interface Sound
Parameters:
attenuator - May be null
See Also:
Sound.getAttenuator(), SoundEngine.getDefaultAttenuator()