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 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
32namespace Darkseed {
33enum 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
49enum class StartMusicId : uint8 {
50 kCredits = 0,
51 kAlien,
52 kImplant,
53 kLaunch,
54 kNight2,
55 kNight3,
56 kBook,
57 kDoll
58};
59
60class Sound {
61 // Floppy speech filenames from TOS1.DIG
62 char _sfxFloppyDigFilenameTbl[120][14];
63
64 Audio::Mixer *_mixer;
65 Audio::SoundHandle _speechHandle;
66 Audio::SoundHandle _sfxHandle;
67 MusicPlayer *_musicPlayer;
68 Common::Array<uint8> _didSpeech;
69 bool _useFloppyMusic;
70 bool _useCdSfx;
71 bool _useFloppySfx;
72 uint8 _lastPlayedDigitalSfx;
73
74public:
75 explicit Sound(Audio::Mixer *mixer);
76 ~Sound();
77
78 int init();
79
81
82 bool isMuted() const;
83 void playTosSpeech(int tosIdx);
84 void stopSpeech();
85 bool isPlayingSpeech() const;
86 bool isPlayingSfx() const;
87 bool isPlayingSfx(uint8 sfxId) const;
88 bool isPlayingMusic();
89 void resetSpeech();
90 void resetIndividualSpeech(int tosIdx);
91 void playMusic(MusicId musicId, bool loop = true);
92 void playMusic(StartMusicId musicId);
93 void playMusic(Common::String const &filename, Common::String const *instrBankFilename = nullptr, uint8 priority = 0xFF, bool loop = false);
94 void stopMusic();
95 void pauseMusic(bool pause);
96 void playSfx(uint8 sfxId, uint8 priority, int unk2);
97 void playDosFloppySfx(byte sfxId, uint8 priority);
98 void stopSfx();
99 bool isUsingCdSfx() const;
100 bool isUsingFloppySfx() const;
101 void syncSoundSettings();
102 void killAllSound();
103 void startFadeOut();
104 bool isFading();
105
106private:
107 void loadTosDigData(Common::SeekableReadStream *in, int32 size);
108 void playDosCDSfx(int sfxId);
109 void playFloppySpeech(int tosIdx);
110 int convertCdSpeechToFloppySfxId(int cdSfxId);
111};
112
113} // namespace Darkseed
114
115#endif // DARKSEED_SOUND_H
Definition: mixer.h:70
Definition: mixer.h:49
Definition: error.h:81
Definition: stream.h:745
Definition: serializer.h:80
Definition: str.h:59
Definition: music.h:37
Definition: sound.h:60