From faf54384e9fff24e30bfb1e2c705f07525e33ea7 Mon Sep 17 00:00:00 2001 From: Claudio Matsuoka Date: Sat, 11 Jun 2016 20:28:26 -0300 Subject: [PATCH] Display current mixer type There was a bug in the library that was preventing this to work. We fixed that, but now we require at least libxmp a3b8005. Signed-off-by: Claudio Matsuoka --- src/commands.c | 14 +++++++++++++- src/common.h | 1 + src/info.c | 30 ++++++++++++++++++++++++------ src/main.c | 6 ++++-- 4 files changed, 42 insertions(+), 9 deletions(-) diff --git a/src/commands.c b/src/commands.c index 684c1f8..675b0c3 100644 --- a/src/commands.c +++ b/src/commands.c @@ -186,8 +186,20 @@ void read_command(xmp_context handle, struct xmp_module_info *mi, struct control ctl->loop %= 3; break; case 'x': { - int f = xmp_get_player(handle, XMP_PLAYER_FLAGS); + int f; + ctl->classic = !ctl->classic; + + f = xmp_get_player(handle, XMP_PLAYER_FLAGS); + if (ctl->classic) { + xmp_set_player(handle, XMP_PLAYER_FLAGS, + f | XMP_FLAGS_CLASSIC); + } else { + xmp_set_player(handle, XMP_PLAYER_FLAGS, + f &= ~XMP_FLAGS_CLASSIC); + } + + f = xmp_get_player(handle, XMP_PLAYER_CFLAGS); if (ctl->classic) { xmp_set_player(handle, XMP_PLAYER_CFLAGS, f | XMP_FLAGS_CLASSIC); diff --git a/src/common.h b/src/common.h index 61267df..7b6ab70 100644 --- a/src/common.h +++ b/src/common.h @@ -69,6 +69,7 @@ struct control { int explore; /* Play all sequences */ int cur_seq; /* Display current sequence */ int classic; /* Toggle classic mode */ + int mixer_type; /* Mixer type (from player) */ }; extern struct player_mode pmode[]; diff --git a/src/info.c b/src/info.c index 0a8ed49..d0470de 100644 --- a/src/info.c +++ b/src/info.c @@ -134,6 +134,7 @@ void info_frame(struct xmp_module_info *mi, struct xmp_frame_info *fi, struct co static int ord = -1, spd = -1, bpm = -1; char rowstr[3], numrowstr[3]; int time; + char x; if (fi->virt_used > max_channels) max_channels = fi->virt_used; @@ -143,16 +144,34 @@ void info_frame(struct xmp_module_info *mi, struct xmp_frame_info *fi, struct co time = fi->time / 100; + /* Show mixer type */ + x = ' '; + if (ctl->classic) { + switch (ctl->mixer_type) { + case XMP_MIXER_STANDARD: + x = 's'; + break; + case XMP_MIXER_A500: + x = 'A'; + break; + case XMP_MIXER_A500F: + x = 'F'; + break; + default: + x = 'x'; + } + } + if (msg_timer > 0) { report("\r%-61.61s %c%c%c", msg_text, ctl->explore ? 'Z' : ' ', - ctl->loop ? 'L' : ' ', - ctl->loop > 1 ? '*' : ' '); + ctl->loop ? 'L' : ' ', x); msg_timer -= fi->frame_time * fi->speed / 6; - if (msg_timer == 0) + if (msg_timer == 0) { msg_timer--; - else + } else { goto print_time; + } } if (msg_timer < 0) { @@ -186,8 +205,7 @@ void info_frame(struct xmp_module_info *mi, struct xmp_frame_info *fi, struct co report("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" "%2.2s/%2.2s] Chn[%02X/%02X] %c%c%c", rowstr, numrowstr, fi->virt_used, max_channels, - ctl->explore ? 'Z' : ' ', ctl->loop ? 'L' : ' ', - ctl->classic ? 'X' : ' '); + ctl->explore ? 'Z' : ' ', ctl->loop ? 'L' : ' ', x); print_time: diff --git a/src/main.c b/src/main.c index d4b1cc7..4bb0278 100644 --- a/src/main.c +++ b/src/main.c @@ -155,9 +155,9 @@ static void check_pause(xmp_context xc, struct control *ctl, usleep(100000); read_command(xc, mi, ctl); if (ctl->display) { - int mode = xmp_get_player(xc, XMP_PLAYER_MODE); - show_info(ctl->display, mi, mode); if (verbose) { + int mode = xmp_get_player(xc, XMP_PLAYER_MODE); + show_info(ctl->display, mi, mode); info_frame(mi, fi, ctl, 1); } ctl->display = 0; @@ -475,6 +475,8 @@ int main(int argc, char **argv) int old_loop = fi.loop_count; xmp_get_frame_info(xc, &fi); + control.mixer_type = xmp_get_player( + xc, XMP_PLAYER_MIXER_TYPE); /* Check loop */