ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
dimuse_defs.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 #if !defined(SCUMM_IMUSE_DIGI_DEFS_H) && defined(ENABLE_SCUMM_7_8)
23 #define SCUMM_IMUSE_DIGI_DEFS_H
24 
25 namespace Scumm {
26 
27 #define DIMUSE_MAX_GROUPS 16
28 #define DIMUSE_MAX_FADES 16
29 #define DIMUSE_MAX_TRIGGERS 8
30 #define DIMUSE_MAX_DEFERS 8
31 #define DIMUSE_MAX_TRACKS 8
32 #define DIMUSE_MAX_MAP_SIZE 2048
33 #define DIMUSE_MAX_DISPATCHES 8
34 #define DIMUSE_MAX_STREAMZONES 50
35 #define DIMUSE_MAX_FADE_VOLUME 8323072
36 #define DIMUSE_MAX_STREAMS 3
37 
38 #define DIMUSE_LARGE_FADES 1
39 #define DIMUSE_SMALL_FADES 4
40 #define DIMUSE_LARGE_FADE_DIM 350000
41 #define DIMUSE_SMALL_FADE_DIM 44100
42 
43 #define DIMUSE_BASE_SAMPLERATE 22050
44 #define DIMUSE_BASE_FEEDSIZE 512
45 #define DIMUSE_NUM_WAVE_BUFS 8
46 #define DIMUSE_SMUSH_SOUNDID 12345678
47 #define DIMUSE_BUN_CHUNK_SIZE 0x2000
48 #define DIMUSE_GROUP_SFX 1
49 #define DIMUSE_GROUP_SPEECH 2
50 #define DIMUSE_GROUP_MUSIC 3
51 #define DIMUSE_GROUP_MUSICEFF 4
52 #define DIMUSE_BUFFER_SPEECH 1
53 #define DIMUSE_BUFFER_MUSIC 2
54 #define DIMUSE_BUFFER_SFX 3
55 
56 #define DIMUSE_TIMER_BASE_RATE_HZ 50
57 #define DIMUSE_TIMER_BASE_RATE_USEC 20000 // 1000000 / 50Hz
58 #define DIMUSE_TIMER_GAIN_RED_RATE_USEC 100000 // 1000000 / 10Hz
59 #define DIMUSE_TIMER_FADES_RATE_USEC 16667 // 1000000 / 60Hz
60 
61 // Parameters IDs
62 #define DIMUSE_P_BOGUS_ID 0x0
63 #define DIMUSE_P_SND_TRACK_NUM 0x100
64 #define DIMUSE_P_TRIGS_SNDS 0x200
65 #define DIMUSE_P_MARKER 0x300
66 #define DIMUSE_P_GROUP 0x400
67 #define DIMUSE_P_PRIORITY 0x500
68 #define DIMUSE_P_VOLUME 0x600
69 #define DIMUSE_P_PAN 0x700
70 #define DIMUSE_P_DETUNE 0x800
71 #define DIMUSE_P_TRANSPOSE 0x900
72 #define DIMUSE_P_MAILBOX 0xA00
73 #define DIMUSE_P_UNKNOWN 0xF00
74 #define DIMUSE_P_SND_HAS_STREAM 0x1800
75 #define DIMUSE_P_STREAM_BUFID 0x1900
76 #define DIMUSE_P_SND_POS_IN_MS 0x1A00
77 
78 // Soundkludge command IDs
79 #define DIMUSE_C_KLUDGE_SET_STATE 0x1000
80 #define DIMUSE_C_KLUDGE_SET_SEQUENCE 0x1001
81 #define DIMUSE_C_KLUDGE_SET_CUE_POINT 0x1002
82 #define DIMUSE_C_KLUDGE_SET_ATTRIBUTE 0x1003
83 #define DIMUSE_C_KLUDGE_SET_SFX_VOLUME 0x2000
84 #define DIMUSE_C_KLUDGE_SET_VOICE_VOLUME 0x2001
85 #define DIMUSE_C_KLUDGE_SET_MUSIC_VOLUME 0x2002
86 #define DIMUSE_C_KLUDGE_STOP_ALL_SNDS 10
87 #define DIMUSE_C_KLUDGE_SET_PARAM 12
88 #define DIMUSE_C_KLUDGE_FADE_PARAM 14
89 #define DIMUSE_C_KLUDGE_START_STREAM 25
90 #define DIMUSE_C_KLUDGE_SWITCH_STREAM 26
91 
92 // Script command IDs
93 #define DIMUSE_C_SCRIPT_INIT 0
94 #define DIMUSE_C_SCRIPT_TERMINATE 1
95 #define DIMUSE_C_SCRIPT_SAVE 2
96 #define DIMUSE_C_SCRIPT_RESTORE 3
97 #define DIMUSE_C_SCRIPT_REFRESH 4
98 #define DIMUSE_C_SCRIPT_SET_STATE 5
99 #define DIMUSE_C_SCRIPT_SET_SEQUENCE 6
100 #define DIMUSE_C_SCRIPT_CUE_POINT 7
101 #define DIMUSE_C_SCRIPT_SET_ATTRIBUTE 8
102 
103 // Internal command IDs
104 #define DIMUSE_C_INIT 0
105 #define DIMUSE_C_PAUSE 3
106 #define DIMUSE_C_RESUME 4
107 #define DIMUSE_C_SET_GRP_VOL 7
108 #define DIMUSE_C_START_SND 8
109 #define DIMUSE_C_STOP_SND 9
110 #define DIMUSE_C_STOP_ALL_SNDS 10
111 #define DIMUSE_C_GET_NEXT_SND 11
112 #define DIMUSE_C_SET_PARAM 12
113 #define DIMUSE_C_GET_PARAM 13
114 #define DIMUSE_C_FADE_PARAM 14
115 #define DIMUSE_C_SET_HOOK 15
116 #define DIMUSE_C_GET_HOOK 16
117 #define DIMUSE_C_SET_TRIGGER 17
118 #define DIMUSE_C_CHECK_TRIGGER 18
119 #define DIMUSE_C_CLEAR_TRIGGER 19
120 #define DIMUSE_C_DEFER_CMD 20
121 #define DIMUSE_C_GET_MARKER_SYNCS 21
122 #define DIMUSE_C_START_STREAM 25
123 #define DIMUSE_C_SWITCH_STREAM 26
124 #define DIMUSE_C_PROCESS_STREAMS 27
125 #define DIMUSE_C_FEED_STREAM 29
126 
127 // Trigger callback command ID
128 #define DIMUSE_C_SCRIPT_CALLBACK 0
129 
130 // Block IDs for the Creative Voice File format
131 // used within Full Throttle and The Dig (demo)
132 #define VOC_DIGI_DATA_BLOCK 1
133 #define VOC_MARKER_BLOCK 4
134 #define VOC_LOOP_START_BLOCK 6
135 #define VOC_LOOP_END_BLOCK 7
136 
137 struct IMuseDigiDispatch;
138 struct IMuseDigiTrack;
139 struct IMuseDigiStreamZone;
140 
141 typedef struct {
142  int sound;
143  char text[256];
144  int opcode;
145  int a;
146  int b;
147  int c;
148  int d;
149  int e;
150  int f;
151  int g;
152  int h;
153  int i;
154  int j;
155  int clearLater;
156 } IMuseDigiTrigger;
157 
158 typedef struct {
159  int counter;
160  int opcode;
161  int a;
162  int b;
163  int c;
164  int d;
165  int e;
166  int f;
167  int g;
168  int h;
169  int i;
170  int j;
171 } IMuseDigiDefer;
172 
173 typedef struct {
174  int status;
175  int sound;
176  int param;
177  int currentVal;
178  int counter;
179  int length;
180  int slope;
181  int slopeMod;
182  int modOvfloCounter;
183  int nudge;
184 } IMuseDigiFade;
185 
186 struct IMuseDigiTrack {
187  int index;
188  IMuseDigiTrack *prev;
189  IMuseDigiTrack *next;
190  IMuseDigiDispatch *dispatchPtr;
191  int soundId;
192  int marker;
193  int group;
194  int priority;
195  int vol;
196  int effVol;
197  int pan;
198  int detune;
199  int transpose;
200  int pitchShift;
201  int mailbox;
202  int jumpHook;
203  int32 syncSize_0;
204  byte *syncPtr_0;
205  int32 syncSize_1;
206  byte *syncPtr_1;
207  int32 syncSize_2;
208  byte *syncPtr_2;
209  int32 syncSize_3;
210  byte *syncPtr_3;
211 };
212 
213 struct IMuseDigiStreamZone {
214  IMuseDigiStreamZone *prev;
215  IMuseDigiStreamZone *next;
216  int useFlag;
217  int32 offset;
218  int32 size;
219  int fadeFlag;
220 };
221 
222 typedef struct {
223  int soundId;
224  int32 curOffset;
225  int32 endOffset;
226  int bufId;
227  uint8 *buf;
228  int32 bufFreeSize;
229  int32 loadSize;
230  int32 criticalSize;
231  int32 maxRead;
232  int32 loadIndex;
233  int32 readIndex;
234  int paused;
235  int vocLoopFlag;
236  int32 vocLoopTriggerOffset;
237 } IMuseDigiStream;
238 
239 typedef struct {
240  uint8 *buffer;
241  int32 bufSize;
242  int32 loadSize;
243  int32 criticalSize;
244 } IMuseDigiSndBuffer;
245 
246 struct IMuseDigiDispatch {
247  IMuseDigiTrack *trackPtr;
248  int wordSize;
249  int sampleRate;
250  int channelCount;
251  int32 currentOffset;
252  int32 audioRemaining;
253  int32 map[DIMUSE_MAX_MAP_SIZE];
254  IMuseDigiStream *streamPtr;
255  int streamBufID;
256  IMuseDigiStreamZone *streamZoneList;
257  int streamErrFlag;
258  uint8 *fadeBuf;
259  int32 fadeOffset;
260  int32 fadeRemaining;
261  int fadeWordSize;
262  int fadeSampleRate;
263  int fadeChannelCount;
264  int fadeSyncFlag;
265  int32 fadeSyncDelta;
266  int fadeVol;
267  int fadeSlope;
268  int32 vocLoopStartingPoint;
269 };
270 
271 typedef struct {
272  int bytesPerSample;
273  int numChannels;
274  uint8 *mixBuf;
275  int mixBufSize;
276  int sizeSampleKB;
277 } waveOutParamsStruct;
278 
279 } // End of namespace Scumm
280 #endif
Definition: actor.h:30