1 /* DirectMusic DLS Download Definitions
2  *
3  *  Copyright (C) 2003-2004 Rok Mandeljc
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  */
19 
20 #ifndef __WINE_DMUSIC_DLS_H
21 #define __WINE_DMUSIC_DLS_H
22 
23 #include <dls1.h>
24 
25 /*****************************************************************************
26  * Typedef definitions
27  */
28 typedef LONG GCENT;
29 typedef LONG PCENT;
30 typedef LONG PERCENT;
31 typedef LONG TCENT;
32 
33 typedef LONGLONG REFERENCE_TIME, *LPREFERENCE_TIME;
34 
35 /*****************************************************************************
36  * FOURCC definition
37  */
38 #ifndef mmioFOURCC
39 typedef DWORD FOURCC;
40 #define mmioFOURCC(ch0,ch1,ch2,ch3) \
41 	((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
42 	((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
43 #endif
44 
45 /*****************************************************************************
46  * Flags
47  */
48 #define DMUS_DEFAULT_SIZE_OFFSETTABLE 0x1
49 
50 #define DMUS_DOWNLOADINFO_INSTRUMENT       0x1
51 #define DMUS_DOWNLOADINFO_WAVE             0x2
52 #define DMUS_DOWNLOADINFO_INSTRUMENT2      0x3
53 #define DMUS_DOWNLOADINFO_WAVEARTICULATION 0x4
54 #define DMUS_DOWNLOADINFO_STREAMINGWAVE    0x5
55 #define DMUS_DOWNLOADINFO_ONESHOTWAVE      0x6
56 
57 #define DMUS_INSTRUMENT_GM_INSTRUMENT 0x1
58 
59 #define DMUS_MIN_DATA_SIZE 0x4
60 
61 /*****************************************************************************
62  * Structures
63  */
64 /* typedef definitions */
65 typedef struct _DMUS_DOWNLOADINFO   DMUS_DOWNLOADINFO,   *LPDMUS_DOWNLOADINFO;
66 typedef struct _DMUS_OFFSETTABLE    DMUS_OFFSETTABLE,    *LPDMUS_OFFSETTABLE;
67 typedef struct _DMUS_INSTRUMENT     DMUS_INSTRUMENT,     *LPDMUS_INSTRUMENT;
68 typedef struct _DMUS_REGION         DMUS_REGION,         *LPDMUS_REGION;
69 typedef struct _DMUS_LFOPARAMS      DMUS_LFOPARAMS,      *LPDMUS_LFOPARAMS;
70 typedef struct _DMUS_VEGPARAMS      DMUS_VEGPARAMS,      *LPDMUS_VEGPARAMS;
71 typedef struct _DMUS_PEGPARAMS      DMUS_PEGPARAMS,      *LPDMUS_PEGPARAMS;
72 typedef struct _DMUS_MSCPARAMS      DMUS_MSCPARAMS,      *LPDMUS_MSCPARAMS;
73 typedef struct _DMUS_ARTICPARAMS    DMUS_ARTICPARAMS,    *LPDMUS_ARTICPARAMS;
74 typedef struct _DMUS_ARTICULATION   DMUS_ARTICULATION,   *LPDMUS_ARTICULATION;
75 typedef struct _DMUS_ARTICULATION2  DMUS_ARTICULATION2,  *LPDMUS_ARTICULATION2;
76 typedef struct _DMUS_EXTENSIONCHUNK DMUS_EXTENSIONCHUNK, *LPDMUS_EXTENSIONCHUNK;
77 typedef struct _DMUS_COPYRIGHT      DMUS_COPYRIGHT,      *LPDMUS_COPYRIGHT;
78 typedef struct _DMUS_WAVEDATA       DMUS_WAVEDATA,       *LPDMUS_WAVEDATA;
79 typedef struct _DMUS_WAVE           DMUS_WAVE,           *LPDMUS_WAVE;
80 typedef struct _DMUS_NOTERANGE      DMUS_NOTERANGE,      *LPDMUS_NOTERANGE;
81 typedef struct _DMUS_WAVEARTDL      DMUS_WAVEARTDL,      *LPDMUS_WAVEARTDL;
82 typedef struct _DMUS_WAVEDL         DMUS_WAVEDL,         *LPDMUS_WAVEDL;
83 
84 /* actual structures */
85 struct _DMUS_DOWNLOADINFO {
86 	DWORD dwDLType;
87 	DWORD dwDLId;
88 	DWORD dwNumOffsetTableEntries;
89 	DWORD cbSize;
90 };
91 
92 struct _DMUS_OFFSETTABLE {
93 	ULONG ulOffsetTable[DMUS_DEFAULT_SIZE_OFFSETTABLE];
94 };
95 
96 struct _DMUS_INSTRUMENT {
97 	ULONG ulPatch;
98 	ULONG ulFirstRegionIdx;
99 	ULONG ulGlobalArtIdx;
100 	ULONG ulFirstExtCkIdx;
101 	ULONG ulCopyrightIdx;
102 	ULONG ulFlags;
103 };
104 
105 struct _DMUS_REGION {
106 	RGNRANGE RangeKey;
107 	RGNRANGE RangeVelocity;
108 	USHORT   fusOptions;
109 	USHORT   usKeyGroup;
110 	ULONG    ulRegionArtIdx;
111 	ULONG    ulNextRegionIdx;
112 	ULONG    ulFirstExtCkIdx;
113 	WAVELINK WaveLink;
114 	WSMPL    WSMP;
115 /* WLOOP is typedef'ed as struct _rloop in dls1.h. Changed type of
116  * WLOOP[1] from WLOOP to struct _rloop for __cplusplus compat. */
117 	struct _rloop   WLOOP[1];
118 };
119 
120 struct _DMUS_LFOPARAMS {
121 	PCENT pcFrequency;
122 	TCENT tcDelay;
123 	GCENT gcVolumeScale;
124 	PCENT pcPitchScale;
125 	GCENT gcMWToVolume;
126 	PCENT pcMWToPitch;
127 };
128 
129 struct _DMUS_VEGPARAMS {
130 	TCENT   tcAttack;
131 	TCENT   tcDecay;
132 	PERCENT ptSustain;
133 	TCENT   tcRelease;
134 	TCENT   tcVel2Attack;
135 	TCENT   tcKey2Decay;
136 };
137 
138 struct _DMUS_PEGPARAMS {
139 	TCENT   tcAttack;
140 	TCENT   tcDecay;
141 	PERCENT ptSustain;
142 	TCENT   tcRelease;
143 	TCENT   tcVel2Attack;
144 	TCENT   tcKey2Decay;
145 	PCENT   pcRange;
146 };
147 
148 struct _DMUS_MSCPARAMS {
149 	PERCENT ptDefaultPan;
150 };
151 
152 struct _DMUS_ARTICPARAMS {
153 	DMUS_LFOPARAMS LFO;
154 	DMUS_VEGPARAMS VolEG;
155 	DMUS_PEGPARAMS PitchEG;
156 	DMUS_MSCPARAMS Misc;
157 };
158 
159 struct _DMUS_ARTICULATION {
160 	ULONG ulArt1Idx;
161 	ULONG ulFirstExtCkIdx;
162 };
163 
164 struct _DMUS_ARTICULATION2 {
165 	ULONG ulArtIdx;
166 	ULONG ulFirstExtCkIdx;
167 	ULONG ulNextArtIdx;
168 };
169 
170 struct _DMUS_EXTENSIONCHUNK {
171 	ULONG  cbSize;
172 	ULONG  ulNextExtCkIdx;
173 	FOURCC ExtCkID;
174 	BYTE   byExtCk[DMUS_MIN_DATA_SIZE];
175 };
176 
177 struct _DMUS_COPYRIGHT {
178 	ULONG cbSize;
179 	BYTE  byCopyright[DMUS_MIN_DATA_SIZE];
180 };
181 
182 struct _DMUS_WAVEDATA {
183 	ULONG cbSize;
184 	BYTE  byData[DMUS_MIN_DATA_SIZE];
185 };
186 
187 struct _DMUS_WAVE {
188 	ULONG        ulFirstExtCkIdx;
189 	ULONG        ulCopyrightIdx;
190 	ULONG        ulWaveDataIdx;
191 	WAVEFORMATEX WaveformatEx;
192 };
193 
194 struct _DMUS_NOTERANGE {
195 	DWORD dwLowNote;
196 	DWORD dwHighNote;
197 };
198 
199 struct _DMUS_WAVEARTDL {
200 	ULONG  ulDownloadIdIdx;
201 	ULONG  ulBus;
202 	ULONG  ulBuffers;
203 	ULONG  ulMasterDLId;
204 	USHORT usOptions;
205 };
206 
207 struct _DMUS_WAVEDL {
208 	ULONG cbWaveData;
209 };
210 
211 #endif /* __WINE_DMUSIC_DLS_H */
212