Package cl.cromer.azaraka.sound
Class Sound
- java.lang.Object
-
- cl.cromer.azaraka.sound.Sound
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface cl.cromer.azaraka.Constants
Constants.AIHeuristic, Constants.LogLevel, Constants.PlayerAIType
-
-
Field Summary
-
Fields inherited from interface cl.cromer.azaraka.Constants
AI_HEURISTIC, APPEND_LOGS, CELL_PIXELS, CHESTS, ENEMIES, ENEMY_AI, EXPORT_SCENE, FONT, FONT_SIZE, GENERATE_SCENE, GLOBAL_LOG, HORIZONTAL_CELLS, LOG_TO_FILE, OBSTACLES, PLAYER_AI, PRETTY_JSON, TITLE, VERTICAL_CELLS, VOLUME
-
-
Constructor Summary
Constructors Constructor Description Sound(java.lang.String path)
Load the sound
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isPlaying()
Check if the sound clip is playing or notvoid
play()
Play the soundvoid
setLoops(int loops)
Set the number of loops to playvoid
setVolume(float volume)
Set the volume of the soundvoid
stop()
Stop the sound-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface cl.cromer.azaraka.Constants
getLogger, initializeLogger, random
-
-
-
-
Constructor Detail
-
Sound
public Sound(java.lang.String path) throws SoundException
Load the sound- Parameters:
path
- The path to the sound resource- Throws:
SoundException
- Thrown if the sound file could not be loaded
-
-
Method Detail
-
play
public void play() throws SoundException
Play the sound- Throws:
SoundException
- Thrown if the sound clip is null
-
isPlaying
public boolean isPlaying() throws SoundException
Check if the sound clip is playing or not- Returns:
- Returns true if the sound is playing or false otherwise
- Throws:
SoundException
- Thrown if the sound clip is null
-
stop
public void stop() throws SoundException
Stop the sound- Throws:
SoundException
- Thrown if the sound clip is null
-
setLoops
public void setLoops(int loops) throws SoundException
Set the number of loops to play- Parameters:
loops
- The number of loops, should be n-1- Throws:
SoundException
- Thrown if the sound is null
-
setVolume
public void setVolume(float volume) throws SoundException
Set the volume of the sound- Parameters:
volume
- Volume between 0f and 1f- Throws:
SoundException
- Thrown if the sound clip is null or the volume is out of range
-
-