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 AGOS_SOUND_H
23#define AGOS_SOUND_H
24
25#include "audio/audiostream.h"
26#include "audio/mixer.h"
27#include "agos/intern.h"
28#include "common/str.h"
29
30namespace Common {
31class File;
32}
33
34namespace AGOS {
35
36class BaseSound;
37
38class AGOSEngine;
39
40class Sound {
41private:
42 AGOSEngine *_vm;
43
44 Audio::Mixer *_mixer;
45
46 BaseSound *_voice;
47 BaseSound *_effects;
48
49 uint16 *_filenums;
50 uint32 *_offsets;
51 uint16 _lastVoiceFile;
52
53 Audio::SoundHandle _voiceHandle;
54 Audio::SoundHandle _effectsHandle;
55 Audio::SoundHandle _ambientHandle;
56 Audio::SoundHandle _sfx5Handle;
57
58 bool _hasEffectsFile;
59 bool _hasVoiceFile;
60 uint16 _ambientPlaying;
61 uint _voicePlaying;
62
63 // Personal Nightmare specific
64 byte *_soundQueuePtr;
65 uint16 _soundQueueNum;
66 uint32 _soundQueueSize;
67 uint16 _soundQueueFreq;
68public:
69 Sound(AGOSEngine *vm, const GameSpecificSettings *gss, Audio::Mixer *mixer);
70 ~Sound();
71
72 enum TypeFlags {
73 TYPE_AMBIENT = 1 << 0,
74 TYPE_SFX = 1 << 1,
75 TYPE_SFX5 = 1 << 2
76 };
77
78protected:
79 void loadVoiceFile(const GameSpecificSettings *gss);
80 void loadSfxFile(const GameSpecificSettings *gss);
81
82public:
83 void readSfxFile(const Common::Path &filename);
84 void loadSfxTable(const char *gameFilename, uint32 base);
85 void readVoiceFile(const Common::Path &filename);
86
87 void playVoice(uint sound);
88 void playEffects(uint sound);
89 void playAmbient(uint sound);
90
91 // Personal Nightmare specific
92 void handleSoundQueue();
93 void queueSound(byte *ptr, uint16 sound, uint32 size, uint16 freq);
94
95 // Elvira 1/2 and Waxworks specific
96 void playRawData(byte *soundData, uint sound, uint size, uint freq);
97
98 // Feeble Files specific
99 void playAmbientData(byte *soundData, uint sound, uint pan, uint vol);
100 void playSfxData(byte *soundData, uint sound, uint pan, uint vol);
101 void playSfx5Data(byte *soundData, uint sound, uint pan, uint vol);
102 void playSoundData(Audio::SoundHandle *handle, byte *soundData, uint sound, int pan = 0, int vol = 0, bool loop = false);
103 void playVoiceData(byte *soundData, uint sound);
104 void switchVoiceFile(const GameSpecificSettings *gss, uint disc);
105
106 bool hasVoice() const;
107 bool isSfxActive() const;
108 bool isVoiceActive() const;
109 uint getCurrentVoice() const { return _voicePlaying; }
110 void stopAllSfx();
111 void stopSfx();
112 void stopSfx5();
113 void stopVoice();
114 void stopAll();
115 void effectsMute(bool mute, uint16 effectsVolume);
116 void ambientMute(bool mute, uint16 effectsVolume);
117};
118
119} // End of namespace AGOS
120
121#endif
Definition: agos.h:240
Definition: sound.h:40
Definition: mixer.h:70
Definition: mixer.h:49
Definition: path.h:52
Definition: algorithm.h:29
Definition: intern.h:200