Package pi.resources.sound
Class Sound
java.lang.Object
pi.resources.sound.Sound
This class implements all required functionality to load sounds from the file
system and provide a stream that can later on be used for the sound playback.
-
Constructor Summary
ConstructorsConstructorDescriptionSound(InputStream is, String name) Creates a new Sound instance by the specified file path. -
Method Summary
-
Constructor Details
-
Sound
Creates a new Sound instance by the specified file path. Loads the sound data into a byte array and also retrieves information about the format of the sound file.Note that the constructor is private. In order to load files use the static
Controller.sounds.get(String)method.- Parameters:
is- The input stream to load the sound from.name- The name of this sound file.- Throws:
IOException- If something went wrong loading the fileUnsupportedAudioFileException- If the audio format is not supported
-
-
Method Details
-
getFormat
Gets the audio format of this sound instance.- Returns:
- The audio format of this instance.
-
getName
Gets the name of this instance that is used to uniquely identify the resource of this sound.- Returns:
- The name of this sound.
-
getRawData
public byte[] getRawData()Gets the raw data of this sound as byte array.This is used during resource serialization.
- Returns:
- The raw data of this sound as byte array.
-
toString
-