ScummVM API documentation
music.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 HOLLYWOOD_MONSTERS_MUSIC_H
23#define HOLLYWOOD_MONSTERS_MUSIC_H
24
25#include "common/language.h"
26#include "common/path.h"
27#include "hollywood/sound.h"
28
29namespace Hollywood {
30
32public:
35
36 void setArchive(const Common::Path &archiveName);
37 const Common::Path &archiveName() const { return _archiveName; }
38 bool playIntroMusic();
39 bool playMusicCue(uint16 cueId, byte volumePercent = 100, bool loop = false);
40 bool resumeLastCue();
41 void setVolume(byte volumePercent);
42 void stop();
43 bool isPlaying() const;
44
45private:
46 bool readCueSpan(const Common::Path &fileName, uint16 cueId, uint32 &start, uint32 &size) const;
47
48 SoundChannel _musicChannel;
49 Common::Path _archiveName;
50 uint16 _currentCueId;
51 byte _currentVolumePercent;
52 bool _currentLoop;
53 bool _hasCurrentCue;
54};
55
56// RESOURCE.004 keeps one cue-table layout but changes PCM encoding by release.
58public:
59 SpeechPlayer(Common::Language language, bool enabled = true);
61
62 bool playSample(uint16 sampleId, byte volumePercent = 100, bool loop = false,
63 const Common::Point *position = nullptr, int listenerX = 0);
64 bool playSampleAt(uint16 sampleId, int worldX, int viewportX = 0, byte volumePercent = 100);
65 void setViewportPosition(int viewportX);
66 void setVolume(byte volumePercent);
67 void stop();
68 bool isPlaying() const;
69 uint32 lastSampleDurationMillis() const { return _lastSampleDurationMillis; }
70
71private:
72 bool readSampleSpan(uint16 sampleId, uint32 &start, uint32 &size) const;
73
74 SoundChannel _speechChannel;
75 int _sampleRate;
76 byte _rawFlags;
77 byte _bytesPerSample;
78 uint32 _lastSampleDurationMillis;
79 bool _enabled;
80};
81
83public:
86
87 void setArchive(const Common::Path &archiveName);
88 const Common::Path &archiveName() const { return _archiveName; }
89 bool playSample(uint16 sampleId, byte volumePercent = 100, bool loop = false);
90 bool playSampleLooping(uint16 sampleId, byte volumePercent = 100);
91 void setVolume(byte volumePercent);
92 void stop();
93 bool isPlaying() const;
94
95private:
96 bool readSampleSpan(uint16 sampleId, uint32 &start, uint32 &size) const;
97
98 SoundChannel _soundChannel;
99 Common::Path _archiveName;
100};
101
102// Plays the small one-based PCM effects embedded in RESOURCE.000, separately
103// from the streamed RESOURCE.Sxx cue banks.
105public:
106 ResidentSoundEffectPlayer(bool useSpanishDemoLayout = false);
108
109 bool playSample(byte soundEffectId, byte volumePercent = 100,
110 const Common::Point *position = nullptr, int listenerX = 0);
111 bool playSampleAt(byte soundEffectId, int worldX, int viewportX = 0, byte volumePercent = 100);
112 void setViewportPosition(int viewportX);
113 void stop();
114
115private:
116 enum {
117 kSoundEffectCount = 16
118 };
119
120 bool readSampleSpan(byte soundEffectId, uint32 &start, uint32 &size) const;
121 void stopSample(byte soundEffectId);
122
123 const byte *_resourceEntries;
124 SoundChannel _soundChannels[kSoundEffectCount];
125};
126
127} // End of namespace Hollywood
128
129#endif // HOLLYWOOD_MONSTERS_MUSIC_H
Definition: path.h:52
Definition: music.h:31
Definition: music.h:82
Definition: sound.h:32
Definition: music.h:57
Language
Definition: language.h:45
Definition: rect.h:144