-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
spc2ittypes.h
155 lines (136 loc) · 3.31 KB
/
spc2ittypes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/****************************************************
*Part of SPC2IT, read readme.md for more information*
****************************************************/
#ifndef SPC2ITTYPES_H
#define SPC2ITTYPES_H
#include <stdint.h>
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;
typedef double f64;
typedef s16 pcm_t;
#define OneKB (1024)
#define Mem64k (OneKB * 64)
typedef struct
{
char magic[4]; // IMPM
char songName[26];
u16 PHiligt; // Pattern row hilight stuff
u16 OrderNumber; // Number of orders in song
u16 InstrumentNumber; // Number of instruments
u16 SampleNumber; // Number of samples
u16 PatternNumber; // Number of patterns
u16 TrackerCreatorVersion; // The version of the tracker that created the IT file
u16 TrackerFormatVersion; // Format version
u16 Flags; // Information flags
u16 Special; // Special st0ff
u8 GlobalVolume; // Global volume
u8 MixVolume; // Mix volume
u8 InitialSpeed; // Initial speed
u8 InitialTempo; // Initial tempo
u8 PanningSeperation; // Panning separation between channels
u8 PitchWheelDepth; // Pitch wheel depth for MIDI controllers
u16 MessageLength; // Length of message if Bit 0 of Special is 1
u32 MessageOffset; // Offset of message if Bit 0 of Special is 1
u32 Reserved; // Reserved stuff
u8 ChannelPan[64]; // Channel pan
u8 ChannelVolume[64]; // Channel volume
} ITFileHeader;
typedef struct
{
char magic[4]; // IMPS
char fileName[13]; // 8.3 DOS filename (including null termating)
u8 GlobalVolume; // Global volume for sample
u8 Flags;
u8 Volume; // Default volume
char SampleName[26];
u8 Convert;
u8 DefaultPan;
u32 NumberOfSamples; // not bytes! in samples!
u32 LoopBeginning; // not bytes! in samples!
u32 LoopEnd; // not bytes! in samples!
u32 C5Speed; // Num of bytes a second for C-5
u32 SustainLoopBeginning;
u32 SustainLoopEnd;
u32 SampleOffset; // the offset of the sample in file
u8 VibratoSpeed;
u8 VibratoDepth;
u8 VibratoRate;
u8 VibratoType;
} ITFileSample;
typedef struct
{
u16 Length;
u16 Rows;
u8 Padding[4];
} ITFilePattern;
typedef struct
{
u8 PC[2]; // Don't change this to u16, because of the way structs work, that will misalign the struct with the file!
u8 A;
u8 X;
u8 Y;
u8 PSW;
u8 SP;
u8 Reserved[2];
} SPCFileRegisters;
typedef struct
{
char SongTitle[32];
char GameTitle[32];
char DumperName[16];
char Comment[32];
char Date[11];
char SongLength[3];
char FadeLength[5];
char Artist[32];
u8 ChannelDisabled;
u8 EmulatorDumpedWith; //0 unknown, 1 ZSNES, 2 Snes9x
u8 Reserved[45];
} SPCFileInformation;
typedef struct
{
char FileTag[33]; // SNES-SPC700 Sound File Data v0.30
u8 FileTagTerminator[2]; // 0x1A, 0x1A
u8 ContainsID666; // 0x1A for contains ID666, 0x1B for no ID666
u8 Version; //Version minor (30)
SPCFileRegisters Registers; // 9bytes
SPCFileInformation Information; // 163bytes
u8 RAM[65536];
u8 DSPBuffer[128];
} SPCFile;
typedef struct
{
u8 Channel;
u8 Mask;
u8 Note;
u8 Sample;
u8 Volume;
u8 Command;
u8 CommandValue;
} ITPatternInfo;
typedef struct
{
s32 mask, pitch, lvol, rvol;
u8 note;
} itdata;
typedef struct
{
s32 length;
s32 loopto;
s16 *buf;
s32 freq;
} sndsamp;
typedef struct
{
s32 ave;
u32 envx, envcyc;
s32 envstate;
u32 ar, dr, sl, sr, gn;
} sndvoice;
#endif