public class SoundEngine
extends java.lang.Object
Constructor and Description |
---|
SoundEngine() |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
disposes the sounds
|
protected float |
getVolume(AbstractPosition pos)
calculates the volume of a soundIterator based on the posiiton in the game world
|
long |
loop(java.lang.String identifier)
playingLoops a soundIterator.
|
long |
loop(java.lang.String identifier,
AbstractPosition pos)
playingLoops a soundIterator.
|
void |
play(java.lang.String identifier) |
void |
play(java.lang.String identifier,
AbstractPosition pos)
Plays soundIterator with decreasing volume depending on distance.
|
long |
play(java.lang.String identifier,
float volume) |
long |
play(java.lang.String identifier,
float volume,
float pitch) |
long |
play(java.lang.String identifier,
float volume,
float pitch,
float pan) |
void |
register(java.lang.String identifier,
java.lang.String path)
Registers a soundIterator.
|
void |
setView(GameView view) |
void |
setVolume(java.lang.String identifier,
long instance,
float volume)
Set the volume of a playing instance.
|
void |
stop(java.lang.String identifier)
Stops all instances of this soundIterator.
|
void |
stop(java.lang.String identifier,
long instance)
Stops a specifiy instance of the soundIterator.
|
void |
update(float dt) |
public void register(java.lang.String identifier, java.lang.String path)
identifier
- name of soundIteratorpath
- path of the soundIteratorpublic void play(java.lang.String identifier)
identifier
- name of soundIteratorpublic void play(java.lang.String identifier, AbstractPosition pos)
identifier
- name of soundIteratorpos
- the position of the soundIterator in the worldpublic long play(java.lang.String identifier, float volume)
identifier
- name of soundIteratorvolume
- public long play(java.lang.String identifier, float volume, float pitch)
identifier
- name of soundIteratorvolume
- pitch
- public long play(java.lang.String identifier, float volume, float pitch, float pan)
identifier
- name of soundIteratorvolume
- the volume in the range [0,1]pitch
- the pitch multiplier, 1 == default, >1 == faster, <1 == slower, the value has to be between 0.5 and 2.0pan
- panning in the range -1 (full left) to 1 (full right). 0 is center position.public long loop(java.lang.String identifier)
identifier
- name of soundIteratorcom.badlogic.gdx.audio.Sound#loop
public long loop(java.lang.String identifier, AbstractPosition pos)
identifier
- name of soundIteratorpos
- the position of the soundIterator in the game world. Should be a reference to the position of the object and no copy so that it updates itself.com.badlogic.gdx.audio.Sound#loop()
public void stop(java.lang.String identifier)
identifier
- name of soundIteratorpublic void stop(java.lang.String identifier, long instance)
identifier
- name of soundIteratorinstance
- the instance returned by play(String)
or loop(String)
.Sound.stop()
public void setVolume(java.lang.String identifier, long instance, float volume)
identifier
- name of soundIteratorinstance
- the instance returned by play(String)
or loop(String)
.volume
- com.badlogic.gdx.audio.Sound#setVolume()
public void update(float dt)
dt
- public void dispose()
protected float getVolume(AbstractPosition pos)
pos
- public void setView(GameView view)
view
-