Initial commit.
[amiga/xmodule.git] / include / libraries / xmoduleclass.h
1 #ifndef LIBRARIES_XMODULECLASS_H
2 #define LIBRARIES_XMODULECLASS_H
3 /*
4 **      XModuleClass.h
5 **
6 **      Copyright (C) 1993,94,95,96,97 Bernardo Innocenti
7 **
8 **      Use 4 chars wide TABs to read this file
9 **
10 **      IFF XMOD file format definition.
11 */
12
13
14 #ifndef IFF_IFFPARSE_H
15 #include <libraries/iffparse.h>
16 #endif  /* !IFF_IFFPARSE_H */
17
18 #ifndef DATATYPES_SOUNDCLASS_H
19 #include <datatypes/soundclass.h>
20 #endif /* !DATATYPES_SOUNDCLASS_H */
21
22
23 #define ID_AUTH MAKE_ID('A','U','T','H')
24 #define ID_ANNO MAKE_ID('A','N','N','O')
25
26 #define ID_XMOD MAKE_ID('X','M','O','D')
27
28 /* The following chunk ID definition conflicts with <libraries/maud.h> */
29 #ifndef ID_MHDR
30 #define ID_MHDR MAKE_ID('M','H','D','R')
31 #endif
32
33 #define ID_SONG MAKE_ID('S','O','N','G')
34 #define ID_SHDR MAKE_ID('S','H','D','R')
35 #define ID_SEQN MAKE_ID('S','E','Q','N')
36
37 #define ID_PATT MAKE_ID('P','A','T','T')
38 #define ID_PHDR MAKE_ID('P','H','D','R')
39
40 #define ID_INST MAKE_ID('I','N','S','T')
41
42
43 struct ModuleHeader
44 {
45         UWORD XModuleVersion;   /* XModule version used to save this file       */
46         UWORD XModuleRevision;  /* XModule revision used to save this file      */
47         UWORD NumSongs;                 /* Number of songs in this module                       */
48         UWORD ActiveSong;
49         UWORD MasterVolume;
50         UWORD MixingMode;
51         ULONG MixingRate;
52 };
53
54
55
56 struct SongHeader
57 {
58         UWORD   MaxTracks;              /* Number of tracks in song                     */
59         UWORD   Length;                 /* Number of positions in song          */
60         UWORD   NumPatterns;    /* Number of patterns in song           */
61         UWORD   LastInstrument; /* Last used instrument                         */
62         UWORD   GlobalSpeed;    /* Global song speed                            */
63         UWORD   GlobalTempo;    /* Global song tempo                            */
64         UWORD   RestartPos;             /* Position to restart from                     */
65         UWORD   CurrentPatt;
66         UWORD   CurrentLine;
67         UWORD   CurrentTrack;
68         UWORD   CurrentPos;
69         UWORD   CurrentInst;
70
71         /* New fields added in XModule version 3.5 -
72          * not present in modules saved by version 3.4 and below
73          */
74         UWORD   DefNumTracks;   /* Default number of tracks in new patterns     */
75         UWORD   DefPattLen;             /* Default number of lines in new patterns      */
76         ULONG   TotalChanges;   /* Total number of changes made so far          */
77         ULONG   CreationDate;   /* Date of OM_NEW                                                       */
78         ULONG   LastChanged;    /* Date of last saving                                          */
79 };
80
81
82
83 struct PatternHeader
84 {
85         UWORD   Tracks;                 /* Number of tracks in pattern          */
86         UWORD   Lines;                  /* Number of lines in pattern           */
87 };
88
89
90
91 #ifndef LIBRARIES_SONGCLASS_H
92
93 struct Note
94 {
95         UBYTE Note;                             /* See below for more info      */
96         UBYTE Inst;                             /* Instrument number            */
97         UBYTE Vol;                              /* Volume for this note         */
98         UBYTE Pad;                              /* Unused                                       */
99         UBYTE EffNum;                   /* See definitions below.       */
100         UBYTE EffVal;                   /* Effect value ($00-$FF)       */
101 };
102 /* Note values:
103  *
104  *  0  - no note
105  *  1  - C-0
106  *  2  - C#0
107  * ...
108  * 13  - C-1
109  * ...
110  * 72  - B-5
111  */
112
113
114 /* Values for Note->EffNum */
115
116 enum {
117         EFF_NULL,                               /* $00 */
118         EFF_PORTAMENTOUP,               /* $01 */
119         EFF_PORTAMENTODOWN,             /* $02 */
120         EFF_TONEPORTAMENTO,             /* $03 */
121         EFF_VIBRATO,                    /* $04 */
122         EFF_TONEPVOLSLIDE,              /* $05 */
123         EFF_VIBRATOVOLSLIDE,    /* $06 */
124         EFF_TREMOLO,                    /* $07 */
125         EFF_UNUSED,                             /* $08 */
126         EFF_SAMPLEOFFSET,               /* $09 */
127         EFF_VOLSLIDE,                   /* $0A */
128         EFF_POSJUMP,                    /* $0B */
129         EFF_SETVOLUME,                  /* $0C */
130         EFF_PATTERNBREAK,               /* $0D */
131         EFF_MISC,                               /* $0E */
132         EFF_SETSPEED,                   /* $0F */
133         EFF_SETTEMPO,                   /* $10 */
134         EFF_ARPEGGIO,                   /* $11 */
135
136         EFF_COUNT                               /* $12 */
137 };
138
139 #endif /* !LIBRARIES_SONGCLASS_H */
140
141
142
143 struct InstrumentHeader
144 {
145         WORD     Num;                   /* Instrument slot number                       */
146         UWORD    Type;                  /* Instrument type (see defs)           */
147         WORD     FineTune;              /* Instrument FineTune (-8..+7)         */
148 };
149
150
151
152 #ifndef LIBRARIES_SONGCLASS_H
153
154 /* Possible values for Instrument->InstType */
155 enum {
156         ITYPE_SAMPLE8,          /* signed 8bit sample                                   */
157         ITYPE_SAMPLE16,         /* TODO: signed 16bit sample                    */
158         ITYPE_SYNTH,            /* TODO: Synthetic instrument                   */
159         ITYPE_HYBRID,           /* TODO: Both Synth & Sample                    */
160         ITYPE_MIDI                      /* TODO: Played by external MIDI device */
161 };
162 #endif /* !LIBRARIES_SONGCLASS_H */
163
164 #endif /* !LIBRARIES_XMODULECLASS_H */