22 #ifndef NEVERHOOD_SOUND_H 23 #define NEVERHOOD_SOUND_H 25 #include "audio/audiostream.h" 26 #include "common/array.h" 27 #include "neverhood/resourceman.h" 30 class SeekableReadStream;
39 class NeverhoodEngine;
40 class AudioResourceManSoundItem;
41 class AudioResourceManMusicItem;
48 void load(uint32 fileHash);
50 void play(uint32 fileHash);
54 void setVolume(int16 volume);
55 void setPan(int16 pan);
66 void load(uint32 fileHash);
68 void play(int16 fadeVolumeStep);
69 void stop(int16 fadeVolumeStep);
70 void setVolume(int16 volume);
81 void startMusic(int16 countdown, int16 fadeVolumeStep);
82 void stopMusic(int16 countdown, int16 fadeVolumeStep);
84 uint32 getGroupNameHash()
const {
return _groupNameHash; }
85 uint32 getFileHash()
const {
return _fileHash; }
88 uint32 _groupNameHash;
92 int16 _fadeVolumeStep;
100 bool playOnceAfterRandomCountdown, int16 minCountdown, int16 maxCountdown,
101 bool playOnceAfterCountdown, int16 initialCountdown,
bool playLooping, int16 currCountdown);
103 void setSoundParams(
bool playOnceAfterRandomCountdown, int16 minCountdown, int16 maxCountdown,
104 int16 firstMinCountdown, int16 firstMaxCountdown);
105 void playSoundLooping();
107 void setVolume(
int volume);
109 void setPlayOnceAfterCountdown(
bool playOnceAfterCountdown) { _playOnceAfterCountdown = playOnceAfterCountdown; }
110 uint32 getGroupNameHash()
const {
return _groupNameHash; }
111 uint32 getFileHash()
const {
return _fileHash; }
112 int16 getCurrCountdown()
const {
return _currCountdown; }
115 uint32 _groupNameHash;
117 bool _playOnceAfterRandomCountdown;
120 bool _playOnceAfterCountdown;
121 int16 _initialCountdown;
123 int16 _currCountdown;
133 void stopAllSounds();
136 void addMusic(uint32 groupNameHash, uint32 musicFileHash);
137 void deleteMusic(uint32 musicFileHash);
138 void startMusic(uint32 musicFileHash, int16 countdown, int16 fadeVolumeStep);
139 void stopMusic(uint32 musicFileHash, int16 countdown, int16 fadeVolumeStep);
142 void addSound(uint32 groupNameHash, uint32 soundFileHash);
143 void addSoundList(uint32 groupNameHash,
const uint32 *soundFileHashList);
144 void deleteSound(uint32 soundFileHash);
145 void setSoundParams(uint32 soundFileHash,
bool playOnceAfterRandomCountdown,
146 int16 minCountdown, int16 maxCountdown, int16 firstMinCountdown, int16 firstMaxCountdown);
147 void setSoundListParams(
const uint32 *soundFileHashList,
bool playOnceAfterRandomCountdown,
148 int16 minCountdown, int16 maxCountdown, int16 firstMinCountdown, int16 firstMaxCountdown);
149 void playSoundLooping(uint32 soundFileHash);
150 void stopSound(uint32 soundFileHash);
151 void setSoundVolume(uint32 soundFileHash,
int volume);
155 void deleteGroup(uint32 groupNameHash);
156 void deleteMusicGroup(uint32 groupNameHash);
157 void deleteSoundGroup(uint32 groupNameHash);
158 void playTwoSounds(uint32 groupNameHash, uint32 soundFileHash1, uint32 soundFileHash2, int16 initialCountdown);
159 void playSoundThree(uint32 groupNameHash, uint32 soundFileHash);
160 void setTwoSoundsPlayFlag(
bool playOnceAfterCountdown);
161 void setSoundThreePlayFlag(
bool playOnceAfterCountdown);
167 int _soundIndex1, _soundIndex2;
168 int16 _initialCountdown;
169 bool _playOnceAfterCountdown;
172 int16 _initialCountdown3;
173 bool _playOnceAfterCountdown3;
178 MusicItem *getMusicItemByHash(uint32 musicFileHash);
179 SoundItem *getSoundItemByHash(uint32 soundFileHash);
180 int16 addMusicItem(
MusicItem *musicItem);
181 int16 addSoundItem(
SoundItem *soundItem);
182 void deleteSoundByIndex(
int index);
190 int readBuffer(int16 *buffer,
const int numSamples)
override;
191 bool isStereo()
const override {
return _isStereo; }
193 int getRate()
const override {
return _rate; }
196 const bool _isLooping;
197 const bool _isStereo;
198 const byte _shiftValue;
199 const bool _isCompressed;
205 kSampleBufferLength = 2048
207 int fillBuffer(
int maxSamples);
218 void setVolume(int16 volume);
219 void setPan(int16 pan);
220 void playSound(
bool looping);
239 void playMusic(int16 fadeVolumeStep);
240 void stopMusic(int16 fadeVolumeStep);
242 void setVolume(int16 volume);
245 bool isPlaying()
const {
return _isPlaying; }
246 bool canRestart()
const {
return _canRestart; }
247 bool isTerminated()
const {
return _terminate; }
248 uint32 getFileHash()
const {
return _fileHash; }
261 int16 _fadeVolumeStep;
271 void stopAllSounds();
273 int16 addSound(uint32 fileHash);
274 void removeSound(int16 soundIndex);
276 int16 loadMusic(uint32 fileHash);
Definition: background.h:30
Definition: resourceman.h:64
Definition: neverhood.h:60
bool endOfData() const override
Definition: sound.h:192
Definition: algorithm.h:29
Definition: audiostream.h:50
int getRate() const override
Definition: sound.h:193
bool isStereo() const override
Definition: sound.h:191