annotate playercode/load_uni.c @ 14:6218f9885552

Clean up the Makefile
author darius
date Thu, 23 Apr 1998 07:21:28 +0000
parents 5d614bcc4287
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
1 /*
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
2
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
3 Name: LOAD_UNI.C
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
4
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
5 Description:
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
6 UNIMOD (mikmod's internal format) module loader.
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
7 Currently only supports UniMOD 06 - the internal format for MikMod 3.0.
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
8
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
9 Portability:
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
10 All systems - all compilers (hopefully)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
11
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
12 */
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
13
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
14 #include <string.h>
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
15 #include "mikmod.h"
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
16
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
17
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
18 BOOL UNI_Test(void)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
19 {
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
20 UBYTE id[4];
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
21
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
22 _mm_read_UBYTES(id,4,modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
23 if(!memcmp(id, "UN06", 4)) return 1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
24
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
25 return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
26 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
27
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
28
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
29 BOOL UNI_Init(void)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
30 {
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
31 return 1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
32 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
33
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
34
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
35 void UNI_Cleanup(void)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
36 {
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
37 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
38
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
39
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
40 UBYTE *TrkRead(void)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
41 {
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
42 UBYTE *t;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
43 UWORD len;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
44
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
45 len = _mm_read_M_UWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
46 t = (UBYTE *)malloc(len);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
47 _mm_read_UBYTES(t,len,modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
48
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
49 return t;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
50 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
51
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
52
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
53 BOOL UNI_Load(void)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
54 {
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
55 int t,v,w;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
56 INSTRUMENT *i;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
57 SAMPLE *s;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
58
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
59 // UNI format version 3.0 (#6)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
60
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
61 of.modtype = strdup("MikMod UniFormat 3.0");
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
62
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
63 _mm_fseek(modfp,5,SEEK_SET); // skip the header
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
64
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
65 of.flags = _mm_read_M_UWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
66 of.numchn = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
67 of.numvoices = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
68 of.numpos = _mm_read_M_UWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
69 of.numpat = _mm_read_M_UWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
70 of.numtrk = _mm_read_M_UWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
71 of.numins = _mm_read_M_UWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
72 of.numsmp = _mm_read_M_UWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
73 of.reppos = _mm_read_M_UWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
74 of.initspeed = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
75 of.inittempo = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
76 of.initvolume = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
77
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
78 if(feof(modfp))
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
79 { _mm_errno = MMERR_LOADING_HEADER;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
80 return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
81 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
82
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
83 of.songname = StringRead(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
84 of.composer = StringRead(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
85 of.comment = StringRead(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
86
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
87 if(feof(modfp))
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
88 { _mm_errno = MMERR_LOADING_HEADER;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
89 return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
90 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
91
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
92 if(!AllocSamples()) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
93 if(!AllocTracks()) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
94 if(!AllocPatterns()) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
95 if(!AllocPositions(of.numpos)) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
96
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
97 _mm_read_UBYTES(of.positions,of.numpos,modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
98 _mm_read_M_UWORDS(of.panning,of.numchn,modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
99 _mm_read_UBYTES(of.chanvol,of.numchn,modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
100
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
101
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
102 // Load sample headers
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
103
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
104 s = of.samples;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
105 for(v=0; v<of.numsmp; v++, s++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
106 { s->flags = _mm_read_M_UWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
107 s->speed = _mm_read_M_ULONG(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
108 s->volume = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
109 s->panning = _mm_read_M_UWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
110 s->length = _mm_read_M_ULONG(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
111 s->loopstart = _mm_read_M_ULONG(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
112 s->loopend = _mm_read_M_ULONG(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
113 s->susbegin = _mm_read_M_ULONG(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
114 s->susend = _mm_read_M_ULONG(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
115
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
116 s->globvol = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
117 s->vibflags = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
118 s->vibtype = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
119 s->vibsweep = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
120 s->vibdepth = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
121 s->vibrate = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
122 s->samplename = StringRead(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
123
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
124 if(feof(modfp))
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
125 { _mm_errno = MMERR_LOADING_HEADER;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
126 return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
127 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
128 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
129
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
130 // Load instruments
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
131
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
132 if(of.flags & UF_INST)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
133 { if(!AllocInstruments()) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
134 i = of.instruments;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
135
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
136 for(v=0; v<of.numins; v++, i++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
137 { i->flags = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
138 i->nnatype = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
139 i->dca = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
140 i->dct = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
141 i->globvol = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
142 i->panning = _mm_read_M_UWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
143 i->pitpansep = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
144 i->pitpancenter = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
145 i->rvolvar = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
146 i->rpanvar = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
147
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
148 i->volfade = _mm_read_M_UWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
149
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
150 i->volflg = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
151 i->volpts = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
152 i->volsusbeg = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
153 i->volsusend = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
154 i->volbeg = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
155 i->volend = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
156
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
157 for(w=0; w<i->volpts; w++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
158 { i->volenv[w].pos = _mm_read_M_SWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
159 i->volenv[w].val = _mm_read_M_SWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
160 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
161
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
162 i->panflg = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
163 i->panpts = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
164 i->pansusbeg = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
165 i->pansusend = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
166 i->panbeg = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
167 i->panend = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
168
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
169 for(w=0; w<i->panpts; w++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
170 { i->panenv[w].pos = _mm_read_M_SWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
171 i->panenv[w].val = _mm_read_M_SWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
172 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
173
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
174 i->pitflg = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
175 i->pitpts = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
176 i->pitsusbeg = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
177 i->pitsusend = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
178 i->pitbeg = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
179 i->pitend = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
180
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
181 for(w=0; w<i->pitpts; w++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
182 { i->pitenv[w].pos = _mm_read_M_SWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
183 i->pitenv[w].val = _mm_read_M_SWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
184 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
185
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
186 _mm_read_UBYTES(i->samplenumber, 120, modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
187 _mm_read_UBYTES(i->samplenote, 120, modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
188
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
189 i->insname = StringRead(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
190
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
191 if(feof(modfp))
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
192 { _mm_errno = MMERR_LOADING_HEADER;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
193 return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
194 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
195 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
196 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
197
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
198 // Read patterns
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
199
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
200 _mm_read_M_UWORDS(of.pattrows,of.numpat,modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
201 _mm_read_M_UWORDS(of.patterns,of.numpat*of.numchn,modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
202
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
203 // Read tracks
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
204
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
205 for(t=0; t<of.numtrk; t++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
206 of.tracks[t] = TrkRead();
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
207
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
208 return 1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
209 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
210
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
211
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
212 CHAR *UNI_LoadTitle(void)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
213 {
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
214 _mm_fseek(modfp,24,SEEK_SET);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
215 return(StringRead(modfp));
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
216 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
217
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
218
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
219 MLOADER load_uni =
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
220 { NULL,
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
221 "UNI",
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
222 "Portable UniFormat 3.0 Loader",
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
223 UNI_Init,
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
224 UNI_Test,
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
225 UNI_Load,
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
226 UNI_Cleanup,
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
227 UNI_LoadTitle
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
228 };
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
229