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

SoundAgent Class Reference

Inheritance diagram for SoundAgent:

Inheritance graph
[legend]
Collaboration diagram for SoundAgent:

Collaboration graph
[legend]

Detailed Description

Sound and music interface.

Definition at line 18 of file SoundAgent.h.

Public Member Functions

virtual int playSound (Mix_Chunk *sound, int volume, int loops=0)=0
virtual void playMusic (const Path &file, BaseMsg *finished)=0
virtual void stopMusic ()=0
void receiveString (const StringMsg *msg)
 Handle incoming message.

Protected Member Functions

void own_init ()
 Set sound and music volume.
virtual void setSoundVolume (int volume)=0
virtual void setMusicVolume (int volume)=0


Member Function Documentation

void SoundAgent::own_init  )  [protected, virtual]
 

Set sound and music volume.

Reimplemented from BaseAgent.

Reimplemented in SDLSoundAgent.

Definition at line 20 of file SoundAgent.cpp.

00021 {
00022     OptionAgent *options = OptionAgent::agent();
00023     options->setDefault("volume_sound", 90);
00024     options->setDefault("volume_music", 50);
00025     setSoundVolume(options->getAsInt("volume_sound"));
00026     setMusicVolume(options->getAsInt("volume_music"));
00027 
00028     registerWatcher("volume_sound");
00029     registerWatcher("volume_music");
00030 }

virtual void SoundAgent::playMusic const Path file,
BaseMsg finished
[pure virtual]
 

Implemented in DummySoundAgent, and SDLSoundAgent.

virtual int SoundAgent::playSound Mix_Chunk *  sound,
int  volume,
int  loops = 0
[pure virtual]
 

Implemented in DummySoundAgent, and SDLSoundAgent.

void SoundAgent::receiveString const StringMsg msg  )  [virtual]
 

Handle incoming message.

Messages:

  • param_changed(volume_sound) ... set sound volume
  • param_changed(volume_music) ... set music volume

Exceptions:
UnknownMsgException 

Reimplemented from BaseListener.

Definition at line 41 of file SoundAgent.cpp.

00042 {
00043     if (msg->equalsName("param_changed")) {
00044         std::string param = msg->getValue();
00045         if ("volume_sound" == param) {
00046             int volume = OptionAgent::agent()->getAsInt("volume_sound");
00047             setSoundVolume(volume);
00048         }
00049         else if ("volume_music" == param) {
00050             int volume = OptionAgent::agent()->getAsInt("volume_music");
00051             setMusicVolume(volume);
00052         }
00053     }
00054     else {
00055         throw UnknownMsgException(msg);
00056     }
00057 }

virtual void SoundAgent::setMusicVolume int  volume  )  [protected, pure virtual]
 

Implemented in DummySoundAgent, and SDLSoundAgent.

virtual void SoundAgent::setSoundVolume int  volume  )  [protected, pure virtual]
 

Implemented in DummySoundAgent, and SDLSoundAgent.

virtual void SoundAgent::stopMusic  )  [pure virtual]
 

Implemented in DummySoundAgent, and SDLSoundAgent.


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