Class TMusicLoop

Unit

Declaration

type TMusicLoop = class(TObject)

Description

Class to play an individual sound or a music (as background loop or not)

Hierarchy

Overview

Methods

Public constructor Create; virtual;
Public destructor Destroy; override;
Public function Load(Filename: string): TMusicLoop;
Public procedure Play(Filename: string; LectureEnBoucle: boolean = true); overload;
Public procedure Play(LectureEnBoucle: boolean = true); overload;
Public procedure PlaySound;
Public procedure Stop;
Public procedure Pause;
Public function isPaused: boolean;
Public function IsPlaying: boolean;
Public function IsActive: boolean;
Public function CurrentTimeInSeconds: integer;
Public function DurationInSeconds: integer;
Public class function Current: TMusicLoop;

Properties

Protected property tag: integer read Ftag write Settag;
Protected property audioActif: boolean read FaudioActif write SetaudioActif;
Protected property audioOn: boolean read FaudioOn write SetaudioOn;
Protected property audioEnBoucle: boolean read FaudioEnBoucle write SetaudioEnBoucle;
Protected property AudioPaused: boolean read FAudioPaused write SetAudioPaused;
Public property Filename: string read getFileName;
Public property Volume: TVolumeSonore read getVolume write SetVolume;

Description

Methods

Public constructor Create; virtual;

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

Public destructor Destroy; override;

Destroy this instance

Public function Load(Filename: string): TMusicLoop;

Load a music or sound (file formats depend on the operating system). You can try MP3 for music and WAV for sounds

Public procedure Play(Filename: string; LectureEnBoucle: boolean = true); overload;

Load and play a sound or music

Public procedure Play(LectureEnBoucle: boolean = true); overload;

Play current soound or music in an infinite loop or one time

Public procedure PlaySound;

Just play current sound once time

Public procedure Stop;

Stop current play (sound or music)

Public procedure Pause;

Stop the music or restart it if it was paused

Public function isPaused: boolean;

Return true if the music is in pause

Public function IsPlaying: boolean;

Check if a sound or music is playing

Public function IsActive: boolean;

Check if a sound or music file is loaded

Public function CurrentTimeInSeconds: integer;

Return current playing time in seconds

Public function DurationInSeconds: integer;

Return the music duration in seconds

Public class function Current: TMusicLoop;

Get the instance of the default music loop to use it as a singleton

Properties

Protected property tag: integer read Ftag write Settag;
 
Protected property audioActif: boolean read FaudioActif write SetaudioActif;
 
Protected property audioOn: boolean read FaudioOn write SetaudioOn;
 
Protected property audioEnBoucle: boolean read FaudioEnBoucle write SetaudioEnBoucle;
 
Protected property AudioPaused: boolean read FAudioPaused write SetAudioPaused;
 
Public property Filename: string read getFileName;
 
Public property Volume: TVolumeSonore read getVolume write SetVolume;

Set or get volume level for current playing sound or music

Delphi Game Engine (c) 2021-2025 Patrick PREMARTIN - Powered by PasDoc
Generated by PasDoc 0.16.0.