From 61828e7b7a3a14d119c1743c0cb03b646a847cfc Mon Sep 17 00:00:00 2001 From: Claudio Matsuoka Date: Thu, 11 Apr 2013 14:58:15 -0300 Subject: [PATCH] Add command to toggle subsong explorer Subsong explorer mode can be toggled using the 'z' command. A flag will appear in the status line showing that explorer mode is enabled. Signed-off-by: Claudio Matsuoka --- README | 1 + src/commands.c | 3 +++ src/common.h | 1 + src/info.c | 9 ++++++--- src/main.c | 3 ++- src/xmp.1 | 4 +++- 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/README b/README index a531831..d77968a 100644 --- a/README +++ b/README @@ -36,6 +36,7 @@ The following single key commands can be used during the playback: ! => unmute all channels ? => display available commands l => toggle loop mode + z => toggle subsong explorer mode m => display module information i => display combined instrument/sample list I => display instrument list diff --git a/src/commands.c b/src/commands.c index e8846d1..904c7c6 100644 --- a/src/commands.c +++ b/src/commands.c @@ -184,6 +184,9 @@ void read_command(xmp_context handle, struct xmp_module_info *mi, struct control case 'l': ctl->loop ^= 1; break; + case 'z': + ctl->explore ^= 1; + break; case ' ': /* paused module */ ctl->pause ^= 1; break; diff --git a/src/common.h b/src/common.h index dd35775..e464fdd 100644 --- a/src/common.h +++ b/src/common.h @@ -41,6 +41,7 @@ struct control { int pause; /* Replay paused */ int display; /* Info display flag */ int sequence; /* Current sequence */ + int explore; /* Play all sequences */ }; diff --git a/src/info.c b/src/info.c index 9ddb54a..42bc712 100644 --- a/src/info.c +++ b/src/info.c @@ -28,6 +28,7 @@ void info_help(void) " ! Unmute all channels\n" " ? Display available commands\n" " l Toggle loop mode\n" +" z Toggle subsong explorer mode\n" " m Display module information\n" " i Display combined instrument/sample list\n" " I Display instrument list\n" @@ -124,7 +125,9 @@ void info_frame(struct xmp_module_info *mi, struct xmp_frame_info *fi, struct co time = fi->time / 100; if (msg_timer > 0) { - report("\r%-61.61s %c ", msg_text, ctl->loop ? 'L' : ' '); + report("\r%-61.61s %c%c ", msg_text, + ctl->explore ? 'Z' : ' ', + ctl->loop ? 'L' : ' '); msg_timer -= fi->frame_time; if (msg_timer == 0) msg_timer--; @@ -149,9 +152,9 @@ 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" - "%02X/%02X] Chn[%02X/%02X] %c ", + "%02X/%02X] Chn[%02X/%02X] %c%c ", fi->row, fi->num_rows - 1, fi->virt_used, max_channels, - ctl->loop ? 'L' : ' '); + ctl->explore ? 'Z' : ' ', ctl->loop ? 'L' : ' '); print_time: diff --git a/src/main.c b/src/main.c index 42ebb51..850a4b3 100644 --- a/src/main.c +++ b/src/main.c @@ -331,6 +331,7 @@ int main(int argc, char **argv) skipprev = 0; control.time = 0.0; control.loop = opt.loop; + control.explore = opt.explore; if (opt.sequence) { if (opt.sequence < mi.num_sequences) { @@ -436,7 +437,7 @@ int main(int argc, char **argv) opt.start = 0; } - if (opt.explore && control.skip == 0) { + if (control.explore && control.skip == 0) { control.sequence++; if (control.sequence < mi.num_sequences) { xmp_set_position(xc, mi.seq_data diff --git a/src/xmp.1 b/src/xmp.1 index 88c8da5..978baf1 100644 --- a/src/xmp.1 +++ b/src/xmp.1 @@ -201,7 +201,9 @@ Unmute all channels\&. .IP "\fB?\fP" Display available commands\&. .IP "\fBl\fP" -Toggle module looping\&. +Toggle module/sequence looping\&. +.IP "\fBz\fP" +Toggle subsong explorer mode\&. .IP "\fBm\fP" Display module information\&. .IP "\fBi\fP"