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 "audio/audiostream.h"
26 #include "audio/mixer.h"
27 #include "common/str.h"
28 
29 namespace Ultima {
30 namespace Ultima4 {
31 
32 enum Sound {
33  SOUND_TITLE_FADE, // the intro title fade
34  SOUND_WALK_NORMAL, // walk, world and town
35  SOUND_WALK_SLOWED, // walk, slow progress
36  SOUND_WALK_COMBAT, // walk, combat
37  SOUND_BLOCKED, // location blocked
38  SOUND_ERROR, // error/bad command
39  SOUND_PC_ATTACK, // PC attacks
40  SOUND_PC_STRUCK, // PC damaged
41  SOUND_NPC_ATTACK, // NPC attacks
42  SOUND_NPC_STRUCK, // NPC damaged
43  SOUND_ACID, // effect, acid damage
44  SOUND_SLEEP, // effect, sleep
45  SOUND_POISON_EFFECT, // effect, poison
46  SOUND_POISON_DAMAGE, // damage, poison
47  SOUND_EVADE, // trap evaded
48  SOUND_FLEE, // flee combat
49  SOUND_ITEM_STOLEN, // item was stolen from a PC, food or gold
50  SOUND_LBHEAL, // LB heals party
51  SOUND_LEVELUP, // PC level up
52  SOUND_MOONGATE, // moongate used
53 
54  SOUND_CANNON,
55  SOUND_RUMBLE,
56  SOUND_PREMAGIC_MANA_JUMBLE,
57  SOUND_MAGIC,
58  SOUND_WHIRLPOOL,
59  SOUND_STORM,
60 
61  // SOUND_MISSED,
62  // SOUND_CREATUREATTACK,
63  // SOUND_PLAYERHIT,
64  SOUND_MAX
65 };
66 
67 void soundPlay(Sound sound, bool onlyOnce = true, int specificDurationInTicks = -1);
68 
69 void soundStop(int channel = 1);
70 
71 class SoundManager {
72 private:
73  Audio::Mixer *_mixer;
74  Audio::SoundHandle _soundHandle;
75  Common::Array<Common::Path> _soundFilenames;
77 private:
78  bool load(Sound sound);
79 
80  void play_sys(Sound sound, bool onlyOnce, int specificDurationMilli);
81  bool load_sys(Sound sound, const Common::Path &filename);
82  void stop_sys(int channel);
83 public:
84  SoundManager(Audio::Mixer *mixer);
85  ~SoundManager();
86 
87  void play(Sound sound, bool onlyOnce = true, int specificDurationInTicks = -1);
88  void stop(int channel = 1);
89 };
90 
91 extern SoundManager *g_sound;
92 
93 } // End of namespace Ultima4
94 } // End of namespace Ultima
95 
96 #endif
Definition: path.h:52
Definition: sound.h:71
Definition: detection.h:27
Definition: mixer.h:49
Definition: mixer.h:70