ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 GOT_SOUND_H
23 #define GOT_SOUND_H
24 
25 #include "got/musicdriver.h"
26 #include "got/musicparser.h"
27 #include "got/data/defines.h"
28 #include "got/gfx/gfx_chunks.h"
29 
30 #include "audio/mixer.h"
31 
32 namespace Got {
33 
34 enum {
35  OW,
36  GULP,
37  SWISH,
38  YAH,
39  ELECTRIC,
40  THUNDER,
41  DOOR,
42  FALL,
43  ANGEL,
44  WOOP,
45  DEAD,
46  BRAAPP,
47  WIND,
48  PUNCH1,
49  CLANG,
50  EXPLODE,
51  BOSS11,
52  BOSS12,
53  BOSS13
54 };
55 
56 #define NUM_SOUNDS 19
57 
58 class Sound {
59 private:
60  static const uint8 MUSIC_TIMER_FREQUENCY_GAME = 120;
61  static const uint8 MUSIC_TIMER_FREQUENCY_TITLE = 140;
62 
63  byte *_soundData = nullptr;
64  byte *_bossSounds[3];
65  Header _digiSounds[NUM_SOUNDS];
66  Audio::SoundHandle _soundHandle;
67  byte _currentPriority = 0;
68  int8 _currentBossLoaded = 0;
69 
70  const char *_currentMusic = nullptr;
71  byte *_musicData = nullptr;
72  MusicDriver_Got *_musicDriver = nullptr;
73  MusicParser_Got *_musicParser = nullptr;
74 
75  const char *getMusicName(int num) const;
76 
77 public:
78  Sound();
79  ~Sound();
80 
81  void load();
82  void setupBoss(int num);
83 
84  void playSound(int index, bool override);
85  void playSound(const Gfx::GraphicChunk &src);
86  bool soundPlaying() const;
87 
88  void musicPlay(const int num, const bool override) {
89  musicPlay(getMusicName(num), override);
90  }
91  void musicPlay(const char *name, bool override);
92  void musicPause();
93  void musicResume();
94  void musicStop();
95  bool musicIsOn() const;
96 
97  void syncSoundSettings();
98 };
99 
100 extern void playSound(int index, bool override);
101 extern void playSound(const Gfx::GraphicChunk &src);
102 extern bool soundPlaying();
103 extern void musicPlay(int num, bool override);
104 extern void musicPlay(const char *name, bool override);
105 extern void musicPause();
106 extern void musicResume();
107 extern void setupBoss(int num);
108 
109 } // namespace Got
110 
111 #endif
Definition: defines.h:31
Definition: musicdriver.h:29
Definition: mixer.h:49
Definition: sound.h:58
Definition: musicparser.h:31
Definition: gfx_chunks.h:38
Definition: console.h:28