ScummVM API documentation
hmi_types.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 AUDIO_EFFECTS_HMI_TYPES_H
23 #define AUDIO_EFFECTS_HMI_TYPES_H
24 
25 #include "common/scummsys.h"
26 
27 namespace Audio {
28 
29 /* HMIPreset::flags */
30 #define HMI_PRESET_FLAG_UNKNOWN_28 0x10000000U
31 #define HMI_PRESET_FLAG_EFFECTS_INITIALIZED 0x20000000U
32 #define HMI_PRESET_FLAG_USE_MALLOC 0x80000000U
33 
34 /* HMIProcessRequest::flags */
35 #define HMI_PROCESS_USE_PRESET 0x00000001U
36 #define HMI_PROCESS_FIND_PRESET_BY_NAME 0x00000002U
37 #define HMI_PROCESS_ALLOCATE_OUTPUT 0x00000004U
38 #define HMI_PROCESS_OVERRIDE_INPUT_FORMAT 0x00000008U
39 #define HMI_PROCESS_OVERRIDE_OUTPUT_FORMAT 0x00000010U
40 #define HMI_PROCESS_LOOKUP_ONLY 0x00000020U
41 #define HMI_PROCESS_QUERY_OUTPUT_SIZE 0x00000040U
42 #define HMI_PROCESS_INCLUDE_TAIL 0x00000080U
43 #define HMI_PROCESS_DERIVE_OUTPUT_FORMAT 0x00000200U
44 #define HMI_PROCESS_DISABLE_CLAMPING 0x00000400U
45 
46 /* HMIEffectNode::channelMode */
47 #define HMI_EFFECT_CHANNEL_MONO 0x00000001U
48 #define HMI_EFFECT_CHANNEL_STEREO 0x00000002U
49 #define HMI_EFFECT_STEREO_ROUTING_MASK 0x0000000AU
50 
51 /* HMIFileDescriptor::fileFlags */
52 #define HMI_FILE_FLAG_DIRTY 0x00008000U
53 
54 class HMIInterface;
55 
56 struct HMIFormat;
57 struct HMIEffectNode;
58 struct HMIPreset;
59 
60 struct HMIFormat {
61  uint16 fmtBeginSection;
62  uint16 numChannels;
63  uint32 sampleRate;
64  uint32 byteRate;
65  uint16 blockAlign;
66  uint16 bitsPerSample;
67  uint16 fmtEndSection;
68 };
69 
70 struct HMIEffectNode {
71  uint32 flags;
72  int outputBus;
73  int sendChannel;
74  uint32 channelMode;
75  int outputBufSize;
76  HMIInterface *interface;
77  HMIEffectNode *next;
78 };
79 
80 #define HMI_EFFECT_NODE_HEADER \
81  uint32 flags; \
82  int outputBus; \
83  int sendChannel; \
84  uint32 channelMode; \
85  int outputBufSize; \
86  HMIInterface *interface; \
87  HMIEffectNode *next
88 
89 struct HMIPreset {
90  uint32 flags;
91  char name[64];
92  int chunkSizeInMs;
93  float *floatBufLeftActive;
94  float *floatBufRightActive;
95  float *floatBufLeftAlt;
96  float *floatBufRightAlt;
97  float *floatBufLeft0;
98  float *floatBufLeft1;
99  float *floatBufRight0;
100  float *floatBufRight1;
101  int pingPongIndex;
102  uint32 chunkSizeInSamples;
103  uint32 chunkSize;
104  int lockLevel;
105  int allocatedHeapSize;
106  HMIEffectNode *effectChain;
107  HMIFormat *outputFmt;
108  HMIFormat *inputFmt;
109  HMIPreset *next;
110 };
111 
112 struct HMIInitData {
113  int heapSize;
114  void *heapPtr;
115 };
116 
117 struct HMILibrary {
118  char description[64];
119  char authorName[64];
120  uint8 data[20];
121  HMIPreset *effectPtr;
122  HMIFormat inputFmt;
123  HMIFormat outputFmt;
124 };
125 
127  uint32 flags;
128  HMIPreset *presetPtr;
129  char *effectName;
130  uint8 *dstBuf;
131  uint32 dstLen;
132  uint8 *srcBuf;
133  uint32 srcLen;
134  HMIFormat *inputFmt;
135  HMIFormat *outputFmt;
136 };
137 
139  int fileFlags;
140  char filename[128];
141  uint8 *fileBuffer;
142  int fileSize;
143  int fileSizeExp;
144  uint8 *ptrToDescription;
145  int firstPresetPos;
146  uint8 *ptrToFirstPresetSection;
147  uint8 *ptrToFirstEffectSection;
148  uint8 *ptrToEffectParams;
149  uint8 *currentPos;
150  uint8 *anotherPtrToDescription;
151 };
152 
154  HMI_EFFECT_NODE_HEADER;
155  int filterType;
156  float cutoffFrequency;
157  float centerFrequency;
158  float bandWidth;
159  float coeff_b0, coeff_b1, coeff_b2, coeff_a1, coeff_a2;
160  float state_x1, state_x2, state_x3, state_y1;
161  float state_x1b, state_x2b, state_x3b, state_y1b;
162 };
163 
165  HMI_EFFECT_NODE_HEADER;
166  float frequency;
167  float modulatorType;
168  float modulateOutOfPhase;
169  float dryOut;
170  float wetOut;
171  float phase;
172 };
173 
175  HMI_EFFECT_NODE_HEADER;
176  float cutoffFrequency;
177  float bandWidth;
178  float resonance;
179  float coeff1;
180  float coeff2;
181  float stateX1;
182  float stateX2;
183 };
184 
186  float *buffer;
187  int writeHead;
188  int readHead;
189  int bufSizeInSamples;
190  float lastOutput;
191  float decayCoeff;
192 };
193 
195  HMI_EFFECT_NODE_HEADER;
196  float reverbMax;
197  float reverbTime;
198  float preDelay;
199  int preDelaySamples;
200  int bufSizeBytes;
201  HMIReverbEchoStage echoStages[4];
202  float dryOut;
203  float wetOut;
204 };
205 
207  HMI_EFFECT_NODE_HEADER;
208  float reverbMax;
209  float reverbTime;
210  float preDelay;
211  int preDelaySamples;
212  int bufSizeBytes;
213  HMIReverbEchoStage echoStages[6];
214  float dryOut;
215  float wetOut;
216 };
217 
219  HMI_EFFECT_NODE_HEADER;
220  float rate;
221  float depth;
222  float centerFrequency;
223  float feedback;
224  float dryOut;
225  float wetOut;
226  float phase;
227  float b0, b1, a1;
228  float state_x1L, state_y1L, state_x1R, state_y1R;
229  float state_x2L, state_y2L, state_x2R, state_y2R;
230  float coeff;
231  float modPhase;
232 };
233 
235  HMI_EFFECT_NODE_HEADER;
236  float envPoints;
237  float pointTime[8];
238  float pointAmp[8];
239  float initGuard;
240  int segRemaining[8];
241  int currentSegment;
242  float currentAmp;
243  float segSlopes[8];
244 };
245 
247  HMI_EFFECT_NODE_HEADER;
248  float maxDelayTime;
249  float delayTime;
250  float unused0;
251  float feedback;
252  float dryOut;
253  float wetOut;
254  float *delayBuf;
255  int unused1;
256  int bufSizeBytes;
257  int unused2;
258  int writeIndex;
259  int pad;
260 };
261 
263  HMI_EFFECT_NODE_HEADER;
264  float maxDelayTime;
265  float delayTimeL;
266  float delayTimeR;
267  float feedback;
268  float dryOut;
269  float wetOut;
270  float *delayBufL;
271  float *delayBufR;
272  int bufSizeBytesL;
273  int bufSizeBytesR;
274  int writeIndexL;
275  int writeIndexR;
276 };
277 
278 #undef HMI_EFFECT_NODE_HEADER
279 
280 } // End of namespace Audio
281 
282 #endif
Definition: hmi_types.h:234
Definition: hmi_types.h:138
Definition: hmi_types.h:89
Definition: hmi_types.h:153
Definition: hmi_types.h:112
Definition: hmi_types.h:218
Definition: hmi_types.h:262
Definition: hmi_types.h:126
Definition: hmi_types.h:206
Definition: hmi_interface.h:31
Definition: hmi_types.h:164
Definition: hmi_types.h:117
Definition: hmi_types.h:60
Definition: hmi_types.h:194
Definition: hmi_types.h:185
Definition: hmi_types.h:174
Definition: hmi_types.h:246
Definition: hmi_types.h:70
Definition: system.h:39