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 LASTEXPRESS_SOUND_H
23#define LASTEXPRESS_SOUND_H
24
25#include "lastexpress/shared.h"
26
27#include "common/str.h"
28
29#include "audio/mixer.h"
30#include "audio/audiostream.h"
31
32namespace Audio {
33class AudioStream;
34class Mixer;
35class QueuingAudioStream;
36class SoundHandle;
37} // namespace Audio
38
39namespace LastExpress {
40
41class CVCRFile;
42class LastExpressEngine;
43class SoundQueue;
44class Slot;
45
47 friend class Slot;
48 friend class Logic;
49 friend class LogicManager;
50 friend class GraphicsManager;
51 friend class Menu;
52 friend class NISManager;
53 friend class LastExpressEngine;
54
55public:
58
59 void mix(Slot *slot, int16 *outBuf);
60 void mixEngine();
61 void mixChannels(int numChannels, int16 *buffer);
62
63 int playSoundFile(const char *sndName, int typeFlags, int character, int delay);
64 void startAmbient();
65 void startSteam(int cityIndex);
66 void endAmbient();
67 void killAmbient();
68 void raiseAmbient(int level, int delay);
69 void levelAmbient(int delay);
70 Slot *findSlotWho(int32 character);
71 Slot *findSlotName(char *name);
72 void ambientAI(int id);
73 void soundThread();
74 void killAllSlots();
75 void killAllExcept(int tag1, int tag2, int tag3, int tag4, int tag5, int tag6, int tag7);
76 void saveSoundInfo(CVCRFile *file);
77 void destroyAllSound();
78 void loadSoundInfo(CVCRFile *file, bool skipSoundLoading);
79 void addSlot(Slot *entry);
80 void removeSlot(Slot *entry);
81 void NISFadeOut();
82 void NISFadeIn();
83 int getMasterVolume();
84 void setMasterVolume(int volume);
85
86 // DRIVER
87 void soundDriverInit();
88 void soundDriverCopyBuffersToDevice();
89 int soundDriverGetVolume();
90 void soundDriverSetVolume(int volume);
91 int32 getSoundDriverTicks();
92 void setSoundDriverTicks(int32 value);
93 int32 getSoundDriver30HzCounter();
94 int32 getSoundDriverFlags();
95 void addSoundDriverFlags(int32 flags);
96 void removeSoundDriverFlags(int32 flags);
97 bool isCopyingDataToSoundDriver();
98
99private:
100 LastExpressEngine *_engine;
101 Audio::Mixer *_mixer;
102 Audio::SoundHandle _channelHandle;
104
105 int32 _sound30HzCounter = 0;
106 Slot *_soundCache = nullptr;
107 int32 _curSoundSlotTag = kSoundTagFirstNormal;
108 int32 _soundDriverFlags = kSoundDriverInitState;
109 Slot *_soundSlotChannels[6];
110 int32 _numActiveChannels = 0;
111 bool _scanAnySoundLoopingSection = false;
112 int32 _soundSlotAmbientFlag = 0;
113 int32 _soundAmbientFadeLevel = 0;
114 int32 _soundAmbientFadeTime = 0;
115 int32 _soundCacheCount = 0;
116 int32 _loopingSoundDuration = 0;
117 int32 _inSoundThreadFunction = 0;
118 bool _copyingDataToSoundDriver = false;
119 int16 _soundChannelsMixBuffers[6][1470];
120 int16 _soundMixBuffer[1470];
121 bool _soundEngineToggle = false;
122 int32 _soundDriverTicks = 0;
123 int32 _soundDriverVolume = 0;
124 uint32 _maxQueuedStreams = 0;
125
126 const char *_cities[17] = {
127 "EPERNAY",
128 "CHALONS",
129 "BARLEDUC",
130 "NANCY",
131 "LUNEVILL",
132 "AVRICOUR",
133 "DEUTSCHA",
134 "STRASBOU",
135 "BADENOOS",
136 "SALZBURG",
137 "ATTNANG",
138 "WELS",
139 "LINZ",
140 "VIENNA",
141 "POZSONY",
142 "GALANTA",
143 "POLICE"
144 };
145
146};
147
148} // End of namespace LastExpress
149
150#endif // LASTEXPRESS_SOUND_H
Definition: mixer.h:70
Definition: audiostream.h:370
Definition: mixer.h:49
Definition: cvcrfile.h:61
Definition: graphics.h:64
Definition: lastexpress.h:523
Definition: logic.h:51
Definition: menu.h:37
Definition: nis.h:43
Definition: slot.h:66
Definition: sound.h:46
Definition: system.h:39
Definition: archive.h:29