1 /* GF1 Patch definition: */
2 enum
3 {
4 	HEADER_SIZE					= 12,
5 	ID_SIZE						= 10,
6 	DESC_SIZE					= 60,
7 	RESERVED_SIZE				= 40,
8 	PATCH_HEADER_RESERVED_SIZE	= 36,
9 	LAYER_RESERVED_SIZE			= 40,
10 	PATCH_DATA_RESERVED_SIZE	= 36,
11 	INST_NAME_SIZE				= 16,
12 	ENVELOPES					= 6,
13 	MAX_LAYERS					= 4
14 };
15 #define GF1_HEADER_TEXT			"GF1PATCH110"
16 
17 #ifdef _MSC_VER
18 #pragma pack(push, 1)
19 #define GCC_PACKED
20 #else
21 #define GCC_PACKED __attribute__((__packed__))
22 #endif
23 
24 struct GF1PatchHeader
25 {
26 	char Header[HEADER_SIZE];
27 	char GravisID[ID_SIZE];		/* Id = "ID#000002" */
28 	char Description[DESC_SIZE];
29 	uint8_t Instruments;
30 	uint8_t Voices;
31 	uint8_t Channels;
32 	uint16_t WaveForms;
33 	uint16_t MasterVolume;
34 	uint32_t DataSize;
35 	uint8_t Reserved[PATCH_HEADER_RESERVED_SIZE];
36 } GCC_PACKED;
37 
38 struct GF1InstrumentData
39 {
40 	uint16_t Instrument;
41 	char InstrumentName[INST_NAME_SIZE];
42 	int  InstrumentSize;
43 	uint8_t Layers;
44 	uint8_t Reserved[RESERVED_SIZE];
45 } GCC_PACKED;
46 
47 struct GF1LayerData
48 {
49 	uint8_t LayerDuplicate;
50 	uint8_t Layer;
51 	int  LayerSize;
52 	uint8_t Samples;
53 	uint8_t Reserved[LAYER_RESERVED_SIZE];
54 } GCC_PACKED;
55 
56 struct GF1PatchData
57 {
58 	char  WaveName[7];
59 	uint8_t  Fractions;
60 	int   WaveSize;
61 	int   StartLoop;
62 	int   EndLoop;
63 	uint16_t  SampleRate;
64 	int   LowFrequency;
65 	int   HighFrequency;
66 	int   RootFrequency;
67 	int16_t Tune;
68 	uint8_t  Balance;
69 	uint8_t  EnvelopeRate[ENVELOPES];
70 	uint8_t  EnvelopeOffset[ENVELOPES];
71 	uint8_t  TremoloSweep;
72 	uint8_t  TremoloRate;
73 	uint8_t  TremoloDepth;
74 	uint8_t  VibratoSweep;
75 	uint8_t  VibratoRate;
76 	uint8_t  VibratoDepth;
77 	uint8_t  Modes;
78 	int16_t ScaleFrequency;
79 	uint16_t  ScaleFactor;		/* From 0 to 2048 or 0 to 2 */
80 	uint8_t  Reserved[PATCH_DATA_RESERVED_SIZE];
81 } GCC_PACKED;
82 #ifdef _MSC_VER
83 #pragma pack(pop)
84 #endif
85 #undef GCC_PACKED
86