Class SoundControl

java.lang.Object
mindustry.audio.SoundControl

public class SoundControl extends Object
Controls playback of multiple audio tracks.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    arc.struct.Seq<arc.audio.Music>
    normal, ambient music, plays at any time
    arc.struct.Seq<arc.audio.Music>
    music used explicitly after boss spawns
    protected arc.audio.Music
     
    arc.struct.Seq<arc.audio.Music>
    darker music, used in times of conflict
    protected float
     
    protected arc.audio.AudioFilter
     
    float
     
    float
     
    protected long
     
    protected arc.audio.Music
     
    float
     
    float
     
    float
     
    protected boolean
     
    protected arc.struct.ObjectMap<arc.audio.Sound,SoundControl.SoundData>
     
    protected arc.util.Interval
     
    protected arc.audio.AudioBus
     
    protected boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    Whether to play dark music.
    void
    loop(arc.audio.Sound sound, float volume)
     
    void
    loop(arc.audio.Sound sound, arc.math.geom.Position pos, float volume)
     
    void
    loop(arc.audio.Sound sound, arc.math.geom.Position pos, float volume, float pitch)
     
    protected void
    play(arc.audio.Music music)
    Plays and fades in a music track.
    protected void
    playOnce(arc.audio.Music music)
    Plays a music track once and only once.
    void
    Plays a random track.
    protected void
     
    protected void
     
    protected boolean
     
    protected void
    Fades out the current track, unless it has already been silenced.
    void
     
    void
    Update and play the right music track.
    protected void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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
    • 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
    • uiBus

      protected arc.audio.AudioBus uiBus
    • 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()
    • 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)
    • 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 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.