Planeshift
Public Member Functions

SoundData Class Reference

SoundData is the datakeeper of. More...

#include <data.h>

List of all members.

Public Member Functions

bool Initialize (iObjectRegistry *objectReg)
 Initializes Loader and VFS.
bool LoadSoundFile (const char *name, csRef< iSndSysData > &snddata)
 Loads a soundfile out of the vfs.
bool LoadSoundLib (const char *filename, iObjectRegistry *objectReg)
 Reads soundlib.xml and creates reference SoundFile objects.
 SoundData ()
 Constructor .
void UnloadSoundFile (const char *name)
 Unloads a soundfile and deletes its snddata object.
void UnloadSoundLib ()
 Unloads everything LoadSoundLib created.
void Update ()
 Checks usage of all SoundFile objects and unloads them if appropriate.
 ~SoundData ()
 Deconstructor.

Detailed Description

SoundData is the datakeeper of.

See also:
SoundSystemManager. It loads and unloads all Soundfiles and provides a simple caching mechanism.

Definition at line 141 of file data.h.


Constructor & Destructor Documentation

SoundData::SoundData ( )

Constructor .

. empty. Initialization is done via Initialize because its not guaranteed that its successful.

SoundData::~SoundData ( )

Deconstructor.

Unloads everything and destroys all SoundFile object.


Member Function Documentation

bool SoundData::Initialize ( iObjectRegistry *  objectReg)

Initializes Loader and VFS.

Will return true on success and false if not.

Parameters:
objectRegobjectReg to get references to iVFS and iSndSysLoader
bool SoundData::LoadSoundFile ( const char *  name,
csRef< iSndSysData > &  snddata 
)

Loads a soundfile out of the vfs.

The file given by name will be loaded into a iSndSysData object.

Parameters:
namefilename to load
snddataiSndSysData object to write the data into
bool SoundData::LoadSoundLib ( const char *  filename,
iObjectRegistry *  objectReg 
)

Reads soundlib.xml and creates reference SoundFile objects.

It fills the private hash with unloaded SoundFile objects. Those will be copied and loaded if needed

Parameters:
filenamefilename to load
objectRegps objectreg because we need iDocumentSystem
void SoundData::UnloadSoundFile ( const char *  name)

Unloads a soundfile and deletes its snddata object.

The Soundfile given by name will be unloaded. Be careful with this one! It doesnt check if its still in use.

Parameters:
nameSoundFile by name
void SoundData::UnloadSoundLib ( )

Unloads everything LoadSoundLib created.

Will purge the hash and delete all reference SoundFile objects.

void SoundData::Update ( )

Checks usage of all SoundFile objects and unloads them if appropriate.

Each SoundFile has a Timestamp and a Refcount that help to determine if it can be freed. Unload happens if its Cachetime is expired if its RefCount is 1. RefCount 1 means were the one that holds it.


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