Package dev.kyzel.sfx
Class Sound
java.lang.Object
dev.kyzel.sfx.Sound
A class to handle Sound.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]
The bytes of the input file.private final AudioFormat
Format of the input audio file.static final Sound
The sound when an Entity is hurt.static final Sound
The sound when player's level goes up.static final Sound
The sound when player loses.static final Sound
The sound when player misses.static final Sound
The sound when player is hurt.private Clip
The clip that is currently playing.static final Sound
The sound when player's score goes up.static final Sound
The theme song of the game. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
THEME
The theme song of the game. -
SCORE_UP
The sound when player's score goes up. -
LEVEL_UP
The sound when player's level goes up. -
HURT
The sound when an Entity is hurt. -
LOSE
The sound when player loses. -
PLAYER_HURT
The sound when player is hurt. -
MISS
The sound when player misses. -
format
Format of the input audio file. -
bytes
private final byte[] bytesThe bytes of the input file. -
playingClip
The clip that is currently playing.
-
-
Constructor Details
-
Sound
Creates a new Sound with the given path.- Parameters:
path
- the path of the sound file
-
-
Method Details
-
play
public void play()Plays the sound. -
stop
public void stop()Stops if the sound is currently playing. -
play
public void play(boolean loop) Plays the sound.- Parameters:
loop
- the sound will be looped if true, and vice versa
-