Add option to play hidden sequences

Add command-line option -z to specify a pattern sequence to play. The
main sequence is 0.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
master
Claudio Matsuoka 13 years ago
parent 8413998e18
commit 1efba54ff6
  1. 1
      src/common.h
  2. 4
      src/info.c
  3. 9
      src/main.c
  4. 7
      src/options.c
  5. 4
      src/xmp.1

@ -25,6 +25,7 @@ struct options {
int nocmd; /* disable interactive commands */ int nocmd; /* disable interactive commands */
int norc; /* don't read the configuration files */ int norc; /* don't read the configuration files */
int dparm; /* driver parameter index */ int dparm; /* driver parameter index */
int sequence; /* sequence to play */
char *driver_id; /* sound driver ID */ char *driver_id; /* sound driver ID */
char *out_file; /* output file name */ char *out_file; /* output file name */
char *ins_path; /* instrument path */ char *ins_path; /* instrument path */

@ -78,9 +78,9 @@ void info_mod(struct xmp_module_info *mi)
} }
report(" %dmin%02ds " report(" %dmin%02ds "
"(sequence at position %d)\n", "(sequence %d at position %d)\n",
(dur + 500) / 60000, ((dur + 500) / 1000) % 60, (dur + 500) / 60000, ((dur + 500) / 1000) % 60,
mi->seq_data[i].entry_point); i, mi->seq_data[i].entry_point);
} }
} else { } else {
report("\n"); report("\n");

@ -332,6 +332,15 @@ int main(int argc, char **argv)
control.time = 0.0; control.time = 0.0;
control.loop = opt.loop; control.loop = opt.loop;
if (opt.sequence) {
if (opt.sequence < mi.num_sequences) {
if (mi.seq_data[opt.sequence].duration > 0) {
opt.start = mi.seq_data[opt.sequence].entry_point;
}
}
opt.sequence = 0;
}
if (xmp_start_player(xc, opt.rate, opt.format) == 0) { if (xmp_start_player(xc, opt.rate, opt.format) == 0) {
xmp_set_player(xc, XMP_PLAYER_INTERP, opt.interp); xmp_set_player(xc, XMP_PLAYER_INTERP, opt.interp);
xmp_set_player(xc, XMP_PLAYER_DSP, opt.dsp); xmp_set_player(xc, XMP_PLAYER_DSP, opt.dsp);

@ -74,6 +74,7 @@ static void usage(char *s)
" -s --start num Start from the specified order\n" " -s --start num Start from the specified order\n"
" -t --time num Maximum playing time in seconds\n" " -t --time num Maximum playing time in seconds\n"
" --vblank Force vblank timing in Amiga modules\n" " --vblank Force vblank timing in Amiga modules\n"
" -z --sequence num Play the specified sequence (0=main)\n"
"\nMixer options:\n" "\nMixer options:\n"
" -a --amplify {0|1|2|3} Amplification factor: 0=Normal, 1=x2, 2=x4, 3=x8\n" " -a --amplify {0|1|2|3} Amplification factor: 0=Normal, 1=x2, 2=x4, 3=x8\n"
" -b --bits {8|16} Software mixer resolution (8 or 16 bits)\n" " -b --bits {8|16} Software mixer resolution (8 or 16 bits)\n"
@ -134,6 +135,7 @@ static const struct option lopt[] = {
{ "vblank", 0, 0, OPT_VBLANK }, { "vblank", 0, 0, OPT_VBLANK },
{ "version", 0, 0, 'V' }, { "version", 0, 0, 'V' },
{ "verbose", 0, 0, 'v' }, { "verbose", 0, 0, 'v' },
{ "sequence", 1, 0, 'z' },
{ NULL, 0, 0, 0 } { NULL, 0, 0, 0 }
}; };
@ -142,7 +144,7 @@ void get_options(int argc, char **argv, struct options *options)
int optidx = 0; int optidx = 0;
int o; int o;
#define OPTIONS "a:b:cD:d:Ff:hI:i:LlM:mNo:P:qRrS:s:T:t:uVv" #define OPTIONS "a:b:cD:d:Ff:hI:i:LlM:mNo:P:qRrS:s:T:t:uVvz:"
while ((o = getopt_long(argc, argv, OPTIONS, lopt, &optidx)) != -1) { while ((o = getopt_long(argc, argv, OPTIONS, lopt, &optidx)) != -1) {
switch (o) { switch (o) {
case 'a': case 'a':
@ -291,6 +293,9 @@ void get_options(int argc, char **argv, struct options *options)
case 'v': case 'v':
options->verbose++; options->verbose++;
break; break;
case 'z':
options->sequence = strtoul(optarg, NULL, 0);
break;
case 'h': case 'h':
usage(argv[0]); usage(argv[0]);
default: default:

@ -36,6 +36,7 @@ xmp - Extended Module Player
[\fB--vblank\fP] [\fB--vblank\fP]
[\fB-V, --version\fP] [\fB-V, --version\fP]
[\fB-v, --verbose\fP] [\fB-v, --verbose\fP]
[\fB-z, --sequence\fP]
\fImodules\fP \fImodules\fP
.PP .PP
.SH "DESCRIPTION" .SH "DESCRIPTION"
@ -123,6 +124,9 @@ Print version information\&.
Verbose mode (incremental)\&. If specified more than once, the Verbose mode (incremental)\&. If specified more than once, the
verbosity level will be increased (no messages will be displayed verbosity level will be increased (no messages will be displayed
when the player runs in background)\&. when the player runs in background)\&.
.IP "\fB-z, --sequence\fP \fInum\fP"
Play hidden or alternative pattern sequence \fInum\fP\ (0 is the main
sequence)\&.
.PP .PP
.SH "DEVICE DRIVER PARAMETERS" .SH "DEVICE DRIVER PARAMETERS"
Use the option \fB-D\fP to send parameters directly to the device Use the option \fB-D\fP to send parameters directly to the device

Loading…
Cancel
Save