Class SoundLoader

java.lang.Object
de.pottgames.tuningfork.SoundLoader

public abstract class SoundLoader extends Object
The SoundLoader class provides utility methods for loading audio files into SoundBuffers.
It supports various audio formats such as FLAC, OGG, WAV, MP3, and AIFF.
If you know the file type, I recommend using the file format loaders directly:
  • Constructor Details

    • SoundLoader

      public SoundLoader()
  • Method Details

    • load

      public static SoundBuffer load(com.badlogic.gdx.files.FileHandle file)
      Loads an audio file from the specified FileHandle and returns a SoundBuffer.
      Parameters:
      file - The FileHandle pointing to the audio file.
      Returns:
      A SoundBuffer containing the audio data.
      Throws:
      TuningForkRuntimeException - If there is an error during loading or if the file type cannot be identified.
    • loadReadable

      public static ReadableSoundBuffer loadReadable(com.badlogic.gdx.files.FileHandle file)
      Loads an audio file from the specified FileHandle and returns a SoundBuffer.
      Parameters:
      file - The FileHandle pointing to the audio file.
      Returns:
      A ReadableSoundBuffer containing the audio data.
      Throws:
      TuningForkRuntimeException - If there is an error during loading or if the file type cannot be identified.
    • loadReverse

      public static SoundBuffer loadReverse(com.badlogic.gdx.files.FileHandle file)
      Loads an audio file from the specified FileHandle and reverses the audio data.
      Parameters:
      file - The FileHandle pointing to the audio file.
      Returns:
      A SoundBuffer containing the reversed audio data.
      Throws:
      TuningForkRuntimeException - If there is an error during loading or if the file type cannot be identified.
    • loadReadableReverse

      public static ReadableSoundBuffer loadReadableReverse(com.badlogic.gdx.files.FileHandle file)
      Loads an audio file from the specified FileHandle and reverses the audio data.
      Parameters:
      file - The FileHandle pointing to the audio file.
      Returns:
      A ReadableSoundBuffer containing the reversed audio data.
      Throws:
      TuningForkRuntimeException - If there is an error during loading or if the file type cannot be identified.
    • load

      public static SoundBuffer load(AudioStream stream)
      Loads a SoundBuffer from any AudioStream.
      Parameters:
      stream -
      Returns:
      the SoundBuffer
    • loadReadable

      public static ReadableSoundBuffer loadReadable(AudioStream stream)
      Loads a ReadableSoundBuffer from any AudioStream.
      Parameters:
      stream -
      Returns:
      the ReadableSoundBuffer
    • load

      public static SoundBuffer load(com.badlogic.gdx.files.FileHandle file, boolean reverse)
      Loads an audio file from the specified FileHandle and returns a SoundBuffer. Optionally, it can load the audio in reverse order if the 'reverse' parameter is set to true.
      Parameters:
      file - The FileHandle pointing to the audio file.
      reverse - Whether to load the audio in reverse order.
      Returns:
      A SoundBuffer containing the audio data.
      Throws:
      TuningForkRuntimeException - If there is an error during loading or if the file type cannot be identified.
    • loadReadable

      public static ReadableSoundBuffer loadReadable(com.badlogic.gdx.files.FileHandle file, boolean reverse)
      Loads an audio file from the specified FileHandle and returns a ReadableSoundBuffer. Optionally, it can load the audio in reverse order if the 'reverse' parameter is set to true.
      Parameters:
      file - The FileHandle pointing to the audio file.
      reverse - Whether to load the audio in reverse order.
      Returns:
      A ReadableSoundBuffer containing the audio data.
      Throws:
      TuningForkRuntimeException - If there is an error during loading or if the file type cannot be identified.
      See Also: