Mercurial > hg > dmlib
annotate viewmod.c @ 300:4972ca91d062
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 11 Oct 2012 17:55:15 +0300 |
parents | 245b15cd1919 |
children |
rev | line source |
---|---|
0 | 1 /* |
2 * viewmod - View information about given module file | |
3 * Programmed and designed by Matti 'ccr' Hamalainen | |
4 * (C) Copyright 2006-2007 Tecnic Software productions (TNSP) | |
5 * | |
6 * Please read file 'COPYING' for information on license and distribution. | |
7 */ | |
8 #include "jss.h" | |
9 #include "jssmod.h" | |
10 #include <errno.h> | |
11 #include <string.h> | |
12 #include "dmargs.h" | |
285
245b15cd1919
Don't link libSDL uselessly to utilities that do not actually use it.
Matti Hamalainen <ccr@tnsp.org>
parents:
152
diff
changeset
|
13 #include "dmmutex.h" |
0 | 14 |
15 | |
16 char *optFilename = NULL; | |
17 BOOL optViewPatterns = FALSE, | |
18 optViewInstruments = FALSE, | |
19 optViewExtInstruments = FALSE, | |
20 optViewGeneralInfo = FALSE; | |
21 | |
22 | |
23 DMOptArg optList[] = | |
24 { | |
25 { 0, '?', "help", "Show this help and exit", OPT_NONE }, | |
26 { 1, 'p', "patterns", "View patterns", OPT_NONE }, | |
27 { 2, 'i', "instruments", "View instruments", OPT_NONE }, | |
28 { 5, 'e', "extinstruments", "View extended instruments", OPT_NONE }, | |
29 { 3, 'g', "general", "General information", OPT_NONE }, | |
30 { 4, 'v', "verbose", "Be more verbose", OPT_NONE }, | |
31 }; | |
32 | |
33 const int optListN = sizeof(optList) / sizeof(optList[0]); | |
34 | |
35 | |
36 void argShowHelp() | |
37 { | |
38 dmPrintBanner(stdout, dmProgName, "[options] [modfile]"); | |
39 dmArgsPrintHelp(stdout, optList, optListN); | |
40 } | |
41 | |
42 | |
43 BOOL argHandleOpt(const int optN, char *optArg, char *currArg) | |
44 { | |
45 (void) optArg; | |
46 | |
47 switch (optN) | |
48 { | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
49 case 0: |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
50 argShowHelp(); |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
51 exit(0); |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
52 break; |
0 | 53 |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
54 case 1: |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
55 optViewPatterns = TRUE; |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
56 break; |
0 | 57 |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
58 case 2: |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
59 optViewInstruments = TRUE; |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
60 break; |
0 | 61 |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
62 case 3: |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
63 optViewGeneralInfo = TRUE; |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
64 break; |
0 | 65 |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
66 case 4: |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
67 dmVerbosity++; |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
68 break; |
0 | 69 |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
70 case 5: |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
71 optViewExtInstruments = TRUE; |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
72 break; |
0 | 73 |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
74 default: |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
75 dmError("Unknown argument '%s'.\n", currArg); |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
76 return FALSE; |
0 | 77 } |
78 | |
79 return TRUE; | |
80 } | |
81 | |
82 | |
83 BOOL argHandleFile(char *currArg) | |
84 { | |
85 // Was not option argument | |
86 if (!optFilename) | |
87 optFilename = currArg; | |
88 else { | |
89 dmError("Gay error '%s'!\n", currArg); | |
90 return FALSE; | |
91 } | |
92 | |
93 return TRUE; | |
94 } | |
95 | |
96 | |
97 const char patNoteTable[12][3] = | |
98 { | |
99 "C-", "C#", "D-", | |
100 "D#", "E-", "F-", | |
101 "F#", "G-", "G#", | |
102 "A-", "A#", "B-" | |
103 }; | |
104 | |
105 #define jmpNMODEffectTable (36) | |
106 static const char jmpMODEffectTable[jmpNMODEffectTable] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
107 | |
108 | |
109 /* Print a given pattern | |
110 */ | |
111 void printPattern(FILE *f, JSSPattern *p) | |
112 { | |
113 int i, j; | |
114 char c; | |
115 JSSNote *n; | |
116 | |
117 if (!p) | |
118 return; | |
119 | |
120 n = p->data; | |
121 | |
122 for (i = 0; i < p->nrows; i++) | |
123 { | |
124 fprintf(f, "%.2x: ", i); | |
125 | |
126 for (j = 0; j < p->nchannels; j++) | |
127 { | |
128 switch (n->note) | |
129 { | |
130 case jsetNotSet: | |
131 fprintf(f, "... "); | |
132 break; | |
133 case jsetNoteOff: | |
134 fprintf(f, "=== "); | |
135 break; | |
136 default: | |
137 fprintf(f, "%s%i ", patNoteTable[n->note % 12], n->note / 12); | |
138 break; | |
139 } | |
140 | |
141 if (n->instrument != jsetNotSet) | |
142 fprintf(f, "%.2x ", n->instrument + 1); // Because FT2 is 1-based and we use 0 internally | |
143 else | |
144 fprintf(f, ".. "); | |
145 | |
146 if (n->volume == jsetNotSet) | |
147 fprintf(f, ".. "); | |
148 else if (n->volume >= 0x00 && n->volume <= 0x40) | |
149 fprintf(f, "%.2x ", n->volume); | |
150 else | |
151 { | |
152 switch (n->volume & 0xf0) | |
153 { | |
154 case 0x50: c = '-'; break; | |
155 case 0x60: c = '+'; break; | |
156 case 0x70: c = '/'; break; | |
157 case 0x80: c = '\\'; break; | |
158 case 0x90: c = 'S'; break; | |
159 case 0xa0: c = 'V'; break; | |
160 case 0xb0: c = 'P'; break; | |
161 case 0xc0: c = '<'; break; | |
162 case 0xd0: c = '>'; break; | |
163 case 0xe0: c = 'M'; break; | |
164 default: c = '?'; break; | |
165 } | |
166 fprintf(f, "%c%x ", c, (n->volume & 0x0f)); | |
167 } | |
168 | |
169 if (n->effect >= 0 && n->effect < jmpNMODEffectTable) | |
170 fprintf(f, "%c", jmpMODEffectTable[n->effect]); | |
171 else if (n->effect == jsetNotSet) | |
172 fprintf(f, "."); | |
173 else | |
174 fprintf(f, "?"); | |
175 | |
176 if (n->param != jsetNotSet) | |
177 fprintf(f, "%.2x|", n->param); | |
178 else | |
179 fprintf(f, "..|"); | |
180 | |
181 n++; | |
182 } | |
183 | |
184 fprintf(f, "\n"); | |
185 } | |
186 } | |
187 | |
188 | |
189 /* | |
190 * Print given extended instrument | |
191 */ | |
192 void printEnvelope(FILE *f, JSSEnvelope *e, char *s) | |
193 { | |
194 int i; | |
195 | |
196 fprintf(f, | |
197 "\t%s-envelope:\n" | |
198 "\t - flags.....: %.4x", s, e->flags); | |
199 | |
200 if (e->flags & jenvfUsed) | |
201 fprintf(f, " [used]"); | |
202 if (e->flags & jenvfSustain) | |
203 fprintf(f, " [sust]"); | |
204 if (e->flags & jenvfLooped) | |
205 fprintf(f, " [loop]"); | |
206 | |
207 fprintf(f, "\n" | |
208 "\t - npoints...: %i\n" | |
209 "\t - sustain...: %i\n" | |
210 "\t - loopS.....: %i\n" | |
211 "\t - loopE.....: %i\n", | |
212 e->npoints, e->sustain, e->loopS, e->loopE); | |
213 | |
214 if (dmVerbosity >= 2) | |
215 { | |
216 fprintf(f, "\t - Points....:"); | |
217 for (i = 0; i < e->npoints; i++) | |
218 { | |
219 fprintf(f, " [%i:%i]", | |
220 e->points[i].frame, e->points[i].value); | |
221 } | |
222 | |
223 fprintf(f, "\n"); | |
224 } | |
225 } | |
226 | |
227 | |
228 void printExtInstrument(FILE *f, JSSExtInstrument *i) | |
229 { | |
230 if (!i) | |
231 { | |
232 fprintf(f, "\n"); | |
233 return; | |
234 } | |
235 | |
236 #ifndef JSS_LIGHT | |
237 if (i->desc) | |
238 fprintf(f, | |
239 "Description: '%s'\n", i->desc); | |
240 #endif | |
241 fprintf(f, | |
242 "nsamples.......: %i\n" | |
243 "vibratoType....: %i\n" | |
244 "vibratoSweep...: %i\n" | |
245 "vibratoDepth...: %i\n" | |
246 "vibratoRate....: %i\n" | |
247 "fadeOut........: %i\n", | |
248 i->nsamples, i->vibratoType, i->vibratoSweep, | |
249 i->vibratoDepth, i->vibratoRate, i->fadeOut); | |
250 | |
251 if (dmVerbosity >= 1) | |
252 { | |
253 printEnvelope(f, &i->volumeEnv, "Volume"); | |
254 printEnvelope(f, &i->panningEnv, "Panning"); | |
255 } | |
256 fprintf(f, "\n"); | |
257 } | |
258 | |
259 | |
260 void printInstrument(FILE *f, JSSInstrument *i) | |
261 { | |
262 if (!i) | |
263 { | |
264 fprintf(f, "\n"); | |
265 return; | |
266 } | |
267 | |
268 if (dmVerbosity >= 1) | |
269 { | |
270 #ifndef JSS_LIGHT | |
271 if (i->desc) | |
272 fprintf(f, "Description: '%s'\n", i->desc); | |
273 #endif | |
274 fprintf(f, | |
275 "size...........: %ld (0x%lx)\n" | |
276 "loopStart......: %ld (0x%lx)\n" | |
277 "loopEnd........: %ld (0x%lx)\n" | |
278 "volume.........: %d (0x%x)\n" | |
279 "flags..........: 0x%x ", | |
280 (unsigned long) i->size, (unsigned long) i->size, | |
281 (unsigned long) i->loopS, (unsigned long) i->loopE, | |
282 (unsigned long) i->loopS, (unsigned long) i->loopE, | |
283 i->volume, i->volume, | |
284 i->flags); | |
285 | |
286 if (i->flags & jsfLooped) fprintf(f, "[loop] "); | |
287 if (i->flags & jsfBiDi) fprintf(f, "[bi-di] "); | |
288 if (i->flags & jsf16bit) fprintf(f, "[16bit] "); | |
289 | |
290 fprintf(f, | |
291 "\nC4BaseSpeed....: %d (0x%x)\n" | |
292 "ERelNote.......: %d (%s%d)\n" | |
293 "EFineTune......: %d\n" | |
294 "EPanning,,,....: %d (0x%x)\n\n", | |
295 i->C4BaseSpeed, i->C4BaseSpeed, | |
296 i->ERelNote, patNoteTable[(48 + i->ERelNote) % 12], (48 + i->ERelNote) / 12, | |
297 i->EFineTune, i->EPanning, i->EPanning); | |
298 } | |
299 else | |
300 { | |
301 #ifndef JSS_LIGHT | |
302 if (i->desc) | |
303 fprintf(f, "'%s', ", i->desc); | |
304 #endif | |
305 fprintf(f, | |
306 "s=%ld (%lx), l=%ld-%ld (%lx-%lx), v=%i (%x), f=0x%x, c4=%i (%x), rn=%i (%s%i), ft=%i, pn=%i (%x)\n", | |
307 (unsigned long) i->size, (unsigned long) i->size, | |
308 (unsigned long) i->loopS, (unsigned long) i->loopE, | |
309 (unsigned long) i->loopS, (unsigned long) i->loopE, | |
310 i->volume, i->volume, i->flags, i->C4BaseSpeed, | |
311 i->C4BaseSpeed, i->ERelNote, | |
312 patNoteTable[(48 + i->ERelNote) % 12], | |
313 (48 + i->ERelNote) / 12, i->EFineTune, | |
314 i->EPanning, i->EPanning); | |
315 } | |
316 } | |
317 | |
318 | |
319 void printGeneralInfo(FILE *f, JSSModule *m) | |
320 { | |
321 int i; | |
322 | |
323 if (!m) | |
324 return; | |
325 | |
326 fprintf(f, "Module type.....: %i\n", m->moduleType); | |
327 #ifndef JSS_LIGHT | |
328 if (m->moduleName) | |
329 fprintf(f, "Module name.....: '%s'\n", m->moduleName); | |
330 if (m->trackerName) | |
331 fprintf(f, "Tracker name....: '%s'\n", m->trackerName); | |
332 #endif | |
333 fprintf(f, | |
334 "Speed...........: %d ticks\n" | |
335 "Tempo...........: %d bpm\n" | |
336 "Flags...........: %x ", | |
337 m->defSpeed, m->defTempo, m->defFlags); | |
338 | |
339 if (m->defFlags & jmdfAmigaPeriods) fprintf(f, "[Amiga periods] "); | |
340 if (m->defFlags & jmdfAmigaLimits) fprintf(f, "[Amiga limits] "); | |
341 if (m->defFlags & jmdfStereo) fprintf(f, "[stereo] "); | |
342 if (m->defFlags & jmdfFT2Replay) fprintf(f, "[FT2 replay] "); | |
343 if (m->defFlags & jmdfST300Slides) fprintf(f, "[ST300 slides] "); | |
344 if (m->defFlags & jmdfByteLStart) fprintf(f, "[ByteStart] "); | |
345 | |
346 fprintf(f, "\n" | |
347 "Restart pos.....: %d (order)\n" | |
348 "IntVersion......: %x\n" | |
349 "Channels........: %d\n" | |
350 "Instruments.....: %d\n" | |
351 "Ext.instruments.: %d\n" | |
352 "Patterns........: %d\n" | |
353 "Orders..........: %d\n", | |
354 m->defRestartPos, m->intVersion, m->nchannels, | |
355 m->ninstruments, m->nextInstruments, m->npatterns, | |
356 m->norders); | |
357 | |
358 if (dmVerbosity >= 1) | |
359 { | |
360 fprintf(f, "Orderlist: "); | |
361 for (i = 0; i < m->norders - 1; i++) | |
362 fprintf(f, "%d, ", m->orderList[i]); | |
363 if (i < m->norders) | |
364 fprintf(f, "%d", m->orderList[i]); | |
365 fprintf(f, "\n"); | |
366 } | |
367 } | |
368 | |
369 | |
370 | |
371 int main(int argc, char *argv[]) | |
372 { | |
373 int result = -1, i; | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
374 DMResource *file; |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
375 JSSModule *mod; |
0 | 376 |
377 dmInitProg("viewmod", "miniJSS Module Viewer", "0.4", NULL, NULL); | |
378 dmVerbosity = 0; | |
379 | |
380 // Parse arguments | |
381 if (!dmArgsProcess(argc, argv, optList, optListN, | |
382 argHandleOpt, argHandleFile, TRUE)) | |
383 exit(1); | |
384 | |
385 // Initialize miniJSS | |
386 jssInit(); | |
387 | |
388 // Open the file | |
389 dmMsg(1, "Reading module file '%s'\n", optFilename); | |
390 if (optFilename == NULL) | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
391 file = dmf_create_stdio_stream(stdin); |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
392 else if ((file = dmf_create_stdio(optFilename, "rb")) == NULL) |
0 | 393 { |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
394 dmError("Error opening input file '%s'. (%s)\n", |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
395 optFilename, strerror(errno)); |
0 | 396 return 1; |
397 } | |
398 | |
399 // Read module file | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
400 dmMsg(1, "Reading file: %s\n", optFilename); |
0 | 401 #ifdef JSS_SUP_XM |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
402 dmMsg(1, "* Trying XM...\n"); |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
403 result = jssLoadXM(file, &mod); |
0 | 404 #endif |
405 #ifdef JSS_SUP_JSSMOD | |
406 if (result != 0) | |
407 { | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
408 size_t bufgot, bufsize = dmfsize(file); |
0 | 409 Uint8 *buf = dmMalloc(bufsize); |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
410 dmfseek(file, 0L, SEEK_SET); |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
411 dmMsg(1, "* Trying JSSMOD (%d bytes, %p)...\n", bufsize, buf); |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
412 if ((bufgot = dmfread(buf, 1, bufsize, file)) != bufsize) |
0 | 413 { |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
414 dmError("Error reading file (not enough data %d), #%d: %s\n", |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
415 bufgot, dmferror(file), dmErrorStr(dmferror(file))); |
0 | 416 return 2; |
417 } | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
418 result = jssLoadJSSMOD(buf, bufsize, &mod); |
0 | 419 dmFree(buf); |
420 } | |
421 #endif | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
422 dmf_close(file); |
8
fc097f7717df
Fix JSSMod loading in viewmod and testpl.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
423 if (result != DMERR_OK) |
0 | 424 { |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
425 dmError("Error loading module file, %d: %s\n", |
8
fc097f7717df
Fix JSSMod loading in viewmod and testpl.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
426 result, dmErrorStr(result)); |
0 | 427 return 3; |
428 } | |
429 | |
430 // Print out information | |
431 if (optViewGeneralInfo) | |
79
d6c2efa25aa4
Oops, missed one s/m/mod/ .. fixed.
Matti Hamalainen <ccr@tnsp.org>
parents:
77
diff
changeset
|
432 printGeneralInfo(stdout, mod); |
0 | 433 |
434 if (optViewPatterns) | |
435 { | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
436 for (i = 0; i < mod->npatterns; i++) |
0 | 437 { |
438 printf("\nPattern #%03i:\n", i); | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
439 printPattern(stdout, mod->patterns[i]); |
0 | 440 } |
441 } | |
442 | |
443 if (optViewExtInstruments) | |
444 { | |
445 printf("\n" | |
446 "ExtInstruments:\n" | |
447 "---------------\n" | |
448 ); | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
449 for (i = 0; i < mod->nextInstruments; i++) |
0 | 450 { |
152
c56f85a32912
Correct the displayed instrument numbers.
Matti Hamalainen <ccr@tnsp.org>
parents:
79
diff
changeset
|
451 printf("#%03i: ", i + 1); |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
452 printExtInstrument(stdout, mod->extInstruments[i]); |
0 | 453 } |
454 } | |
455 | |
456 if (optViewInstruments) | |
457 { | |
458 printf("\n" | |
459 "Instruments:\n" | |
460 "------------\n" | |
461 ); | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
462 for (i = 0; i < mod->ninstruments; i++) |
0 | 463 { |
152
c56f85a32912
Correct the displayed instrument numbers.
Matti Hamalainen <ccr@tnsp.org>
parents:
79
diff
changeset
|
464 printf("#%03i: ", i + 1); |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
465 printInstrument(stdout, mod->instruments[i]); |
0 | 466 } |
467 } | |
468 | |
469 // Free module data | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
470 jssFreeModule(mod); |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
471 jssClose(); |
0 | 472 |
473 exit(0); | |
474 return 0; | |
475 } |