ScummVM API documentation
sound.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ULTIMA4_SOUND_H
23 #define ULTIMA4_SOUND_H
24 
25 #include "ultima/shared/std/containers.h"
26 #include "audio/audiostream.h"
27 #include "audio/mixer.h"
28 #include "common/str.h"
29 
30 namespace Ultima {
31 namespace Ultima4 {
32 
33 enum Sound {
34  SOUND_TITLE_FADE, // the intro title fade
35  SOUND_WALK_NORMAL, // walk, world and town
36  SOUND_WALK_SLOWED, // walk, slow progress
37  SOUND_WALK_COMBAT, // walk, combat
38  SOUND_BLOCKED, // location blocked
39  SOUND_ERROR, // error/bad command
40  SOUND_PC_ATTACK, // PC attacks
41  SOUND_PC_STRUCK, // PC damaged
42  SOUND_NPC_ATTACK, // NPC attacks
43  SOUND_NPC_STRUCK, // NPC damaged
44  SOUND_ACID, // effect, acid damage
45  SOUND_SLEEP, // effect, sleep
46  SOUND_POISON_EFFECT, // effect, poison
47  SOUND_POISON_DAMAGE, // damage, poison
48  SOUND_EVADE, // trap evaded
49  SOUND_FLEE, // flee combat
50  SOUND_ITEM_STOLEN, // item was stolen from a PC, food or gold
51  SOUND_LBHEAL, // LB heals party
52  SOUND_LEVELUP, // PC level up
53  SOUND_MOONGATE, // moongate used
54 
55  SOUND_CANNON,
56  SOUND_RUMBLE,
57  SOUND_PREMAGIC_MANA_JUMBLE,
58  SOUND_MAGIC,
59  SOUND_WHIRLPOOL,
60  SOUND_STORM,
61 
62  // SOUND_MISSED,
63  // SOUND_CREATUREATTACK,
64  // SOUND_PLAYERHIT,
65  SOUND_MAX
66 };
67 
68 void soundPlay(Sound sound, bool onlyOnce = true, int specificDurationInTicks = -1);
69 
70 void soundStop(int channel = 1);
71 
72 class SoundManager {
73 private:
74  Audio::Mixer *_mixer;
75  Audio::SoundHandle _soundHandle;
76  Std::vector<Common::Path> _soundFilenames;
78 private:
79  bool load(Sound sound);
80 
81  void play_sys(Sound sound, bool onlyOnce, int specificDurationMilli);
82  bool load_sys(Sound sound, const Common::Path &filename);
83  void stop_sys(int channel);
84 public:
85  SoundManager(Audio::Mixer *mixer);
86  ~SoundManager();
87 
88  void play(Sound sound, bool onlyOnce = true, int specificDurationInTicks = -1);
89  void stop(int channel = 1);
90 };
91 
92 extern SoundManager *g_sound;
93 
94 } // End of namespace Ultima4
95 } // End of namespace Ultima
96 
97 #endif
Definition: path.h:52
Definition: sound.h:72
Definition: detection.h:27
Definition: mixer.h:49
Definition: mixer.h:59