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