Interface SoundPlayerAPI


public interface SoundPlayerAPI
Author:
Alex Mosolov Copyright 2013 Fractal Softworks, LLC
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    applyLowPassFilter(float gain, float gainHF)
     
    Thread-safe - can be called from threads other than the main loop thread.
    org.lwjgl.util.vector.Vector2f
     
    void
     
    void
     
    void
    playCustomMusic(int fadeOutIfAny, int fadeIn, String musicSetId)
    Thread-safe - can be called from threads other than the main loop thread.
    void
    playCustomMusic(int fadeOutIfAny, int fadeIn, String musicSetId, boolean looping)
     
    void
    playLoop(String id, Object playingEntity, float pitch, float volume, org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel)
    Loop a sound.
    void
    playLoop(String id, Object playingEntity, float pitch, float volume, org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float fadeIn, float fadeOut)
     
    void
    playMusic(int fadeOutIfAny, int fadeIn, String musicSetId)
    Deprecated.
    playSound(String id, float pitch, float volume, org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel)
    Sound file must be *mono* for it to be properly played within the engine.
    void
    playUILoop(String id, float pitch, float volume)
     
    playUISound(String id, float pitch, float volume)
    UI sound files should be stereo.
    void
    Thread-safe - can be called from threads other than the main loop thread.
    void
     
    void
    setListenerPosOverrideOneFrame(org.lwjgl.util.vector.Vector2f listenerPosOverrideOneFrame)
     
    void
    setNextLoopFadeInAndOut(float nextLoopFadeIn, float nextLoopFadeOut)
     
    void
    setSuspendDefaultMusicPlayback(boolean suspendMusicPlayback)
    Thread-safe - can be called from threads other than the main loop thread.
  • Method Details

    • playUISound

      SoundAPI playUISound(String id, float pitch, float volume)
      UI sound files should be stereo.
      Parameters:
      id -
      pitch -
      volume -
    • playSound

      SoundAPI playSound(String id, float pitch, float volume, org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel)
      Sound file must be *mono* for it to be properly played within the engine.
      Parameters:
      id -
      pitch -
      volume -
      loc -
      vel -
      Returns:
    • playLoop

      void playLoop(String id, Object playingEntity, float pitch, float volume, org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel)
      Loop a sound. Must be called every frame or the loop will fade out. Should be mono.
      Parameters:
      id -
      playingEntity - Required. Used to help uniquely identify playing loops. Also used to figure out which loops to not play (i.e., same entity playing multiples of the same loop would only play the one.)
      pitch -
      volume -
      loc -
      vel -
    • restartCurrentMusic

      void restartCurrentMusic()
      Thread-safe - can be called from threads other than the main loop thread.
    • getCurrentMusicId

      String getCurrentMusicId()
      Thread-safe - can be called from threads other than the main loop thread. The music id is the name of the file, including its path. It is NOT the name of the music set that gets passed in to playMusic, which may consist of multiple files, one of which will get picked randomly. Returns the string "nothing" when nothing is playing.
      Returns:
    • playCustomMusic

      void playCustomMusic(int fadeOutIfAny, int fadeIn, String musicSetId)
      Thread-safe - can be called from threads other than the main loop thread. Fade in/out are in seconds and have to be whole numbers. Can pass in null for musicSetId to stop the current track without starting a new one.
      Parameters:
      fadeOutIfAny -
      fadeIn -
      musicSetId -
    • playMusic

      @Deprecated void playMusic(int fadeOutIfAny, int fadeIn, String musicSetId)
      Deprecated.
      Use playCustomMusic instead; has same effect. Deprecation is for naming consistency only.
      Parameters:
      fadeOutIfAny -
      fadeIn -
      musicSetId -
    • setSuspendDefaultMusicPlayback

      void setSuspendDefaultMusicPlayback(boolean suspendMusicPlayback)
      Thread-safe - can be called from threads other than the main loop thread. Won't stop any currently-playing music, but will prevent new tracks from starting playback automatically when the current one is over. Meant to be used in conjunction with playMusic() for customized music playback. See also: SettingsAPI.getCurrentGameState() Stops
      Parameters:
      suspendMusicPlayback -
    • getListenerPos

      org.lwjgl.util.vector.Vector2f getListenerPos()
    • pauseCustomMusic

      void pauseCustomMusic()
    • resumeCustomMusic

      void resumeCustomMusic()
    • playCustomMusic

      void playCustomMusic(int fadeOutIfAny, int fadeIn, String musicSetId, boolean looping)
    • playUILoop

      void playUILoop(String id, float pitch, float volume)
    • playLoop

      void playLoop(String id, Object playingEntity, float pitch, float volume, org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float fadeIn, float fadeOut)
    • applyLowPassFilter

      void applyLowPassFilter(float gain, float gainHF)
    • setListenerPosOverrideOneFrame

      void setListenerPosOverrideOneFrame(org.lwjgl.util.vector.Vector2f listenerPosOverrideOneFrame)
    • pauseMusic

      void pauseMusic()
    • setNextLoopFadeInAndOut

      void setNextLoopFadeInAndOut(float nextLoopFadeIn, float nextLoopFadeOut)