34 #ifndef SWORD2_SOUND_H 35 #define SWORD2_SOUND_H 37 #include "common/file.h" 38 #include "common/mutex.h" 39 #include "audio/audiostream.h" 40 #include "audio/mixer.h" 48 #define BUFFER_SIZE 4096 78 RDSE_SAMPLEFINISHED = 0,
79 RDSE_SAMPLEPLAYING = 1,
96 int16 _outbuf[BUFFER_SIZE];
97 byte _inbuf[BUFFER_SIZE];
98 const int16 *_bufferEnd;
105 inline bool eosIntern()
const {
106 return !_file->
isOpen() || _pos >= _bufferEnd;
113 int readBuffer(int16 *buffer,
const int numSamples)
override;
117 int getRate()
const override {
return 22050; }
135 int16 _buffer[BUFFER_SIZE];
136 const int16 *_bufferEnd;
147 inline bool eosIntern()
const {
150 return _remove || _pos >= _bufferEnd;
157 int readBuffer(int16 *buffer,
const int numSamples)
override;
163 int getCD() {
return _cd; }
168 bool isReady() {
return _decoder !=
nullptr; }
169 int32 isFading() {
return _fading; }
171 bool readyToRemove();
172 int32 getTimeRemaining();
185 struct FxQueueEntry {
196 FxQueueEntry _fxQueue[FXQ_LENGTH];
198 void triggerFx(uint8 i);
210 int32 _loopingMusicId;
227 int readBuffer(int16 *buffer,
const int numSamples)
override;
230 int getRate()
const override {
return Sword2Engine::isPsx() ? 11025 : 22050; }
234 void clearFxQueue(
bool killMovieSounds);
235 void processFxQueue();
237 void setReverseStereo(
bool reverse);
238 bool isReverseStereo()
const {
return _reverseStereo; }
240 void muteSpeech(
bool mute);
241 bool isSpeechMute()
const {
return _speechMuted; }
243 void muteFx(
bool mute);
244 bool isFxMute()
const {
return _fxMuted; }
246 void muteMusic(
bool mute) { _musicMuted = mute; }
247 bool isMusicMute()
const {
return _musicMuted; }
249 void setLoopingMusicId(int32
id) { _loopingMusicId = id; }
250 int32 getLoopingMusicId()
const {
return _loopingMusicId; }
253 void unpauseSpeech();
261 void playMovieSound(int32 res,
int type);
262 void stopMovieSounds();
264 void queueFx(int32 res, int32 type, int32 delay, int32 volume, int32 pan);
265 int32 playFx(FxQueueEntry *fx);
267 int32 stopFx(int32 i);
268 int32 setFxIdVolumePan(int32
id,
int vol,
int pan = 255);
270 int32 getSpeechStatus();
272 int32 playCompSpeech(uint32 speechId, uint8 vol, int8 pan);
275 int32 streamCompMusic(uint32 musicId,
bool loop);
276 void stopMusic(
bool immediately);
277 int32 musicTimeRemaining();
Definition: animation.h:37
virtual int getRate() const =0
virtual bool isStereo() const =0
int getRate() const override
Definition: sound.h:230
SoundType
Definition: mixer.h:62
Definition: audiostream.h:50
bool isStereo() const override
Definition: sound.h:228