Class TSoundList
Unit
Gamolf.FMX.MusicLoop
Declaration
type TSoundList = class(TObject)
Description
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
Hierarchy
Overview
Fields
Methods
 |
constructor Create; virtual; |
 |
destructor Destroy; override; |
 |
class function Current: TSoundList; |
 |
function Add(Filename: string): integer; overload; |
 |
function Add(SoundID: integer; Filename: string): boolean; overload; |
 |
function Play(SoundID: integer; Loop: boolean = false): integer; |
 |
procedure Stop(PlayerID: integer); |
 |
procedure Mute(SoundID: integer); |
 |
procedure MuteAll; |
Properties
Description
Fields
 |
var FSounds: TDictionary<integer, string>; |
List of sounds/musics filenames
|
 |
FPlayers: TObjectList<TMusicLoop>; |
List of TMusicLoop players used to play those sounds/musics
|
Methods
 |
constructor Create; virtual; |
Create an instance of a TSoundList or use "TSoundList.Current" to use the default one
|
 |
destructor Destroy; override; |
Destroy this instance
|
 |
class function Current: TSoundList; |
Get the instance of the default sound list to use it as a singleton
|
 |
function Add(Filename: string): integer; overload; |
Add the "filename" sound to the available sounds list and return it's index
|
 |
function Add(SoundID: integer; Filename: string): boolean; overload; |
Add the "filename" sound to the available sounds list at the SoundID position and return True if it's ok
|
 |
function Play(SoundID: integer; Loop: boolean = false): integer; |
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
|
 |
procedure Stop(PlayerID: integer); |
Stop a player by its PlayerID
|
 |
procedure Mute(SoundID: integer); |
Stop all players playing the SoundID
|
 |
procedure MuteAll; |
Stop all active players
|
Properties
 |
property Volume: TVolumeSonore read FVolume write SetVolume; |
Set or get volume level for all sounds / musics of this TSoundList
|
Delphi Game Engine (c) 2021-2025
Patrick PREMARTIN - Powered by
PasDoc
Generated by PasDoc 0.16.0.