Package net.runelite.client.audio
Class AudioPlayer
- java.lang.Object
-
- net.runelite.client.audio.AudioPlayer
-
@Singleton public class AudioPlayer extends java.lang.ObjectGeneral audio playback manager. Not all audio formats are supported. Refer toAudioFileFormat.Typefor a list of formats supported by the sound system.
-
-
Constructor Summary
Constructors Constructor Description AudioPlayer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidplay(java.io.File file, float gain)Plays an audio stream loaded from a file object.voidplay(java.io.InputStream stream, float gain)Plays an audio stream from the provided input stream.voidplay(java.lang.Class<?> c, java.lang.String path, float gain)Plays an audio stream loaded from a class resource.
-
-
-
Method Detail
-
play
public void play(java.io.File file, float gain) throws java.io.IOException, javax.sound.sampled.UnsupportedAudioFileException, javax.sound.sampled.LineUnavailableExceptionPlays an audio stream loaded from a file object.- Parameters:
file- The file object pointing to the audio data.gain- Gain control (in dB) to apply to audio playback.- Throws:
java.io.IOExceptionjavax.sound.sampled.UnsupportedAudioFileExceptionjavax.sound.sampled.LineUnavailableException
-
play
public void play(java.lang.Class<?> c, java.lang.String path, float gain) throws java.io.IOException, javax.sound.sampled.UnsupportedAudioFileException, javax.sound.sampled.LineUnavailableExceptionPlays an audio stream loaded from a class resource.- Parameters:
c- The class with which to load the resource.path- The class resource path.gain- Gain control (in dB) to apply to audio playback.- Throws:
java.io.IOExceptionjavax.sound.sampled.UnsupportedAudioFileExceptionjavax.sound.sampled.LineUnavailableException
-
play
public void play(java.io.InputStream stream, float gain) throws java.io.IOException, javax.sound.sampled.UnsupportedAudioFileException, javax.sound.sampled.LineUnavailableExceptionPlays an audio stream from the provided input stream.- Parameters:
stream- The input stream containing the audio data.gain- Gain control (in dB) to apply to audio playback.- Throws:
java.io.IOExceptionjavax.sound.sampled.UnsupportedAudioFileExceptionjavax.sound.sampled.LineUnavailableException
-
-