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 arc.struct.Seq<arc.audio.Music> ambientMusic
      normal, ambient music, plays at any time
    • darkMusic

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

      public arc.struct.Seq<arc.audio.Music> bossMusic
      music used explicitly after boss spawns
    • uiBus

      public arc.audio.AudioBus uiBus
    • lastRandomPlayed

      protected arc.audio.Music lastRandomPlayed
    • timer

      protected arc.util.Interval timer
    • lastPlayed

      protected long lastPlayed
    • current

      @Nullable protected arc.audio.Music current
    • fade

      protected float fade
    • silenced

      protected boolean silenced
    • keepSilent

      protected boolean keepSilent
    • ambientThread

      @Nullable protected mindustry.audio.SoundControl.AudioThread ambientThread
    • launchingAmbientThread

      protected boolean launchingAmbientThread
    • localData

      protected arc.struct.Seq<SoundControl.SoundData> localData
    • wasPlaying

      protected boolean wasPlaying
    • filter

      protected arc.audio.AudioFilter filter
    • sounds

      protected arc.struct.ObjectMap<arc.audio.Sound,SoundControl.SoundData> sounds
  • Constructor Details

    • SoundControl

      public SoundControl()
  • Method Details

    • setupFilters

      protected void setupFilters()
    • reload

      protected void reload()
    • stop

      public void stop()
    • update

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

      public void keepSilent()
    • playMusic

      public void playMusic(@Nullable arc.audio.Music music, boolean interrupt)
    • isPlaying

      public boolean isPlaying()
    • getCurrent

      @Nullable public arc.audio.Music getCurrent()
    • playRandom

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

      protected boolean alwaysPlayMusic()
    • getBossMusic

      protected arc.struct.Seq<arc.audio.Music> getBossMusic()
    • getAmbientMusic

      protected arc.struct.Seq<arc.audio.Music> getAmbientMusic()
    • getDarkMusic

      protected arc.struct.Seq<arc.audio.Music> getDarkMusic()
    • isDark

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

      protected float volumeMultiplier()
    • play

      protected void play(@Nullable arc.audio.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(arc.audio.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.
    • findMusic

      @Nullable public static arc.audio.Music findMusic(String name)
    • loop

      public void loop(arc.audio.Sound sound, float volume)
    • loop

      public void loop(arc.audio.Sound sound, arc.math.geom.Position pos, float volume)
    • loop

      public void loop(arc.audio.Sound sound, arc.math.geom.Position pos, float volume, float pitch)
    • addAmbientSource

      public void addAmbientSource(AmbientSource source)
    • updateLoops

      protected void updateLoops()