Package com.shr4pnel.casino.audio
Class SoundEffectHelper
java.lang.Object
com.shr4pnel.casino.audio.SoundEffectHelper
Primarily a builder that makes it easy to create and manipulate SoundEffect instances
- Since:
- 0.1.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SoundEffectBuilds a sound effect instancestatic SoundEffectBuilds a sound effect instance, specifying a volumestatic voiddispose()Dispose of all loaded soundsstatic voidPlays a sound at full volumestatic voidPlays a sound at a specified volumestatic longplayWithID(String path) Plays a sound, retaining the sound IDstatic longplayWithID(String path, float volume) Plays a sound, retaining the sound ID at a specified volumestatic voidpreload()Preload all files in assets/soundstatic voidstopAll()Stop all actively playing sounds
-
Constructor Details
-
SoundEffectHelper
public SoundEffectHelper()
-
-
Method Details
-
play
Plays a sound at full volume- Parameters:
path- Path to audio file, relative to asset directory
-
play
Plays a sound at a specified volume- Parameters:
path- Path to audio file, relative to asset directoryvolume- Volume to play sound at, from 0-1
-
playWithID
Plays a sound, retaining the sound ID- Parameters:
path- Path to audio file, relative to asset directory- Returns:
- Sound ID
-
playWithID
Plays a sound, retaining the sound ID at a specified volume- Parameters:
path- Path to audio file, relative to asset directoryvolume- Volume to play sound at, from 0-1- Returns:
- Sound ID
-
build
Builds a sound effect instance- Parameters:
path- Path to audio file, relative to asset directory- Returns:
- A SoundEffect object, with builtin play and cancel methods to avoid manual management of ID
-
build
Builds a sound effect instance, specifying a volume- Parameters:
path- Path to audio file, relative to asset directory- Returns:
- A SoundEffect object, with builtin play and cancel methods to avoid manual management of ID
-
dispose
public static void dispose()Dispose of all loaded sounds -
preload
public static void preload()Preload all files in assets/sound -
stopAll
public static void stopAll()Stop all actively playing sounds
-