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 DARKSEED_SOUND_H
23 #define DARKSEED_SOUND_H
24 
25 #include "darkseed/music.h"
26 
27 #include "audio/mixer.h"
28 #include "common/array.h"
29 #include "common/error.h"
30 #include "common/serializer.h"
31 
32 namespace Darkseed {
33 enum class MusicId : uint8 {
34  kNone = 0,
35  kLab,
36  kVictory,
37  kCemetry,
38  kLeech,
39  kExt,
40  kQuiet,
41  kPackage,
42  kDth,
43  kLibrary,
44  kRadio,
45  kOutdoor,
46  kTown,
47 };
48 
49 enum class StartMusicId : uint8 {
50  kCredits = 0,
51  kAlien,
52  kImplant,
53  kLaunch,
54  kNight2,
55  kNight3,
56  kBook,
57  kDoll
58 };
59 
60 class Sound {
61  Audio::Mixer *_mixer;
62  Audio::SoundHandle _speechHandle;
63  Audio::SoundHandle _sfxHandle;
64  MusicPlayer *_musicPlayer;
65  Common::Array<uint8> _didSpeech;
66  bool _useFloppyMusic;
67 
68 public:
69  explicit Sound(Audio::Mixer *mixer);
70  ~Sound();
71 
72  int init();
73 
75 
76  bool isMuted() const;
77  void playTosSpeech(int tosIdx);
78  void stopSpeech();
79  bool isPlayingSpeech() const;
80  bool isPlayingSfx() const;
81  bool isPlayingMusic();
82  void resetSpeech();
83  void playMusic(MusicId musicId, bool loop = true);
84  void playMusic(StartMusicId musicId);
85  void playMusic(Common::String const &filename, Common::String const *instrBankFilename = nullptr, uint8 priority = 0xFF, bool loop = false);
86  void stopMusic();
87  void pauseMusic(bool pause);
88  void playSfx(uint8 sfxId, int unk1, int unk2);
89  void stopSfx();
90  void syncSoundSettings();
91  void killAllSound();
92  void startFadeOut();
93  bool isFading();
94 
95 private:
96  void playDosCDSfx(int sfxId);
97  void playFloppySpeech(int tosIdx);
98 };
99 
100 } // namespace Darkseed
101 
102 #endif // DARKSEED_SOUND_H
Definition: music.h:36
Definition: str.h:59
Definition: error.h:84
Definition: serializer.h:79
Definition: mixer.h:49
Definition: mixer.h:59
Definition: adlib_dsf.h:27
Definition: sound.h:60