Class SoundEffectHelper

java.lang.Object
com.shr4pnel.casino.audio.SoundEffectHelper

public class SoundEffectHelper extends Object
Primarily a builder that makes it easy to create and manipulate SoundEffect instances
Since:
0.1.0
See Also:
  • Constructor Details

    • SoundEffectHelper

      public SoundEffectHelper()
  • Method Details

    • play

      public static void play(String path)
      Plays a sound at full volume
      Parameters:
      path - Path to audio file, relative to asset directory
    • play

      public static void play(String path, float volume)
      Plays a sound at a specified volume
      Parameters:
      path - Path to audio file, relative to asset directory
      volume - Volume to play sound at, from 0-1
    • playWithID

      public static long playWithID(String path)
      Plays a sound, retaining the sound ID
      Parameters:
      path - Path to audio file, relative to asset directory
      Returns:
      Sound ID
    • playWithID

      public static long playWithID(String path, float volume)
      Plays a sound, retaining the sound ID at a specified volume
      Parameters:
      path - Path to audio file, relative to asset directory
      volume - Volume to play sound at, from 0-1
      Returns:
      Sound ID
    • build

      public static SoundEffect build(String path)
      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

      public static SoundEffect build(String path, float vol)
      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