TSoundList Class

Definition

Class to manage all sounds (or musics) of a game Use it if you want to register sounds once and play them as many time you need

Delphi
type TSoundList = class(TObject)
Inheritance
TObject
TSoundList

Constructors

Create

Create an instance of a TSoundList or use "TSoundList.Current" to use the default one

Destroy

Destroy this instance

Properties

Volume

Set or get volume level for all sounds / musics of this TSoundList

Methods

Add(Integer, string)

Add the "filename" sound to the available sounds list at the SoundID position and return True if it's ok

Add(string)

Add the "filename" sound to the available sounds list and return it's index

Current

Get the instance of the default sound list to use it as a singleton

Mute(Integer)

Stop all players playing the SoundID

MuteAll

Stop all active players

Play(Integer, Boolean)

Play the sound "SoundID", in a loop or not, and return its Player ID If the sound is played, the result is >= 0 If it returns -1, an error happened

Stop(Integer)

Stop a player by its PlayerID

Fields

FCurrent
FPlayers

List of TMusicLoop players used to play those sounds/musics

FSounds

List of sounds/musics filenames