Gorilla.Audio.Manager Unit Reference

Overview

The Gorilla.Audio.Manager unit provides audio management for Gorilla3D. It contains two main classes: TGorillaLegacyAudioManager (thread-based, uses FMX TMediaPlayer) and TGorillaAudioManager (abstract base for modern backends like FMOD and OpenAL).

Class Hierarchy

TThread
  └── TGorillaLegacyAudioManager

TFmxObject
  └── TGorillaAudioManager (abstract)

TCollectionItem
  └── TGorillaSoundItem (abstract)
  └── TGorillaChannelItem
  └── TGorillaAudioEffectItem

Enumerations

TGorillaAudioAction

Value Description
Cache Cache audio file to memory
Play Start playback
Stop Stop playback
Pause Pause or resume playback

TGorillaAudioMode

Value Description
Once Play audio once
Loop Play audio in a loop

Records

TCacheAudioEntry

Field Type Description
Id Integer Unique audio identifier
Mode TGorillaAudioMode Playback mode
Volume Single Volume level
Player TMediaPlayer FMX media player instance

TQueueAudioEntry

Field Type Description
Id Integer Unique audio identifier
Mode TGorillaAudioMode Playback mode
Action TGorillaAudioAction Queue action
AudioFile String File path
Volume Single Volume (default 0.75)

TGorillaLegacyAudioManager

Thread-based audio manager using FMX TMediaPlayer. Simple but not high-performance. Each audio file gets its own TMediaPlayer instance.

Public Properties

Property Type Default Description
LoopCheckInterval Integer 100 Loop check interval in ms
QueueTimeout Integer 250 Queue wait timeout in ms
Mute Boolean False Mute all audio

Public Methods

Method Description
BeginCaching() Start batch caching (boosts load performance)
EndCaching() End batch caching
AudioAlreadyCached(AId) Check if audio is cached
Add(AId, AFilename, AVolume) Cache an audio file
Play(AId, AMode, AVolume) Play a cached audio file
Stop(AId) Stop playback
Pause(AId) Pause/resume playback
PauseAll() Pause all playing audio
StopAll() Stop all playing audio

TGorillaAudioManager

Abstract base class for modern audio backends. Subclassed by FMOD and OpenAL implementations.

Public Properties

Property Type Description
OnUpdate TNotifyEvent Fired when Update() is called (main-thread synchronized)
OnListenerUpdated TNotifyEvent Fired when listener settings change

Abstract Methods

Method Description
ClearSounds() Remove all sound handles
LoadSoundFromFile(AFilename) Load sound from file
LoadSoundFromStream(AStream) Load sound from stream
LoadSoundFromStream(AMemStream) Load sound from memory stream (streaming)
LoadSoundItemFromFile(AFilename) Load and return a TGorillaSoundItem
LoadSoundItemFromStream(AStream) Load from stream and return a TGorillaSoundItem

TGorillaSoundItem

Abstract collection item representing a single sound.

Published Properties

Property Type Description
FileName TFileName Sound file path
PlaybackPosition UInt32 Current playback position (read-only)
PlaybackLength UInt32 Total length (read-only)

Abstract Methods

Method Description
IsPlaying() Check if sound is playing
Play() Start playback
Pause() Pause playback
Resume() Resume playback
Stop() Stop playback

See Also