Class MusicManager

java.lang.Object
com.realtime.crossfire.jxclient.sound.MusicManager

public class MusicManager extends Object
Plays background music. At most one background music can be concurrently active (except for fading in/out effects).
  • Constructor Details

    • MusicManager

      public MusicManager(@NotNull @NotNull AudioFileLoader audioFileLoader, @Nullable @Nullable DebugWriter debugSound)
      Creates a new instance.
      Parameters:
      audioFileLoader - the audio file loader for loading audio files
      debugSound - the writer for logging sound related information or null to not log
  • Method Details

    • play

      public void play(@Nullable @Nullable CharSequence name)
      Plays the given music. If the new music name is unchanged, continue playing.
      Parameters:
      name - the music name, or null to stop playing music
    • setEnabled

      public void setEnabled(boolean enabled)
      Sets whether background music is enabled.
      Parameters:
      enabled - whether background music is enabled
    • setMuted

      public void setMuted(boolean muted)
      Sets whether background music is muted.
      Parameters:
      muted - whether background music is muted
    • shutdown

      public void shutdown()
      Terminates a playing background music and free resources.