Class SoundLoader
java.lang.Object
de.pottgames.tuningfork.SoundLoader
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:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SoundBufferload(com.badlogic.gdx.files.FileHandle file) Loads an audio file from the specified FileHandle and returns a SoundBuffer.static SoundBufferload(com.badlogic.gdx.files.FileHandle file, boolean reverse) Loads an audio file from the specified FileHandle and returns a SoundBuffer.static SoundBufferload(AudioStream stream) Loads a SoundBuffer from any AudioStream.static ReadableSoundBufferloadReadable(com.badlogic.gdx.files.FileHandle file) Loads an audio file from the specified FileHandle and returns a SoundBuffer.static ReadableSoundBufferloadReadable(com.badlogic.gdx.files.FileHandle file, boolean reverse) Loads an audio file from the specified FileHandle and returns a ReadableSoundBuffer.static ReadableSoundBufferloadReadable(AudioStream stream) Loads a ReadableSoundBuffer from any AudioStream.static ReadableSoundBufferloadReadableReverse(com.badlogic.gdx.files.FileHandle file) Loads an audio file from the specified FileHandle and reverses the audio data.static SoundBufferloadReverse(com.badlogic.gdx.files.FileHandle file) Loads an audio file from the specified FileHandle and reverses the audio data.
-
Constructor Details
-
SoundLoader
public SoundLoader()
-
-
Method Details
-
load
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
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
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
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
Loads a SoundBuffer from any AudioStream.- Parameters:
stream-- Returns:
- the SoundBuffer
-
loadReadable
Loads a ReadableSoundBuffer from any AudioStream.- Parameters:
stream-- Returns:
- the ReadableSoundBuffer
-
load
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:
-