diff --git a/src/common.h b/src/common.h index 2b2b124..d0939b9 100644 --- a/src/common.h +++ b/src/common.h @@ -48,12 +48,12 @@ int set_tty(void); int reset_tty(void); /* info */ -void info_mod(struct xmp_frame_info *); -void info_frame_init(struct xmp_frame_info *); -void info_frame(struct xmp_frame_info *, struct control *, int); -void info_ins_smp(struct xmp_frame_info *); -void info_instruments(struct xmp_frame_info *); -void info_samples(struct xmp_frame_info *); +void info_mod(struct xmp_module_info *); +void info_frame_init(void); +void info_frame(struct xmp_module_info *, struct xmp_frame_info *, struct control *, int); +void info_ins_smp(struct xmp_module_info *); +void info_instruments(struct xmp_module_info *); +void info_samples(struct xmp_module_info *); void info_help(void); /* commands */ diff --git a/src/info.c b/src/info.c index b5a92c3..51abe95 100644 --- a/src/info.c +++ b/src/info.c @@ -25,42 +25,45 @@ void info_help(void) ); } -void info_mod(struct xmp_frame_info *fi) +void info_mod(struct xmp_module_info *mi) { int i; int num_seq; - - report("Module name : %s\n", fi->mod->name); - report("Module type : %s\n", fi->mod->type); - report("Module length: %d patterns\n", fi->mod->len); - report("Patterns : %d\n", fi->mod->pat); - report("Instruments : %d\n", fi->mod->ins); - report("Samples : %d\n", fi->mod->smp); - report("Channels : %d [ ", fi->mod->chn); - - for (i = 0; i < fi->mod->chn; i++) { - if (fi->mod->xxc[i].flg & XMP_CHANNEL_SYNTH) { + int total_time; + + report("Module name : %s\n", mi->mod->name); + report("Module type : %s\n", mi->mod->type); + report("Module length: %d patterns\n", mi->mod->len); + report("Patterns : %d\n", mi->mod->pat); + report("Instruments : %d\n", mi->mod->ins); + report("Samples : %d\n", mi->mod->smp); + report("Channels : %d [ ", mi->mod->chn); + + for (i = 0; i < mi->mod->chn; i++) { + if (mi->mod->xxc[i].flg & XMP_CHANNEL_SYNTH) { report("S "); } else { - report("%x ", fi->mod->xxc[i].pan >> 4); + report("%x ", mi->mod->xxc[i].pan >> 4); } } report("]\n"); - report("Duration : %dmin%02ds", (fi->total_time + 500) / 60000, - ((fi->total_time + 500) / 1000) % 60); + total_time = mi->seq_data[0].duration; + + report("Duration : %dmin%02ds", (total_time + 500) / 60000, + ((total_time + 500) / 1000) % 60); /* Check non-zero-length sequences */ num_seq = 0; - for (i = 0; i < fi->num_sequences; i++) { - if (fi->seq_data[i].duration > 0) + for (i = 0; i < mi->num_sequences; i++) { + if (mi->seq_data[i].duration > 0) num_seq++; } if (num_seq > 1) { report(" (main sequence)\n"); - for (i = 1; i < fi->num_sequences; i++) { - int dur = fi->seq_data[i].duration; + for (i = 1; i < mi->num_sequences; i++) { + int dur = mi->seq_data[i].duration; if (dur == 0) { continue; @@ -69,19 +72,19 @@ void info_mod(struct xmp_frame_info *fi) report(" %dmin%02ds " "(sequence at position %d)\n", (dur + 500) / 60000, ((dur + 500) / 1000) % 60, - fi->seq_data[i].entry_point); + mi->seq_data[i].entry_point); } } else { report("\n"); } } -void info_frame_init(struct xmp_frame_info *fi) +void info_frame_init() { max_channels = 0; } -void info_frame(struct xmp_frame_info *fi, struct control *ctl, int reprint) +void info_frame(struct xmp_module_info *mi, struct xmp_frame_info *fi, struct control *ctl, int reprint) { static int ord = -1, spd = -1, bpm = -1; int time; @@ -98,8 +101,8 @@ void info_frame(struct xmp_frame_info *fi, struct control *ctl, int reprint) report("\rSpeed[%02X] BPM[%02X] Pos[%02X/%02X] " "Pat[%02X/%02X] Row[ / ] Chn[ / ] 0:00:00.0", fi->speed, fi->bpm, - fi->pos, fi->mod->len - 1, - fi->pattern, fi->mod->pat - 1); + fi->pos, mi->mod->len - 1, + fi->pattern, mi->mod->pat - 1); ord = fi->pos; bpm = fi->bpm; spd = fi->speed; @@ -121,10 +124,10 @@ void info_frame(struct xmp_frame_info *fi, struct control *ctl, int reprint) fflush(stdout); } -void info_ins_smp(struct xmp_frame_info *fi) +void info_ins_smp(struct xmp_module_info *mi) { int i, j; - struct xmp_module *mod = fi->mod; + struct xmp_module *mod = mi->mod; report("Instruments and samples:\n"); report(" Instrument name Smp Size Loop End Vol Fine Xpo Pan\n"); @@ -170,10 +173,10 @@ void info_ins_smp(struct xmp_frame_info *fi) } } -void info_instruments(struct xmp_frame_info *fi) +void info_instruments(struct xmp_module_info *mi) { int i, j; - struct xmp_module *mod = fi->mod; + struct xmp_module *mod = mi->mod; report("Instruments:\n"); report(" Instrument name Vl Fade Env Ns Sub Gv Vl Fine Xpo Pan Sm\n"); @@ -220,10 +223,10 @@ void info_instruments(struct xmp_frame_info *fi) } } -void info_samples(struct xmp_frame_info *fi) +void info_samples(struct xmp_module_info *mi) { int i; - struct xmp_module *mod = fi->mod; + struct xmp_module *mod = mi->mod; report("Samples:\n"); report(" Sample name Length Start End Flags\n"); diff --git a/src/main.c b/src/main.c index 2fc69d1..8d2d0ad 100644 --- a/src/main.c +++ b/src/main.c @@ -84,7 +84,7 @@ static void sigcont_handler(int sig) } #endif -static void show_info(int what, struct xmp_frame_info *fi) +static void show_info(int what, struct xmp_module_info *mi) { report("\r%78.78s\n", " "); switch (what) { @@ -92,16 +92,16 @@ static void show_info(int what, struct xmp_frame_info *fi) info_help(); break; case 'i': - info_ins_smp(fi); + info_ins_smp(mi); break; case 'I': - info_instruments(fi); + info_instruments(mi); break; case 'S': - info_samples(fi); + info_samples(mi); break; case 'm': - info_mod(fi); + info_mod(mi); break; } } @@ -120,20 +120,20 @@ static void shuffle(int argc, char **argv) } static void check_pause(xmp_context handle, struct control *ctl, - struct xmp_frame_info *fi, int verbose) + struct xmp_module_info *mi, struct xmp_frame_info *fi, int verbose) { if (ctl->pause) { sound->pause(); if (verbose) { - info_frame(fi, ctl, 1); + info_frame(mi, fi, ctl, 1); } while (ctl->pause) { usleep(100000); read_command(handle, ctl); if (ctl->display) { - show_info(ctl->display, fi); + show_info(ctl->display, mi); if (verbose) { - info_frame(fi, ctl, 1); + info_frame(mi, fi, ctl, 1); } ctl->display = 0; } @@ -145,6 +145,7 @@ static void check_pause(xmp_context handle, struct control *ctl, int main(int argc, char **argv) { xmp_context handle; + struct xmp_module_info mi; struct xmp_frame_info fi; struct options options; struct control control; @@ -330,20 +331,21 @@ int main(int argc, char **argv) /* Show module data */ - xmp_get_frame_info(handle, &fi); + xmp_get_module_info(handle, &mi); if (options.verbose > 0) { - info_mod(&fi); + info_mod(&mi); } if (options.verbose > 1) { - info_instruments(&fi); + info_instruments(&mi); } /* Play module */ refresh_status = 1; - info_frame_init(&fi); + info_frame_init(); + fi.loop_count = 0; while (!options.info && xmp_play_frame(handle) == 0) { int old_loop = fi.loop_count; @@ -352,7 +354,7 @@ int main(int argc, char **argv) break; if (!background && options.verbose > 0) { - info_frame(&fi, &control, refresh_status); + info_frame(&mi, &fi, &control, refresh_status); refresh_status = 0; } @@ -364,7 +366,7 @@ int main(int argc, char **argv) read_command(handle, &control); if (control.display) { - show_info(control.display, &fi); + show_info(control.display, &mi); control.display = 0; refresh_status = 1; } @@ -375,7 +377,7 @@ int main(int argc, char **argv) break; } - check_pause(handle, &control, &fi, + check_pause(handle, &control, &mi, &fi, options.verbose); options.start = 0;