Class SoundManager

java.lang.Object
com.bomber7.utils.SoundManager

public final class SoundManager extends Object
SoundManager manages sound effects used in the game.
  • Method Details

    • getInstance

      public static SoundManager getInstance()
      Retrieves the singleton instance of the SoundManager.
      Returns:
      the single SoundManager instance.
    • initialize

      public void initialize()
      Initializes the SoundManager manager.

      This method must be called before any sound access / play occurs.

    • play

      public void play(SoundType type)
      Play a sound.
      Parameters:
      type - the sound to play
    • playMenuMusic

      public void playMenuMusic(SoundType type)
      Play menu or general music. Automatically pauses fight music if it's playing.
      Parameters:
      type - the music type to play
    • playFightMusic

      public void playFightMusic()
      Play or resume fight music from saved position. Starts random fight music if none exists.
    • resetFightMusic

      public void resetFightMusic()
      Resets the fight music.
    • pauseFightMusic

      public void pauseFightMusic()
      Pauses fight music.
    • updateMusicVolume

      public void updateMusicVolume()
      Updates music volume. Has to be called whenever the music volume is modified, so the modification is applied instantly.
    • dispose

      public void dispose()
      Disposes of the sound resources to free memory. Should be called when the sounds are no longer needed.