diff --git a/src/common.h b/src/common.h index a2cc83e..b5cb8f1 100644 --- a/src/common.h +++ b/src/common.h @@ -9,6 +9,7 @@ struct options { int loop; /* loop module */ int random; /* play in random order */ int load_only; /* load module and exit */ + int verbose; char *out_file; /* output file name */ char *ins_path; /* instrument path */ char mute[XMP_MAX_CHANNELS]; diff --git a/src/info.c b/src/info.c index 935585f..64d6dd6 100644 --- a/src/info.c +++ b/src/info.c @@ -1,4 +1,5 @@ #include +#include #include void info_mod(struct xmp_module_info *mi) @@ -61,3 +62,50 @@ void info_frame(struct xmp_module_info *mi, int reset) fflush(stdout); } + +void info_instruments_compact(struct xmp_module_info *mi) +{ + int i, j; + struct xmp_module *mod = mi->mod; + + printf("Instruments:\n"); + printf(" Instrument name Size Loop End Vol Fine Pan\n"); + for (i = 0; i < mod->ins; i++) { + struct xmp_instrument *ins = &mod->xxi[i]; + + if (strlen(ins->name) == 0 && ins->nsm == 0) { + continue; + } + + printf("%02x %-32.32s %02x ", i, ins->name, ins->nsm); + + for (j = 0; j < ins->nsm; j++) { + struct xmp_subinstrument *sub = &ins->sub[j]; + struct xmp_sample *smp = &mod->xxs[sub->sid]; + + if (j > 0) { + if (smp->len == 0) { + continue; + } + printf("%38.38s", " "); + } + + printf("%05x%c%05x %05x%c V%02x %+04d P%02x\n", + smp->len, + smp->flg & XMP_SAMPLE_16BIT ? '+' : ' ', + smp->lps, + smp->lpe, + smp->flg & XMP_SAMPLE_LOOP ? + smp->flg & XMP_SAMPLE_LOOP_BIDIR ? + 'B' : 'L' : ' ', + sub->vol, + sub->fin, + sub->pan); + } + + if (j == 0) { + printf("----- ----- ----- --- ---- ---\n"); + } + + } +} diff --git a/src/main.c b/src/main.c index c9ce849..df3571c 100644 --- a/src/main.c +++ b/src/main.c @@ -63,6 +63,8 @@ int main(int argc, char **argv) #endif memset(&options, 0, sizeof (struct options)); + options.verbose = 1; + get_options(argc, argv, &options); if (options.random) { @@ -107,7 +109,13 @@ int main(int argc, char **argv) xmp_player_get_info(ctx, &mi); - info_mod(&mi); + if (options.verbose > 0) { + info_mod(&mi); + } + if (options.verbose == 2) { + info_instruments_compact(&mi); + } + /* Play module */ diff --git a/src/options.c b/src/options.c index 4af3302..77cfc41 100644 --- a/src/options.c +++ b/src/options.c @@ -261,7 +261,7 @@ void get_options(int argc, char **argv, struct options *options) puts("Extended Module Player " VERSION); exit(0); case 'v': - //options->verbosity++; + options->verbose++; break; case 'h': usage(argv[0]);