Package io.github.espressoengine.sound
Class Sound
java.lang.Object
io.github.espressoengine.sound.Sound
Plays sound with javax.sound.sampled
. Right now, due to the way these libraries work, you can only use .wav files.
Sound.getClip
.- Version:
- $Id: $Id
- Author:
- pastthepixels
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
volume_db
public float volume_db
-
-
Constructor Details
-
Sound
Constuctor that creates a newSound
from a file path by callingSound.getClip
.- Parameters:
path
- aString
object
-
-
Method Details
-
getClip
public static Clip getClip(String path) throws UnsupportedAudioFileException, IOException, LineUnavailableException Gets a clip from a file path. Since this is built withjavax.sound
it only supports .wav files at the moment.- Parameters:
path
- aString
object- Returns:
- a
Clip
object - Throws:
UnsupportedAudioFileException
- if any.IOException
- if any.LineUnavailableException
- if any.
-
setLoop
public void setLoop(boolean loop) Sets the sound clip (javax.sound.sampled.Clip
) to loop continuously or not.- Parameters:
loop
- a boolean
-
play
public void play()Plays the sound on a new thread.
-