Package org.collebol.engine.audio
Class SoundPlayer
java.lang.Object
org.collebol.engine.audio.SoundPlayer
- All Implemented Interfaces:
AudioPlayer
The SoundPlayer class manages the playback of audio sounds in the game.
It handles the initialization of the OpenAL context, registration of sounds, and playing of sounds.
Usage:
SoundPlayer soundPlayer = new SoundPlayer();
soundPlayer.registerSound(sound);
soundPlayer.playSound(sound.getId());
- Since:
- 1.0-dev
- Author:
- ColleBol - contact@collebol.org
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe ModifySound class is used to modify sound properties before playing. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddisable()getName()voidPlay a modified sound with custom properties to an already existing sound.voidplayModifiedSound(SoundPlayer.ModifySound sound, Vector2D listenerPosition) Play a modified sound with custom properties to an already existing sound.voidplaySound(int id) Play a registered sound by its id.voidPlay a registered sound by its id.voidregisterSound(Sound sound) Register a sound to the player.
-
Constructor Details
-
SoundPlayer
SoundPlayer constructor.
-
-
Method Details
-
registerSound
Register a sound to the player.- Parameters:
sound- the sound to be registerd.
-
playSound
public void playSound(int id) Play a registered sound by its id.Listener position = 0,0
- Parameters:
id- the id of the sound to be played.
-
playModifiedSound
Play a modified sound with custom properties to an already existing sound.Listener position = 0,0
- Parameters:
sound- the modified sound.
-
disable
public void disable() -
getName
-