Class SoundAcoustics

java.lang.Object
ch.epfl.cs107.play.engine.actor.SoundAcoustics
All Implemented Interfaces:
Acoustics

public class SoundAcoustics extends Object implements Acoustics
  • Constructor Summary

    Constructors
    Constructor
    Description
    Alternative sound Acoustics constructor
    SoundAcoustics(String name, float volume, boolean fadeIn, boolean randomFirstStart, boolean loop, boolean stopOthersOnStart)
    Default sound Acoustics constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    bip(Audio audio)
    Play itself on specified Audio context.
    void
    Set the "should be started" flag to true
    static void
    Stop all sounds from given audio context by sending a null sound that stop others on starts

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SoundAcoustics

      public SoundAcoustics(String name, float volume, boolean fadeIn, boolean randomFirstStart, boolean loop, boolean stopOthersOnStart)
      Default sound Acoustics constructor
      Parameters:
      name - (String): name of the sound without path and extension. May be bull
      volume - (float): 0.0f no sound, 1.0f full audio
      fadeIn - (boolean): indicate if the song fade in until reaching its max volume
      randomFirstStart - (boolean): indicate if the first start is random in the sound
      loop - (boolean): indicate if the sound must loop on self ending
      stopOthersOnStart - (boolean): indicate if all other sound are stopped on given sound's start
    • SoundAcoustics

      public SoundAcoustics(String name)
      Alternative sound Acoustics constructor
      Parameters:
      name - (String): name of the sound without path and extension. May be null
  • Method Details

    • shouldBeStarted

      public void shouldBeStarted()
      Set the "should be started" flag to true
    • bip

      public void bip(Audio audio)
      Description copied from interface: Acoustics
      Play itself on specified Audio context.
      Specified by:
      bip in interface Acoustics
      Parameters:
      audio - (Audio) target, not null
    • stopAllSounds

      public static void stopAllSounds(Audio audio)
      Stop all sounds from given audio context by sending a null sound that stop others on starts
      Parameters:
      audio - (Audio): given audio context. Not null