Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

ResSoundPack Class Reference

Inheritance diagram for ResSoundPack:

Inheritance graph
[legend]
Collaboration diagram for ResSoundPack:

Collaboration graph
[legend]

Detailed Description

Sound resources.

Definition at line 13 of file ResSoundPack.h.

Public Member Functions

virtual const char * getName () const
void addSound (const std::string &name, const Path &file)
 Store sound under this name.

Static Public Member Functions

static Mix_Chunk * loadSound (const Path &file)
 Load unshared sound from file.

Protected Member Functions

virtual void unloadRes (Mix_Chunk *res)


Member Function Documentation

void ResSoundPack::addSound const std::string &  name,
const Path file
 

Store sound under this name.

Nothing is stored when sound cannot be loaded.

Definition at line 46 of file ResSoundPack.cpp.

00047 {
00048     Mix_Chunk *chunk = loadSound(file);
00049     if (chunk) {
00050         addRes(name, chunk);
00051     }
00052 }

virtual const char* ResSoundPack::getName  )  const [inline, virtual]
 

Implements INamed.

Definition at line 17 of file ResSoundPack.h.

00017 { return "sound_pack"; }

Mix_Chunk * ResSoundPack::loadSound const Path file  )  [static]
 

Load unshared sound from file.

Returns:
sound or NULL

Definition at line 26 of file ResSoundPack.cpp.

00027 {
00028     Mix_Chunk *chunk = NULL;
00029     //TODO: ask SoundAgent to load this sound
00030     if (OptionAgent::agent()->getAsBool("sound", true)) {
00031         chunk = Mix_LoadWAV(file.getNative().c_str());
00032         if (NULL == chunk) {
00033             LOG_WARNING(ExInfo("cannot load sound")
00034                 .addInfo("path", file.getNative())
00035                 .addInfo("MixError", Mix_GetError()));
00036         }
00037     }
00038     return chunk;
00039 }

void ResSoundPack::unloadRes Mix_Chunk *  res  )  [protected, virtual]
 

Implements ResourcePack< Mix_Chunk * >.

Definition at line 16 of file ResSoundPack.cpp.

00017 {
00018     Mix_FreeChunk(res);
00019 }


The documentation for this class was generated from the following files:
Generated on Wed Jun 1 09:56:29 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2