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 
30 namespace Common {
31 class File;
32 }
33 
34 namespace AGOS {
35 
36 class BaseSound;
37 
38 class AGOSEngine;
39 
40 class Sound {
41 private:
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 
62  // Personal Nightmare specfic
63  byte *_soundQueuePtr;
64  uint16 _soundQueueNum;
65  uint32 _soundQueueSize;
66  uint16 _soundQueueFreq;
67 public:
68  Sound(AGOSEngine *vm, const GameSpecificSettings *gss, Audio::Mixer *mixer);
69  ~Sound();
70 
71  enum TypeFlags {
72  TYPE_AMBIENT = 1 << 0,
73  TYPE_SFX = 1 << 1,
74  TYPE_SFX5 = 1 << 2
75  };
76 
77 protected:
78  void loadVoiceFile(const GameSpecificSettings *gss);
79  void loadSfxFile(const GameSpecificSettings *gss);
80 
81 public:
82  void readSfxFile(const Common::Path &filename);
83  void loadSfxTable(const char *gameFilename, uint32 base);
84  void readVoiceFile(const Common::Path &filename);
85 
86  void playVoice(uint sound);
87  void playEffects(uint sound);
88  void playAmbient(uint sound);
89 
90  // Personal Nightmare specfic
91  void handleSoundQueue();
92  void queueSound(byte *ptr, uint16 sound, uint32 size, uint16 freq);
93 
94  // Elvira 1/2 and Waxworks specific
95  void playRawData(byte *soundData, uint sound, uint size, uint freq);
96 
97  // Feeble Files specific
98  void playAmbientData(byte *soundData, uint sound, uint pan, uint vol);
99  void playSfxData(byte *soundData, uint sound, uint pan, uint vol);
100  void playSfx5Data(byte *soundData, uint sound, uint pan, uint vol);
101  void playSoundData(Audio::SoundHandle *handle, byte *soundData, uint sound, int pan = 0, int vol = 0, bool loop = false);
102  void playVoiceData(byte *soundData, uint sound);
103  void switchVoiceFile(const GameSpecificSettings *gss, uint disc);
104 
105  bool hasVoice() const;
106  bool isSfxActive() const;
107  bool isVoiceActive() const;
108  void stopAllSfx();
109  void stopSfx();
110  void stopSfx5();
111  void stopVoice();
112  void stopAll();
113  void effectsMute(bool mute, uint16 effectsVolume);
114  void ambientMute(bool mute, uint16 effectsVolume);
115 };
116 
117 } // End of namespace AGOS
118 
119 #endif
Definition: sound.h:40
Definition: path.h:52
Definition: agos.h:200
Definition: mixer.h:49
Definition: mixer.h:59
Definition: agos.h:63
Definition: algorithm.h:29
Definition: intern.h:196