Package ch.epfl.cs107.play.window.swing
Class SoundItem
java.lang.Object
ch.epfl.cs107.play.window.swing.SoundItem
- All Implemented Interfaces:
EventListener,LineListener
Play a single sound
https://bugs.openjdk.java.net/browse/JDK-8077019
-
Constructor Summary
ConstructorsConstructorDescriptionSoundItem(boolean loop, float volume, boolean fadeIn, boolean randomFirstStart, SwingSound sound) Default Sound Item constructor -
Method Summary
-
Constructor Details
-
SoundItem
public SoundItem(boolean loop, float volume, boolean fadeIn, boolean randomFirstStart, SwingSound sound) Default Sound Item constructor- Parameters:
loop- (boolean): indicate if the item restart on self-endingvolume- (float): 0.0f no sound, 1.0f full audiofadeIn- (boolean): indicate if the song fade in until reaching its max volumerandomFirstStart- (boolean): indicate if the first start is random in the soundsound- (SwingSound): the given sound to play. Not null
-
-
Method Details
-
start
public void start()Start the sound by asking a clip and starting it -
fadeIn
public void fadeIn()Can be called to fade in this item -
fadeOut
public void fadeOut()Can be called to fade out this item -
finish
public void finish()Finish the clip. Break the loop if any : force the end of the clip -
isFinish
public boolean isFinish()- Returns:
- (boolean): true if this item is finished
-
update
- Specified by:
updatein interfaceLineListener
-