public class SoundManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) class |
SoundManager.SoundSystemStarterThread |
Modifier and Type | Field and Description |
---|---|
private com.google.common.collect.Multimap<SoundCategory,java.lang.String> |
categorySounds |
private java.util.Map<ISound,java.lang.Integer> |
delayedSounds |
private java.util.Map<ISound,java.lang.String> |
invPlayingSounds |
private boolean |
loaded
Set to true when the SoundManager has been initialised.
|
private static org.apache.logging.log4j.Marker |
LOG_MARKER
The marker used for logging
|
private static org.apache.logging.log4j.Logger |
logger |
private GameSettings |
options
Reference to the GameSettings object.
|
private java.util.Map<ISound,SoundPoolEntry> |
playingSoundPoolEntries |
private java.util.Map<java.lang.String,ISound> |
playingSounds |
private java.util.Map<java.lang.String,java.lang.Integer> |
playingSoundsStopTime |
private int |
playTime
A counter for how long the sound manager has been running
|
private SoundHandler |
sndHandler
A reference to the sound handler.
|
private SoundManager.SoundSystemStarterThread |
sndSystem
A reference to the sound system.
|
private java.util.List<ITickableSound> |
tickableSounds |
Constructor and Description |
---|
SoundManager(SoundHandler p_i45119_1_,
GameSettings p_i45119_2_) |
Modifier and Type | Method and Description |
---|---|
private float |
getNormalizedPitch(ISound sound,
SoundPoolEntry entry)
Normalizes pitch from parameters and clamps to [0.5, 2.0]
|
private float |
getNormalizedVolume(ISound sound,
SoundPoolEntry entry,
SoundCategory category)
Normalizes volume level from parameters.
|
private float |
getSoundCategoryVolume(SoundCategory category)
Returns the sound level (between 0.0 and 1.0) for a category, but 1.0 for the master sound category
|
private static java.net.URL |
getURLForSoundResource(ResourceLocation p_148612_0_) |
boolean |
isSoundPlaying(ISound sound)
Returns true if the sound is playing or still within time
|
private void |
loadSoundSystem()
Tries to add the paulscode library and the relevant codecs.
|
void |
pauseAllSounds()
Pauses all currently playing sounds
|
void |
playDelayedSound(ISound sound,
int delay)
Adds a sound to play in n tick
|
void |
playSound(ISound sound) |
void |
reloadSoundSystem() |
void |
resumeAllSounds()
Resumes playing all currently playing sounds (after pauseAllSounds)
|
void |
setListener(EntityPlayer player,
float p_148615_2_)
Sets the listener of sounds
|
void |
setSoundCategoryVolume(SoundCategory category,
float volume)
Adjusts volume for currently playing sounds in this category
|
void |
stopAllSounds()
Stops all currently playing sounds
|
void |
stopSound(ISound sound) |
void |
unloadSoundSystem()
Cleans up the Sound System
|
void |
updateAllSounds() |
private static final org.apache.logging.log4j.Marker LOG_MARKER
private static final org.apache.logging.log4j.Logger logger
private final SoundHandler sndHandler
private final GameSettings options
private SoundManager.SoundSystemStarterThread sndSystem
private boolean loaded
private int playTime
private final java.util.Map<java.lang.String,ISound> playingSounds
private final java.util.Map<ISound,java.lang.String> invPlayingSounds
private java.util.Map<ISound,SoundPoolEntry> playingSoundPoolEntries
private final com.google.common.collect.Multimap<SoundCategory,java.lang.String> categorySounds
private final java.util.List<ITickableSound> tickableSounds
private final java.util.Map<ISound,java.lang.Integer> delayedSounds
private final java.util.Map<java.lang.String,java.lang.Integer> playingSoundsStopTime
public SoundManager(SoundHandler p_i45119_1_, GameSettings p_i45119_2_)
public void reloadSoundSystem()
private void loadSoundSystem()
private float getSoundCategoryVolume(SoundCategory category)
public void setSoundCategoryVolume(SoundCategory category, float volume)
public void unloadSoundSystem()
public void stopAllSounds()
public void updateAllSounds()
public boolean isSoundPlaying(ISound sound)
public void stopSound(ISound sound)
public void playSound(ISound sound)
private float getNormalizedPitch(ISound sound, SoundPoolEntry entry)
private float getNormalizedVolume(ISound sound, SoundPoolEntry entry, SoundCategory category)
public void pauseAllSounds()
public void resumeAllSounds()
public void playDelayedSound(ISound sound, int delay)
private static java.net.URL getURLForSoundResource(ResourceLocation p_148612_0_)
public void setListener(EntityPlayer player, float p_148615_2_)