|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectzombie.core.sound.SoundEngine
public class SoundEngine
The sound player. This queues up commands to play one-shot sound effects using
a limited pool of sources.
Each sound effect is given a priority. When a sound of higher priority is requested
and there are no spare sources, the oldest, lowest priority sound effect is stopped
and replaced with the new one.
Every video frame you should call tick()
which will play your requested sounds.
This syncs it up nicely with the video.
Field Summary | |
---|---|
static SoundEngine |
instance
|
Constructor Summary | |
---|---|
SoundEngine()
C'tor |
Method Summary | |
---|---|
void |
create()
Create the SoundEngine. |
void |
destroy()
Destroy the sound player and all associated resources. |
void |
fadeIn()
Fade in the entire sound engine quickly |
void |
fadeOut()
Fade out the entire sound engine quickly |
Attenuator |
getDefaultAttenuator()
Accessor for defaultAttenuator (unlikely you'll ever need this, but here just for completeness) |
float |
getGain()
gets the master gain |
SoundEffect |
getMusic()
gets a handle to the currently playing music. |
float |
getOriginX()
|
float |
getOriginY()
|
float |
getOriginZ()
|
boolean |
isCreated()
|
void |
music(Sound sound,
int fadeDuration)
Crossfade some music in |
SoundEffect |
play(Sound buf)
|
void |
setDefaultAttenuator(Attenuator defaultAttenuator)
Sets the default attenuator for this SoundEngine |
void |
setGain(float gain)
Sets the master gain when the sound engine is faded in |
void |
setOrigin(float x,
float y,
float z)
Sets the origin of the listener for the purposes of attenuation. |
void |
tick()
Tick: call this every logic frame or every video frame you render, whichever occurs most often |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static SoundEngine instance
Constructor Detail |
---|
public SoundEngine()
Method Detail |
---|
public void create()
public void destroy()
create()
has not been called successfully.
public void setGain(float gain)
gain
- Must be between 0.0f and 1.0f inclusivepublic float getGain()
public void tick()
public boolean isCreated()
public SoundEffect play(Sound buf)
buf
- The sound buffer to playowner
- The owner of the sound effect
public void fadeOut()
public void fadeIn()
public void music(Sound sound, int fadeDuration)
public SoundEffect getMusic()
public void setDefaultAttenuator(Attenuator defaultAttenuator)
defaultAttenuator
- Cannot be nullpublic Attenuator getDefaultAttenuator()
defaultAttenuator
(unlikely you'll ever need this, but here just for completeness)
public void setOrigin(float x, float y, float z)
x
- y
- public float getOriginX()
public float getOriginY()
public float getOriginZ()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |