Class SoundBoard

java.lang.Object
tripleplay.sound.SoundBoard

public class SoundBoard extends Object
Manages sound clips (sfx) and loops (music). Allows for master volume adjustment, and applying adjusted volume to currently playing loops. The expected usage pattern is to create a separate sound board for every collection of sounds that share a single volume control. For example, one might create one board for SFX and one board for music so that each could be volume controlled (and disabled) separately.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    react.Value<Boolean>
    Controls whether this sound board is muted.
    final Platform
    The platform on which this sound board is operating.
    react.Value<Float>
    Controls the volume of this sound board.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SoundBoard(Platform plat, react.Signal<Clock> paint)
    Creates a sound board which will play sounds via plat and connect to paint to receive per-frame updates.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates and returns a clip with the supplied path.
    Creates and returns a loop with the supplied path.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • plat

      public final Platform plat
      The platform on which this sound board is operating.
    • volume

      public react.Value<Float> volume
      Controls the volume of this sound board.
    • muted

      public react.Value<Boolean> muted
      Controls whether this sound board is muted. When muted, no sounds will play.
  • Constructor Details

    • SoundBoard

      public SoundBoard(Platform plat, react.Signal<Clock> paint)
      Creates a sound board which will play sounds via plat and connect to paint to receive per-frame updates.
  • Method Details

    • getClip

      public Clip getClip(String path)
      Creates and returns a clip with the supplied path. This clip will contain its own copy of the sound data at the specified path, and thus should be retained by the caller if it will be used multiple times before being released. Once all references to this clip are released, it will be garbage collected and its sound data unloaded.
    • getLoop

      public Loop getLoop(String path)
      Creates and returns a loop with the supplied path. The loop will contain its own copy of the sound data at the specified path, and thus should be retained by the caller if it will be used multiple times before being released. Once all references to this loop are released, it will be garbage collected and its sound data unloaded.