Class SoundControl

java.lang.Object
mindustry.audio.SoundControl

public class SoundControl extends Object
Controls playback of multiple audio tracks.
  • Field Details

    • finTime

      public float finTime
    • foutTime

      public float foutTime
    • musicInterval

      public float musicInterval
    • musicChance

      public float musicChance
    • musicWaveChance

      public float musicWaveChance
    • ambientMusic

      public Seq<Music> ambientMusic
      normal, ambient music, plays at any time
    • darkMusic

      public Seq<Music> darkMusic
      darker music, used in times of conflict
    • bossMusic

      public Seq<Music> bossMusic
      music used explicitly after boss spawns
    • lastRandomPlayed

      protected Music lastRandomPlayed
    • timer

      protected Interval timer
    • current

      @Nullable protected Music current
    • fade

      protected float fade
    • silenced

      protected boolean silenced
    • uiBus

      protected AudioBus uiBus
    • wasPlaying

      protected boolean wasPlaying
    • filter

      protected AudioFilter filter
    • sounds

  • Constructor Details

    • SoundControl

      public SoundControl()
  • Method Details

    • setupFilters

      protected void setupFilters()
    • reload

      protected void reload()
    • loop

      public void loop(Sound sound, float volume)
    • loop

      public void loop(Sound sound, Position pos, float volume)
    • stop

      public void stop()
    • update

      public void update()
      Update and play the right music track.
    • updateLoops

      protected void updateLoops()
    • playRandom

      public void playRandom()
      Plays a random track.
    • isDark

      protected boolean isDark()
      Whether to play dark music.
    • play

      protected void play(@Nullable Music music)
      Plays and fades in a music track. This must be called every frame. If something is already playing, fades out that track and fades in this new music.
    • playOnce

      protected void playOnce(Music music)
      Plays a music track once and only once. If something is already playing, does nothing.
    • shouldPlay

      protected boolean shouldPlay()
    • silence

      protected void silence()
      Fades out the current track, unless it has already been silenced.