Isle
Loading...
Searching...
No Matches
LegoCacheSoundManager Class Reference

[AI] Manages caching, reuse, and playback of LegoCacheSound objects. More...

#include <legocachesoundmanager.h>

Public Member Functions

 LegoCacheSoundManager ()
 [AI] Default constructor. [AI] More...
 
 ~LegoCacheSoundManager ()
 [AI] Destructor. Cleans up all cached sound entries in set and list, stops sounds and deletes sound objects. [AI] More...
 
virtual MxResult Tickle ()
 [AI] Advances or cleans up all managed sounds. More...
 
LegoCacheSoundFindSoundByKey (const char *p_key)
 [AI] Attempts to find and return a cached sound by its key (case-insensitive). More...
 
LegoCacheSoundManageSoundEntry (LegoCacheSound *p_sound)
 [AI] Manages a sound entry. More...
 
LegoCacheSoundPlay (const char *p_key, const char *p_name, MxBool p_looping)
 [AI] Plays a sound identified by key, with the given playback name and looping flag. More...
 
LegoCacheSoundPlay (LegoCacheSound *p_sound, const char *p_name, MxBool p_looping)
 [AI] Plays a given sound object, with named playback and looping option. More...
 
void Stop (LegoCacheSound *&p_sound)
 [AI] Stops playback of the specified sound object. More...
 
void Destroy (LegoCacheSound *&p_sound)
 [AI] Destroys (deletes and removes) the specified sound object from all tracking. More...
 

Detailed Description

[AI] Manages caching, reuse, and playback of LegoCacheSound objects.

Provides fast sound lookup by name/key, supports object reuse, sound playback, and sound destruction. [AI]

[AI] Holds two containers: a set for quick lookup (by name) and a list for managing sounds in use, properly cleaning up both on destruction. [AI] Size: 0x20 bytes.

Definition at line 81 of file legocachesoundmanager.h.

Constructor & Destructor Documentation

◆ LegoCacheSoundManager()

LegoCacheSoundManager::LegoCacheSoundManager ( )
inline

[AI] Default constructor. [AI]

Definition at line 84 of file legocachesoundmanager.h.

◆ ~LegoCacheSoundManager()

LegoCacheSoundManager::~LegoCacheSoundManager ( )

[AI] Destructor. Cleans up all cached sound entries in set and list, stops sounds and deletes sound objects. [AI]

Definition at line 10 of file legocachesoundmanager.cpp.

Member Function Documentation

◆ Destroy()

void LegoCacheSoundManager::Destroy ( LegoCacheSound *&  p_sound)

[AI] Destroys (deletes and removes) the specified sound object from all tracking.

[AI]

Parameters
p_soundReference to sound pointer to destroy. Removes, stops and deletes its memory. [AI]

Definition at line 173 of file legocachesoundmanager.cpp.

◆ FindSoundByKey()

LegoCacheSound * LegoCacheSoundManager::FindSoundByKey ( const char *  p_key)

[AI] Attempts to find and return a cached sound by its key (case-insensitive).

If not present, returns NULL. [AI]

Parameters
p_keyName/key for the sound. [AI]
Returns
Pointer to the matching LegoCacheSound or NULL. [AI]

Definition at line 65 of file legocachesoundmanager.cpp.

◆ ManageSoundEntry()

LegoCacheSound * LegoCacheSoundManager::ManageSoundEntry ( LegoCacheSound p_sound)

[AI] Manages a sound entry.

Adds new one or returns existing one (by internal cache). [AI]

[AI] If a sound with the same data already exists, the new one may be destroyed. [AI]

Parameters
p_soundThe sound object to manage. [AI]
Returns
A pointer to the managed sound (possibly input, possibly merged). [AI]

Definition at line 81 of file legocachesoundmanager.cpp.

◆ Play() [1/2]

LegoCacheSound * LegoCacheSoundManager::Play ( const char *  p_key,
const char *  p_name,
MxBool  p_looping 
)

[AI] Plays a sound identified by key, with the given playback name and looping flag.

Will play a managed or cloned version. [AI]

Parameters
p_keyKey identifying the sound to play. [AI]
p_nameName to use for playback. [AI]
p_loopingShould the sound play looped. [AI]
Returns
A pointer to the playing LegoCacheSound, or NULL if failed. [AI]

Definition at line 108 of file legocachesoundmanager.cpp.

◆ Play() [2/2]

LegoCacheSound * LegoCacheSoundManager::Play ( LegoCacheSound p_sound,
const char *  p_name,
MxBool  p_looping 
)

[AI] Plays a given sound object, with named playback and looping option.

Handles cloning if required. [AI]

Parameters
p_soundSound object to play. [AI]
p_namePlayback label/name used in the sound engine. [AI]
p_loopingShould the sound play looped. [AI]
Returns
Pointer to the sound object that plays, or NULL if failed. [AI]

Definition at line 115 of file legocachesoundmanager.cpp.

◆ Stop()

void LegoCacheSoundManager::Stop ( LegoCacheSound *&  p_sound)

[AI] Stops playback of the specified sound object.

[AI]

Parameters
p_soundReference to pointer of sound; only matches by pointer. [AI]

Definition at line 140 of file legocachesoundmanager.cpp.

◆ Tickle()

MxResult LegoCacheSoundManager::Tickle ( )
virtual

[AI] Advances or cleans up all managed sounds.

Invokes internal logic for cleanup and update of cached sounds. [AI]

Returns
SUCCESS after tickle. [AI]

Definition at line 31 of file legocachesoundmanager.cpp.


The documentation for this class was generated from the following files: