public class AudioManagerImpl extends Object implements AudioManager
Constructor and Description |
---|
AudioManagerImpl(GameCamera gameCamera,
aurelienribon.tweenengine.TweenManager tweenManager,
GameWorld gameWorld,
BehaviorManager behaviorManager) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all audio.
|
void |
clearMusic()
Clears all music and removes all related objects from the
GameWorld . |
void |
clearSounds()
Clears all sounds and removed all related objects from the
GameWorld . |
void |
crossFadeMusic(com.badlogic.gdx.audio.Music from,
com.badlogic.gdx.audio.Music to,
float duration)
Fades music from one music to another
|
void |
crossFadeMusic(String fromPath,
String toPath)
Fades music from one music to another
|
void |
crossFadeMusic(String fromPath,
String toPath,
float duration)
Fades music from one music to another
|
void |
fadeInMusic(com.badlogic.gdx.audio.Music music,
float duration)
Fades in music
|
void |
fadeInMusic(String path)
Fades in music
|
void |
fadeInMusic(String path,
float duration)
Fades in music
|
void |
fadeOutMusic(com.badlogic.gdx.audio.Music music,
float duration)
Fades out music
|
void |
fadeOutMusic(String path)
Fades out music
|
void |
fadeOutMusic(String path,
float duration)
Fades out music
|
void |
pauseMusic(String path)
Pauses given music.
|
void |
playMusic(String path)
Plays a given music.
|
void |
setMasterVolume(float volume)
Sets a new master volume.
|
void |
spawnMusic(String path,
float x,
float y,
float volume,
float hearingRange)
Spawns a
Music in the world. |
void |
spawnSound(String path,
float x,
float y,
float pitch,
float volume,
float hearingRange)
plays a sound in the
GameWorld relative to the GameCamera . |
void |
spawnSoundLooped(String path,
float x,
float y,
float pitch,
float volume,
float hearingRange)
|
void |
spawnSoundLooped(String path,
GameObject target,
float pitch,
float volume,
float hearingRange)
|
void |
stopMusic(String path)
Stops given music.
|
public AudioManagerImpl(GameCamera gameCamera, aurelienribon.tweenengine.TweenManager tweenManager, GameWorld gameWorld, BehaviorManager behaviorManager)
public void spawnSound(String path, float x, float y, float pitch, float volume, float hearingRange)
AudioManager
GameWorld
relative to the GameCamera
.spawnSound
in interface AudioManager
path
- the path of the audio filex
- the horizontal position in the worldy
- the vertical position in the worldpitch
- the audio pitchvolume
- the audio volume. FinalVolume=MasterVolume*volume*directionalVolume
hearingRange
- the hearing range where the audio is hearable frompublic void spawnSoundLooped(String path, float x, float y, float pitch, float volume, float hearingRange)
AudioManager
Sound
in the GameWorld
relative to the GameCamera
. The sound object is removed as soon the sound has stopped playing.spawnSoundLooped
in interface AudioManager
path
- the path of the audio filex
- the horizontal position in the worldy
- the vertical position in the worldpitch
- the audio pitchvolume
- the audio volume. FinalVolume=MasterVolume*volume*directionalVolume
hearingRange
- the hearing range where the audio is hearable frompublic void spawnSoundLooped(String path, GameObject target, float pitch, float volume, float hearingRange)
AudioManager
Sound
in the GameWorld
relative to the GameCamera
. The sound object is removed as soon the sound has stopped playing.spawnSoundLooped
in interface AudioManager
path
- the path of the audio filetarget
- the target to attach the sound topitch
- the audio pitchvolume
- the audio volume. FinalVolume=MasterVolume*volume*directionalVolume
hearingRange
- the hearing range where the audio is hearable frompublic void spawnMusic(String path, float x, float y, float volume, float hearingRange)
AudioManager
Music
in the world. The music persists until it is deleted via clearMusic
.spawnMusic
in interface AudioManager
path
- the path of the audio filex
- the horizontal position in the worldy
- the vertical position in the worldvolume
- the audio volume. FinalVolume=MasterVolume*volume*directionalVolume
hearingRange
- the hearing range where the audio is hearable frompublic void clearMusic()
AudioManager
GameWorld
.clearMusic
in interface AudioManager
public void clearSounds()
AudioManager
GameWorld
.clearSounds
in interface AudioManager
public void clear()
AudioManager
clear
in interface AudioManager
public void setMasterVolume(float volume)
AudioManager
1.0
setMasterVolume
in interface AudioManager
volume
- the master volumepublic void crossFadeMusic(String fromPath, String toPath)
AudioManager
crossFadeMusic
in interface AudioManager
fromPath
- the source audiotoPath
- the target audiopublic void crossFadeMusic(String fromPath, String toPath, float duration)
AudioManager
crossFadeMusic
in interface AudioManager
fromPath
- the source audiotoPath
- the target audioduration
- the duration in secondspublic void crossFadeMusic(com.badlogic.gdx.audio.Music from, com.badlogic.gdx.audio.Music to, float duration)
AudioManager
crossFadeMusic
in interface AudioManager
duration
- the duration in secondspublic void fadeOutMusic(String path)
AudioManager
fadeOutMusic
in interface AudioManager
path
- the path to the music filepublic void fadeOutMusic(String path, float duration)
AudioManager
fadeOutMusic
in interface AudioManager
path
- the path to the music fileduration
- the duration in secondspublic void fadeOutMusic(com.badlogic.gdx.audio.Music music, float duration)
AudioManager
fadeOutMusic
in interface AudioManager
duration
- the duration in secondspublic void fadeInMusic(String path)
AudioManager
fadeInMusic
in interface AudioManager
path
- the path to the music filepublic void fadeInMusic(String path, float duration)
AudioManager
fadeInMusic
in interface AudioManager
path
- the path to the music fileduration
- the duration in secondspublic void fadeInMusic(com.badlogic.gdx.audio.Music music, float duration)
AudioManager
fadeInMusic
in interface AudioManager
duration
- the duration in secondspublic void playMusic(String path)
AudioManager
playMusic
in interface AudioManager
path
- the path to the audio filepublic void stopMusic(String path)
AudioManager
stopMusic
in interface AudioManager
path
- the path to the audio filepublic void pauseMusic(String path)
AudioManager
pauseMusic
in interface AudioManager
path
- the path to the audio fileCopyright © 2020. All rights reserved.