dls.h revision a8c89077d78769bf4840fa91609edc51fe2fa02d
1 /*
2
3     dls.h
4
5     Description:
6
7     Interface defines and structures for the Instrument Collection Form
8     RIFF DLS.
9
10     Written by Sonic Foundry 1996.  Released for public use.
11
12 */
13
14 #ifndef _INC_DLS
15 #define _INC_DLS
16
17 /*
18
19    Layout of an instrument collection:
20
21
22    RIFF [] 'DLS ' [colh,INSTLIST,WAVEPOOL,INFOLIST]
23
24    INSTLIST
25    LIST [] 'lins'
26                  LIST [] 'ins ' [insh,RGNLIST,ARTLIST,INFOLIST]
27                  LIST [] 'ins ' [insh,RGNLIST,ARTLIST,INFOLIST]
28                  LIST [] 'ins ' [insh,RGNLIST,ARTLIST,INFOLIST]
29
30    RGNLIST
31    LIST [] 'lrgn'
32                  LIST [] 'rgn '  [rgnh,wsmp,wlnk,ARTLIST]
33                  LIST [] 'rgn '  [rgnh,wsmp,wlnk,ARTLIST]
34                  LIST [] 'rgn '  [rgnh,wsmp,wlnk,ARTLIST]
35
36    ARTLIST
37    LIST [] 'lart'
38            'art1' level 1 Articulation connection graph
39            'art2' level 2 Articulation connection graph
40            '3rd1' Possible 3rd party articulation structure 1
41            '3rd2' Possible 3rd party articulation structure 2 .... and so on
42
43    WAVEPOOL
44    ptbl [] [pool table]
45    LIST [] 'wvpl'
46                  [path],
47                  [path],
48                  LIST [] 'wave',RIFFWAVE
49                  LIST [] 'wave',RIFFWAVE
50                  LIST [] 'wave',RIFFWAVE
51                  LIST [] 'wave',RIFFWAVE
52                  LIST [] 'wave',RIFFWAVE
53
54    INFOLIST
55    LIST [] 'INFO'
56                  'icmt' 'One of those crazy comments.'
57                  'icop' 'Copyright (C) 1996 Sonic Foundry'
58
59 */
60
61
62 /*
63    FOURCC's used in the DLS file
64 */
65/* shree */
66//#define FAR
67
68/* shree
69
70 #define FOURCC_DLS   mmioFOURCC('D','L','S',' ')
71 #define FOURCC_COLH  mmioFOURCC('c','o','l','h')
72 #define FOURCC_WVPL  mmioFOURCC('w','v','p','l')
73 #define FOURCC_PTBL  mmioFOURCC('p','t','b','l')
74 #define FOURCC_PATH  mmioFOURCC('p','a','t','h')
75 #define FOURCC_wave  mmioFOURCC('w','a','v','e')
76 #define FOURCC_LINS  mmioFOURCC('l','i','n','s')
77 #define FOURCC_INS   mmioFOURCC('i','n','s',' ')
78 #define FOURCC_INSH  mmioFOURCC('i','n','s','h')
79 #define FOURCC_LRGN  mmioFOURCC('l','r','g','n')
80 #define FOURCC_RGN   mmioFOURCC('r','g','n',' ')
81 #define FOURCC_RGNH  mmioFOURCC('r','g','n','h')
82 #define FOURCC_LART  mmioFOURCC('l','a','r','t')
83 #define FOURCC_ART1  mmioFOURCC('a','r','t','1')
84 #define FOURCC_WLNK  mmioFOURCC('w','l','n','k')
85 #define FOURCC_WSMP  mmioFOURCC('w','s','m','p')
86 #define FOURCC_VERS  mmioFOURCC('v','e','r','s')
87*/
88 /*
89    Articulation connection graph definitions
90 */
91
92 /* Generic Sources */
93 #define CONN_SRC_NONE              0x0000
94 #define CONN_SRC_LFO               0x0001
95 #define CONN_SRC_KEYONVELOCITY     0x0002
96 #define CONN_SRC_KEYNUMBER         0x0003
97 #define CONN_SRC_EG1               0x0004
98 #define CONN_SRC_EG2               0x0005
99 #define CONN_SRC_PITCHWHEEL        0x0006
100
101 /* Midi Controllers 0-127 */
102 #define CONN_SRC_CC1               0x0081
103 #define CONN_SRC_CC7               0x0087
104 #define CONN_SRC_CC10              0x008a
105 #define CONN_SRC_CC11              0x008b
106
107 /* Registered Parameter Numbers */
108 #define CONN_SRC_RPN0             0x0100
109 #define CONN_SRC_RPN1             0x0101
110 #define CONN_SRC_RPN2             0x0102
111
112 /* Generic Destinations */
113 #define CONN_DST_NONE              0x0000
114 #define CONN_DST_ATTENUATION       0x0001
115 #define CONN_DST_RESERVED          0x0002
116 #define CONN_DST_PITCH             0x0003
117 #define CONN_DST_PAN               0x0004
118
119 /* LFO Destinations */
120 #define CONN_DST_LFO_FREQUENCY     0x0104
121 #define CONN_DST_LFO_STARTDELAY    0x0105
122
123 /* EG1 Destinations */
124 #define CONN_DST_EG1_ATTACKTIME    0x0206
125 #define CONN_DST_EG1_DECAYTIME     0x0207
126 #define CONN_DST_EG1_RESERVED      0x0208
127 #define CONN_DST_EG1_RELEASETIME   0x0209
128 #define CONN_DST_EG1_SUSTAINLEVEL  0x020a
129
130 /* EG2 Destinations */
131 #define CONN_DST_EG2_ATTACKTIME    0x030a
132 #define CONN_DST_EG2_DECAYTIME     0x030b
133 #define CONN_DST_EG2_RESERVED      0x030c
134 #define CONN_DST_EG2_RELEASETIME   0x030d
135 #define CONN_DST_EG2_SUSTAINLEVEL  0x030e
136
137 #define CONN_TRN_NONE              0x0000
138 #define CONN_TRN_CONCAVE           0x0001
139
140 typedef struct _DLSVERSION {
141   DWORD    dwVersionMS;
142   DWORD    dwVersionLS;
143 }DLSVERSION, FAR *LPDLSVERSION;
144
145
146 typedef struct _CONNECTION {
147   USHORT   usSource;
148   USHORT   usControl;
149   USHORT   usDestination;
150   USHORT   usTransform;
151   LONG     lScale;
152   }CONNECTION, FAR *LPCONNECTION;
153
154
155 /* Level 1 Articulation Data */
156
157 typedef struct _CONNECTIONLIST {
158   ULONG    cbSize;            /* size of the connection list structure */
159   ULONG    cConnections;      /* count of connections in the list */
160   } CONNECTIONLIST, FAR *LPCONNECTIONLIST;
161
162
163
164 /*
165    Generic type defines for regions and instruments
166 */
167
168 typedef struct _RGNRANGE {
169   USHORT usLow;
170   USHORT usHigh;
171 }RGNRANGE, FAR * LPRGNRANGE;
172
173 #define F_INSTRUMENT_DRUMS      0x80000000
174
175 typedef struct _MIDILOCALE {
176   ULONG ulBank;
177   ULONG ulInstrument;
178 }MIDILOCALE, FAR *LPMIDILOCALE;
179
180 /*
181    Header structures found in an DLS file for collection, instruments, and
182    regions.
183 */
184
185 #define F_RGN_OPTION_SELFNONEXCLUSIVE  0x0001
186
187 typedef struct _RGNHEADER {
188   RGNRANGE RangeKey;            /* Key range */
189   RGNRANGE RangeVelocity;       /* Velocity Range */
190   USHORT   fusOptions;          /* Synthesis options for this range */
191   USHORT   usKeyGroup;          /* Key grouping for non simultaneous play
192                                    0 = no group, 1 up is group
193                                    for Level 1 only groups 1-15 are allowed */
194 }RGNHEADER, FAR *LPRGNHEADER;
195
196 typedef struct _INSTHEADER {
197   ULONG      cRegions;          /* Count of regions in this instrument */
198   MIDILOCALE Locale;            /* Intended MIDI locale of this instrument */
199 }INSTHEADER, FAR *LPINSTHEADER;
200
201 typedef struct _DLSHEADER {
202   ULONG      cInstruments;      /* Count of instruments in the collection */
203 }DLSHEADER, FAR *LPDLSHEADER;
204
205 /*
206    definitions for the Wave link structure
207 */
208
209 /*****  For level 1 only WAVELINK_CHANNEL_MONO is valid  ****
210   ulChannel allows for up to 32 channels of audio with each bit position
211   specifiying a channel of playback */
212
213 #define WAVELINK_CHANNEL_LEFT    0x0001
214 #define WAVELINK_CHANNEL_RIGHT   0x0002
215
216 #define F_WAVELINK_PHASE_MASTER  0x0001
217
218 typedef struct _WAVELINK { /* any paths or links are stored right after struct */
219   USHORT   fusOptions;     /* options flags for this wave */
220   USHORT   usPhaseGroup;   /* Phase grouping for locking channels */
221   ULONG    ulChannel;      /* channel placement */
222   ULONG    ulTableIndex;   /* index into the wave pool table, 0 based */
223 }WAVELINK, FAR *LPWAVELINK;
224
225 #define POOL_CUE_NULL  0xffffffff
226
227 typedef struct _POOLCUE {
228 //  ULONG    ulEntryIndex;   /* Index entry in the list */
229   ULONG    ulOffset;       /* Offset to the entry in the list */
230 }POOLCUE, FAR *LPPOOLCUE;
231
232 typedef struct _POOLTABLE {
233   ULONG    cbSize;            /* size of the pool table structure */
234   ULONG    cCues;             /* count of cues in the list */
235   } POOLTABLE, FAR *LPPOOLTABLE;
236
237 /*
238    Structures for the "wsmp" chunk
239 */
240
241 #define F_WSMP_NO_TRUNCATION     0x0001
242 #define F_WSMP_NO_COMPRESSION    0x0002
243
244
245 typedef struct _rwsmp {
246   ULONG   cbSize;
247   USHORT  usUnityNote;         /* MIDI Unity Playback Note */
248   SHORT   sFineTune;           /* Fine Tune in log tuning */
249   LONG    lAttenuation;        /* Overall Attenuation to be applied to data */
250   ULONG   fulOptions;          /* Flag options */
251   ULONG   cSampleLoops;        /* Count of Sample loops, 0 loops is one shot */
252   } WSMPL, FAR *LPWSMPL;
253
254
255 /* This loop type is a normal forward playing loop which is continually
256    played until the envelope reaches an off threshold in the release
257    portion of the volume envelope */
258
259 #define WLOOP_TYPE_FORWARD   0
260
261 typedef struct _rloop {
262   ULONG cbSize;
263   ULONG ulType;              /* Loop Type */
264   ULONG ulStart;             /* Start of loop in samples */
265   ULONG ulLength;            /* Length of loop in samples */
266 } WLOOP, FAR *LPWLOOP;
267
268 #endif /* _INC_DLS */
269