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