File: dimuse_defs.h

package info (click to toggle)
scummvm 2.9.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 450,268 kB
  • sloc: cpp: 4,297,604; asm: 28,322; python: 12,901; sh: 11,219; java: 8,477; xml: 7,843; perl: 2,633; ansic: 2,465; yacc: 1,670; javascript: 1,020; makefile: 933; lex: 578; awk: 275; objc: 82; sed: 11; php: 1
file content (280 lines) | stat: -rw-r--r-- 7,032 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#if !defined(SCUMM_IMUSE_DIGI_DEFS_H) && defined(ENABLE_SCUMM_7_8)
#define SCUMM_IMUSE_DIGI_DEFS_H

namespace Scumm {

#define DIMUSE_MAX_GROUPS      16
#define DIMUSE_MAX_FADES       16
#define DIMUSE_MAX_TRIGGERS    8
#define DIMUSE_MAX_DEFERS      8
#define DIMUSE_MAX_TRACKS      8
#define DIMUSE_MAX_MAP_SIZE    2048
#define DIMUSE_MAX_DISPATCHES  8
#define DIMUSE_MAX_STREAMZONES 50
#define DIMUSE_MAX_FADE_VOLUME 8323072
#define DIMUSE_MAX_STREAMS     3

#define DIMUSE_LARGE_FADES    1
#define DIMUSE_SMALL_FADES    4
#define DIMUSE_LARGE_FADE_DIM 350000
#define DIMUSE_SMALL_FADE_DIM 44100

#define DIMUSE_BASE_SAMPLERATE 22050
#define DIMUSE_BASE_FEEDSIZE   512
#define DIMUSE_NUM_WAVE_BUFS   8
#define DIMUSE_SMUSH_SOUNDID   12345678
#define DIMUSE_BUN_CHUNK_SIZE  0x2000
#define DIMUSE_GROUP_SFX       1
#define DIMUSE_GROUP_SPEECH    2
#define DIMUSE_GROUP_MUSIC     3
#define DIMUSE_GROUP_MUSICEFF  4
#define DIMUSE_BUFFER_SPEECH   1
#define DIMUSE_BUFFER_MUSIC    2
#define DIMUSE_BUFFER_SFX      3

#define DIMUSE_TIMER_BASE_RATE_HZ       50
#define DIMUSE_TIMER_BASE_RATE_USEC     20000  // 1000000 / 50Hz
#define DIMUSE_TIMER_GAIN_RED_RATE_USEC 100000 // 1000000 / 10Hz
#define DIMUSE_TIMER_FADES_RATE_USEC    16667  // 1000000 / 60Hz

// Parameters IDs
#define DIMUSE_P_BOGUS_ID       0x0
#define DIMUSE_P_SND_TRACK_NUM  0x100
#define DIMUSE_P_TRIGS_SNDS     0x200
#define DIMUSE_P_MARKER         0x300
#define DIMUSE_P_GROUP          0x400
#define DIMUSE_P_PRIORITY       0x500
#define DIMUSE_P_VOLUME         0x600
#define DIMUSE_P_PAN            0x700
#define DIMUSE_P_DETUNE         0x800
#define DIMUSE_P_TRANSPOSE      0x900
#define DIMUSE_P_MAILBOX        0xA00
#define DIMUSE_P_UNKNOWN        0xF00
#define DIMUSE_P_SND_HAS_STREAM 0x1800
#define DIMUSE_P_STREAM_BUFID   0x1900
#define DIMUSE_P_SND_POS_IN_MS  0x1A00

// Soundkludge command IDs
#define DIMUSE_C_KLUDGE_SET_STATE        0x1000
#define DIMUSE_C_KLUDGE_SET_SEQUENCE     0x1001
#define DIMUSE_C_KLUDGE_SET_CUE_POINT    0x1002
#define DIMUSE_C_KLUDGE_SET_ATTRIBUTE    0x1003
#define DIMUSE_C_KLUDGE_SET_SFX_VOLUME   0x2000
#define DIMUSE_C_KLUDGE_SET_VOICE_VOLUME 0x2001
#define DIMUSE_C_KLUDGE_SET_MUSIC_VOLUME 0x2002
#define DIMUSE_C_KLUDGE_STOP_ALL_SNDS    10
#define DIMUSE_C_KLUDGE_SET_PARAM        12
#define DIMUSE_C_KLUDGE_FADE_PARAM       14
#define DIMUSE_C_KLUDGE_START_STREAM     25
#define DIMUSE_C_KLUDGE_SWITCH_STREAM    26

// Script command IDs
#define DIMUSE_C_SCRIPT_INIT          0
#define DIMUSE_C_SCRIPT_TERMINATE     1
#define DIMUSE_C_SCRIPT_SAVE          2
#define DIMUSE_C_SCRIPT_RESTORE       3
#define DIMUSE_C_SCRIPT_REFRESH       4
#define DIMUSE_C_SCRIPT_SET_STATE     5
#define DIMUSE_C_SCRIPT_SET_SEQUENCE  6
#define DIMUSE_C_SCRIPT_CUE_POINT     7
#define DIMUSE_C_SCRIPT_SET_ATTRIBUTE 8

// Internal command IDs
#define DIMUSE_C_INIT             0
#define DIMUSE_C_PAUSE            3
#define DIMUSE_C_RESUME           4
#define DIMUSE_C_SET_GRP_VOL      7
#define DIMUSE_C_START_SND        8
#define DIMUSE_C_STOP_SND         9
#define DIMUSE_C_STOP_ALL_SNDS    10
#define DIMUSE_C_GET_NEXT_SND     11
#define DIMUSE_C_SET_PARAM        12
#define DIMUSE_C_GET_PARAM        13
#define DIMUSE_C_FADE_PARAM       14
#define DIMUSE_C_SET_HOOK         15
#define DIMUSE_C_GET_HOOK         16
#define DIMUSE_C_SET_TRIGGER      17
#define DIMUSE_C_CHECK_TRIGGER    18
#define DIMUSE_C_CLEAR_TRIGGER    19
#define DIMUSE_C_DEFER_CMD        20
#define DIMUSE_C_GET_MARKER_SYNCS 21
#define DIMUSE_C_START_STREAM     25
#define DIMUSE_C_SWITCH_STREAM    26
#define DIMUSE_C_PROCESS_STREAMS  27
#define DIMUSE_C_FEED_STREAM      29

// Trigger callback command ID
#define DIMUSE_C_SCRIPT_CALLBACK  0

// Block IDs for the Creative Voice File format
// used within Full Throttle and The Dig (demo)
#define VOC_DIGI_DATA_BLOCK  1
#define VOC_MARKER_BLOCK     4
#define VOC_LOOP_START_BLOCK 6
#define VOC_LOOP_END_BLOCK   7

struct IMuseDigiDispatch;
struct IMuseDigiTrack;
struct IMuseDigiStreamZone;

typedef struct {
	int sound;
	char text[256];
	int opcode;
	int a;
	int b;
	int c;
	int d;
	int e;
	int f;
	int g;
	int h;
	int i;
	int j;
	int clearLater;
} IMuseDigiTrigger;

typedef struct {
	int counter;
	int opcode;
	int a;
	int b;
	int c;
	int d;
	int e;
	int f;
	int g;
	int h;
	int i;
	int j;
} IMuseDigiDefer;

typedef struct {
	int status;
	int sound;
	int param;
	int currentVal;
	int counter;
	int length;
	int slope;
	int slopeMod;
	int modOvfloCounter;
	int nudge;
} IMuseDigiFade;

struct IMuseDigiTrack {
	int index;
	IMuseDigiTrack *prev;
	IMuseDigiTrack *next;
	IMuseDigiDispatch *dispatchPtr;
	int soundId;
	int marker;
	int group;
	int priority;
	int vol;
	int effVol;
	int pan;
	int detune;
	int transpose;
	int pitchShift;
	int mailbox;
	int jumpHook;
	int32 syncSize_0;
	byte *syncPtr_0;
	int32 syncSize_1;
	byte *syncPtr_1;
	int32 syncSize_2;
	byte *syncPtr_2;
	int32 syncSize_3;
	byte *syncPtr_3;
};

struct IMuseDigiStreamZone {
	IMuseDigiStreamZone *prev;
	IMuseDigiStreamZone *next;
	int useFlag;
	int32 offset;
	int32 size;
	int fadeFlag;
};

typedef struct {
	int soundId;
	int32 curOffset;
	int32 endOffset;
	int bufId;
	uint8 *buf;
	int32 bufFreeSize;
	int32 loadSize;
	int32 criticalSize;
	int32 maxRead;
	int32 loadIndex;
	int32 readIndex;
	int paused;
	int vocLoopFlag;
	int32 vocLoopTriggerOffset;
} IMuseDigiStream;

typedef struct {
	uint8 *buffer;
	int32 bufSize;
	int32 loadSize;
	int32 criticalSize;
} IMuseDigiSndBuffer;

struct IMuseDigiDispatch {
	IMuseDigiTrack *trackPtr;
	int wordSize;
	int sampleRate;
	int channelCount;
	int32 currentOffset;
	int32 audioRemaining;
	int32 map[DIMUSE_MAX_MAP_SIZE];
	IMuseDigiStream *streamPtr;
	int streamBufID;
	IMuseDigiStreamZone *streamZoneList;
	int streamErrFlag;
	uint8 *fadeBuf;
	int32 fadeOffset;
	int32 fadeRemaining;
	int fadeWordSize;
	int fadeSampleRate;
	int fadeChannelCount;
	int fadeSyncFlag;
	int32 fadeSyncDelta;
	int fadeVol;
	int fadeSlope;
	int32 vocLoopStartingPoint;
};

typedef struct {
	int bytesPerSample;
	int numChannels;
	uint8 *mixBuf;
	int mixBufSize;
	int sizeSampleKB;
} waveOutParamsStruct;

} // End of namespace Scumm
#endif