

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 |
|
|
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 }
|
|
||||||||||||
|
Implemented in DummySoundAgent, and SDLSoundAgent. |
|
||||||||||||||||
|
Implemented in DummySoundAgent, and SDLSoundAgent. |
|
|
Handle incoming message. Messages:
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 }
|
|
|
Implemented in DummySoundAgent, and SDLSoundAgent. |
|
|
Implemented in DummySoundAgent, and SDLSoundAgent. |
|
|
Implemented in DummySoundAgent, and SDLSoundAgent. |
1.4.2