Initial commit.
[amiga/xmodule.git] / Hooks / FastTracker2.h
1 /*
2 **      FastTracker2.h
3 **
4 **      Copyright (C) 1994,95 Bernardo Innocenti
5 **
6 **      Definitions for the FastTracker ][ XM format.
7 */
8
9
10
11 struct FT2Header
12 {
13         UBYTE   ID[17];                 /* ID text: "Extended module: "                         */
14         UBYTE   Name[20];               /* Module name, padded with zeroes                      */
15         UBYTE   Dummy;                  /* Constant: $1a                                                        */
16         UBYTE   Tracker[20];    /* Tracker name                                                         */
17         UBYTE   Revision;               /* minor version number ($03)                           */
18         UBYTE   Version;                /* major version number ($01)                           */
19         ULONG   HeaderSize;             /* sizeof (struct FT2Header)                            */
20         UWORD   Length;                 /* Song length (in patten order table)          */
21         UWORD   Restart;                /* Restart position                                                     */
22         UWORD   Channels;               /* Number of channels (2,4,6,8,10,...,32)       */
23         UWORD   NumPatt;                /* Number of patterns (max 256)                         */
24         UWORD   NumInstr;               /* Number of instruments (max 128)                      */
25         UWORD   Flags;                  /* See below...                                                         */
26         UWORD   DefTempo;               /* Default tempo                                                        */
27         UWORD   DefBPM;                 /* Default BeatsPerMinute                                       */
28         /* Followed by patterns order table */
29 };
30
31
32
33 struct FT2Pattern
34 {
35         ULONG   Size;                                   /* Header size, sizeof (FT2Pattern)     */
36         UBYTE   Packing;                                /* Packing type (always 0)                      */
37
38         /* Two words at odd offsetts! Argh!!! */
39         UBYTE   RowsL, RowsH;                   /* Number of rows in pattern            */
40         UBYTE   PackSizeL, PackSizeH;   /* Packed patterndata size                      */
41
42         /* Packed pattern data follows, but this structure's size is
43          * variable!  Check FT2Pattern->Size to find out...
44          */
45 };
46
47
48
49 struct FT2Instrument
50 {
51         ULONG   Size;                   /* Instrument size                                                      */
52         UBYTE   Name[22];               /* Instrument name                                                      */
53         UBYTE   Type;                   /* Instrument type (always 0)                           */
54
55         /* Yet another time: words at odd offsetts! */
56         UBYTE   SamplesL;               /* If the number of samples > 0,                        */
57         UBYTE   SamplesH;               /*  then an FT2Sample structure will follow     */
58 };
59
60
61
62 struct FT2InstExt
63 {
64         ULONG   Size;                   /* Sample size                                                          */
65         UBYTE   Number[96];             /* Sample number for all notes                          */
66         UBYTE   VolEnv[48];             /* Points for volume envelope                           */
67         UBYTE   PanEnv[48];             /* Points for panning envelope                          */
68         UBYTE   VolCount;               /* Number of volume points                                      */
69         UBYTE   PanCount;               /* Number of panning points                                     */
70         UBYTE   VolSustain;             /* Volume sustain point                                         */
71         UBYTE   VolLoopStart;   /* Volume loop start point                                      */
72         UBYTE   VolLoopEnd;             /* Volume loop end point                                        */
73         UBYTE   PanSustain;             /* Panning sustain point                                        */
74         UBYTE   PanLoopStart;   /* Panning loop start point                                     */
75         UBYTE   PanLoopEnd;             /* Panning loop end point                                       */
76         UBYTE   VolType;                /* Volume type: bit 0:On; 1:Sustain; 2:Loop     */
77         UBYTE   PanType;                /* Panning type: bit 0:On; 1:Sustain; 2:Loop*/
78         UBYTE   VibType;                /* Vibrato type                                                         */
79         UBYTE   VibSweep;               /* Vibrato sweep                                                        */
80         UBYTE   VibDepth;               /* Vibrato depth                                                        */
81         UBYTE   VibRate;                /* Vibrato rate                                                         */
82         UBYTE   VolFadeoutL;
83         UBYTE   VolFadeoutH;
84         UBYTE   ReservedL;
85         UBYTE   ReservedH;
86 };
87
88
89
90 struct FT2Sample
91 {
92         ULONG   Length;                 /* Sample length                        */
93         ULONG   Repeat;                 /* Sample loop start            */
94         ULONG   Replen;                 /* Sample loop length           */
95         UBYTE   Volume;
96         BYTE    Finetune;               /* (signed byte -16..+15)       */
97         UBYTE   Type;                   /* See below...                         */
98         UBYTE   Panning;                /* Panning (0-255)                      */
99         BYTE    RelNote;                /* Relative note number         */
100         UBYTE   Reserved;
101         UBYTE   Name[22];
102 };
103
104
105
106 /* Flags for FT2Sample->Type */
107
108 #define STYP_LOOPMASK   3       /* bits 0-1                             */
109 #define STYPF_FWDLOOP   1       /* Forward loop                 */
110 #define STYPF_PINGLOOP  2       /* Ping-Pong loop               */
111 #define STYPF_16BIT             16      /* 16-bit sampledata    */
112