![]() |
Gondwana Game Engine Development (master) - 2.6.1
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
|
Manages the lifecycle of audio resources independently of the playback backend. More...
Public Member Functions | |
| void | ConfigureBackend (IAudioBackend backend) |
| Configures the backend used for subsequently loaded audio resources. A backend cannot be replaced while resources are loaded. | |
| AudioResource | LoadFromFile (string key, string filePath, float volume, float pan) |
| Compatibility overload that loads an audio resource from a file path. Retains the pre-backend-refactor CLR signature for compiled callers. | |
| AudioResource | LoadFromFile (string key, string filePath, float volume=1.0f, float pan=0.0f, float playbackSpeed=1.0f) |
| Loads an audio resource from a file on disk. | |
| AudioResource | LoadFromStream (string key, Stream input, string fileExt, float volume, float pan) |
| Compatibility overload that loads an audio resource from a stream. Retains the pre-backend-refactor CLR signature for compiled callers. | |
| AudioResource | LoadFromStream (string key, Stream input, string fileExt, float volume=1.0f, float pan=0.0f, float playbackSpeed=1.0f) |
| Loads an audio resource from the provided Stream. | |
| AudioResource | LoadFromUri (string key, string uri, float volume=1.0f, float pan=0.0f, float playbackSpeed=1.0f) |
| Loads an audio source by URI. This is primarily intended for URI-capable backends such as browser audio. | |
| List< AudioResource > | LoadFromEngineAssetsFile (AssetsFile resourceFile, float defaultVolume, float defaultPan) |
| Compatibility overload that loads audio resources from an AssetsFile. Retains the pre-backend-refactor CLR signature for compiled callers. | |
| List< AudioResource > | LoadFromEngineAssetsFile (AssetsFile resourceFile, float defaultVolume=1.0f, float defaultPan=0.0f, float defaultPlaybackSpeed=1.0f) |
| Loads all audio entries from the provided AssetsFile and returns the loaded resources. | |
| AudioResource? | Clone (string key, string? newKey, float? volume, float? pan) |
| Compatibility overload that creates a clone of an existing audio resource. Retains the pre-backend-refactor CLR signature; the clone inherits its source's playback speed. | |
| AudioResource? | Clone (string key, string? newKey=null, float? volume=null, float? pan=null, float? playbackSpeed=null) |
| Creates a clone of an existing AudioResource. The clone may inherit or override volume, pan, and playback speed from the source resource. | |
| void | Unload (string key) |
| Unloads and disposes the audio resource with the specified key, if it exists. | |
| void | Clear () |
| Disposes and clears all loaded audio resources. | |
| bool | TryGet (string key, out AudioResource? resource) |
| Attempts to retrieve a loaded audio resource by key. | |
| AudioResource? | Get (string key) |
| Gets the AudioResource with the specified key, or null if not found. | |
| bool | Contains (string key) |
| Determines whether an audio resource with the specified key is loaded. | |
| IEnumerable< string > | GetAllKeys () |
| Returns all loaded audio resource keys. | |
| Dictionary< string, AudioResource > | GetAll () |
| Returns a snapshot dictionary of all loaded audio resources. | |
| void | Dispose () |
| Disposes the manager and all loaded audio resources. This method is idempotent. | |
Properties | |
| static AudioResourceManager | Instance [get] |
| Gets the singleton AudioResourceManager instance. | |
| IAudioBackend? | Backend [get] |
| Gets the currently configured audio backend, or null if none has been configured. | |
| bool | IsBackendConfigured [get] |
| Gets whether an audio backend has been configured. | |
Events | |
| EventHandler<(string Key, AudioResource Resource)>? | SoundDisposed |
| Occurs when a loaded AudioResource is disposed and removed from the manager. The event payload contains the resource key and the AudioResource instance. | |
Manages the lifecycle of audio resources independently of the playback backend.
Definition at line 10 of file AudioResourceManager.cs.
| void Gondwana.Audio.AudioResourceManager.Clear | ( | ) |
Disposes and clears all loaded audio resources.
Definition at line 436 of file AudioResourceManager.cs.
| AudioResource? Gondwana.Audio.AudioResourceManager.Clone | ( | string | key, |
| string? | newKey, | ||
| float? | volume, | ||
| float? | pan ) |
Compatibility overload that creates a clone of an existing audio resource. Retains the pre-backend-refactor CLR signature; the clone inherits its source's playback speed.
| key | Key of the source resource to clone. |
| newKey | Optional key for the clone. If null, a generated key is used. |
| volume | Optional volume override for the clone. |
| pan | Optional pan override for the clone. |
| AudioResource? Gondwana.Audio.AudioResourceManager.Clone | ( | string | key, |
| string? | newKey = null, | ||
| float? | volume = null, | ||
| float? | pan = null, | ||
| float? | playbackSpeed = null ) |
Creates a clone of an existing AudioResource. The clone may inherit or override volume, pan, and playback speed from the source resource.
| key | Key of the resource to clone. |
| newKey | Optional new key for the clone. If null a generated key is used. |
| volume | Optional volume override for the clone. |
| pan | Optional pan override for the clone. |
| playbackSpeed | Optional playback speed override for the clone. |
Definition at line 274 of file AudioResourceManager.cs.
| void Gondwana.Audio.AudioResourceManager.ConfigureBackend | ( | IAudioBackend | backend | ) |
Configures the backend used for subsequently loaded audio resources. A backend cannot be replaced while resources are loaded.
| backend | The IAudioBackend implementation to use for audio playback. |
| InvalidOperationException | Thrown if attempting to replace the configured backend while audio resources are still loaded. |
Definition at line 46 of file AudioResourceManager.cs.
| bool Gondwana.Audio.AudioResourceManager.Contains | ( | string | key | ) |
Determines whether an audio resource with the specified key is loaded.
| key | Key to check for existence. |
| void Gondwana.Audio.AudioResourceManager.Dispose | ( | ) |
Disposes the manager and all loaded audio resources. This method is idempotent.
Definition at line 485 of file AudioResourceManager.cs.
| AudioResource? Gondwana.Audio.AudioResourceManager.Get | ( | string | key | ) |
Gets the AudioResource with the specified key, or null if not found.
| key | Key of the audio resource to retrieve. |
| Dictionary< string, AudioResource > Gondwana.Audio.AudioResourceManager.GetAll | ( | ) |
Returns a snapshot dictionary of all loaded audio resources.
| IEnumerable< string > Gondwana.Audio.AudioResourceManager.GetAllKeys | ( | ) |
Returns all loaded audio resource keys.
| List< AudioResource > Gondwana.Audio.AudioResourceManager.LoadFromEngineAssetsFile | ( | AssetsFile | resourceFile, |
| float | defaultVolume, | ||
| float | defaultPan ) |
Compatibility overload that loads audio resources from an AssetsFile. Retains the pre-backend-refactor CLR signature for compiled callers.
| resourceFile | The AssetsFile containing audio entries. |
| defaultVolume | Default volume to apply to loaded resources. |
| defaultPan | Default pan to apply to loaded resources. |
| List< AudioResource > Gondwana.Audio.AudioResourceManager.LoadFromEngineAssetsFile | ( | AssetsFile | resourceFile, |
| float | defaultVolume = 1::0f, | ||
| float | defaultPan = 0::0f, | ||
| float | defaultPlaybackSpeed = 1::0f ) |
Loads all audio entries from the provided AssetsFile and returns the loaded resources.
| resourceFile | The AssetsFile to read audio entries from. |
| defaultVolume | Default volume to apply when an entry does not specify one. |
| defaultPan | Default pan to apply when an entry does not specify one. |
| defaultPlaybackSpeed | Default playback speed for loaded resources. |
Definition at line 194 of file AudioResourceManager.cs.
| AudioResource Gondwana.Audio.AudioResourceManager.LoadFromFile | ( | string | key, |
| string | filePath, | ||
| float | volume, | ||
| float | pan ) |
Compatibility overload that loads an audio resource from a file path. Retains the pre-backend-refactor CLR signature for compiled callers.
| key | Unique key for the audio resource. |
| filePath | Path to the audio file to load. |
| volume | Initial volume (0.0 to 1.0). |
| pan | Initial stereo pan (-1.0 to 1.0). |
| AudioResource Gondwana.Audio.AudioResourceManager.LoadFromFile | ( | string | key, |
| string | filePath, | ||
| float | volume = 1::0f, | ||
| float | pan = 0::0f, | ||
| float | playbackSpeed = 1::0f ) |
Loads an audio resource from a file on disk.
| key | Unique key for the audio resource. |
| filePath | Path to the audio file. |
| volume | Initial volume (0.0 to 1.0). |
| pan | Initial stereo pan (-1.0 to 1.0). |
| playbackSpeed | Initial playback speed (clamped to allowed range). |
Definition at line 87 of file AudioResourceManager.cs.
| AudioResource Gondwana.Audio.AudioResourceManager.LoadFromStream | ( | string | key, |
| Stream | input, | ||
| string | fileExt, | ||
| float | volume, | ||
| float | pan ) |
Compatibility overload that loads an audio resource from a stream. Retains the pre-backend-refactor CLR signature for compiled callers.
| key | Unique key for the audio resource. |
| input | Input Stream containing audio data. |
| fileExt | File extension or hint for the audio data (e.g. ".wav"). |
| volume | Initial volume (0.0 to 1.0). |
| pan | Initial stereo pan (-1.0 to 1.0). |
| AudioResource Gondwana.Audio.AudioResourceManager.LoadFromStream | ( | string | key, |
| Stream | input, | ||
| string | fileExt, | ||
| float | volume = 1::0f, | ||
| float | pan = 0::0f, | ||
| float | playbackSpeed = 1::0f ) |
Loads an audio resource from the provided Stream.
| key | Unique key for the audio resource. |
| input | Input Stream containing audio data. |
| fileExt | File extension or hint for the audio data (e.g. ".ogg"). |
| volume | Initial volume (0.0 to 1.0). |
| pan | Initial stereo pan (-1.0 to 1.0). |
| playbackSpeed | Initial playback speed (clamped to allowed range). |
Definition at line 121 of file AudioResourceManager.cs.
| AudioResource Gondwana.Audio.AudioResourceManager.LoadFromUri | ( | string | key, |
| string | uri, | ||
| float | volume = 1::0f, | ||
| float | pan = 0::0f, | ||
| float | playbackSpeed = 1::0f ) |
Loads an audio source by URI. This is primarily intended for URI-capable backends such as browser audio.
| key | Unique key for the audio resource. |
| uri | The URI referencing the audio resource. |
| volume | Initial volume (0.0 to 1.0). |
| pan | Initial stereo pan (-1.0 to 1.0). |
| playbackSpeed | Initial playback speed (clamped to allowed range). |
| ArgumentException | Thrown when uri is null or whitespace. |
Definition at line 144 of file AudioResourceManager.cs.
| bool Gondwana.Audio.AudioResourceManager.TryGet | ( | string | key, |
| out AudioResource? | resource ) |
Attempts to retrieve a loaded audio resource by key.
| key | Key of the audio resource to retrieve. |
| resource | When this method returns, contains the AudioResource associated with the key, if found; otherwise null. |
| void Gondwana.Audio.AudioResourceManager.Unload | ( | string | key | ) |
Unloads and disposes the audio resource with the specified key, if it exists.
| key | Key of the audio resource to unload. |
Definition at line 424 of file AudioResourceManager.cs.
|
get |
Gets the currently configured audio backend, or null if none has been configured.
Definition at line 35 of file AudioResourceManager.cs.
|
staticget |
Gets the singleton AudioResourceManager instance.
Definition at line 32 of file AudioResourceManager.cs.
|
get |
Gets whether an audio backend has been configured.
Definition at line 38 of file AudioResourceManager.cs.
| EventHandler<(string Key, AudioResource Resource)>? Gondwana.Audio.AudioResourceManager.SoundDisposed |
Occurs when a loaded AudioResource is disposed and removed from the manager. The event payload contains the resource key and the AudioResource instance.
Definition at line 25 of file AudioResourceManager.cs.