Implement reverse stereo option

The previous stable release of the player (xmp 3.5.0) had option -r
to reverse stereo channels. This option was temporarily removed during
libification to simplify the code base.

Reverse channels option was reimplemented by simply accepting negative
mixing parameters.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
master
Claudio Matsuoka 14 years ago
parent fa3fd5d8f7
commit 405842e0d4
  1. 1
      src/common.h
  2. 13
      src/main.c
  3. 7
      src/options.c

@ -14,6 +14,7 @@ struct options {
int dsp; /* dsp effects */
int loop; /* loop module */
int random; /* play in random order */
int reverse; /* reverse stereo channels */
int verbose;
int silent; /* silent output */
int info; /* display information and exit */

@ -261,10 +261,6 @@ int main(int argc, char **argv)
setenv("XMP_INSTRUMENT_PATH", options.ins_path, 1);
}
if (options.mix >= 0) {
xmp_mixer_set(handle, XMP_MIXER_MIX, options.mix);
}
lf_flag = 0;
for (first = optind; optind < argc; optind++) {
if (options.verbose > 0) {
@ -315,6 +311,15 @@ int main(int argc, char **argv)
xmp_mixer_set(handle, XMP_MIXER_INTERP, options.interp);
xmp_mixer_set(handle, XMP_MIXER_DSP, options.dsp);
if (options.mix >= 0) {
xmp_mixer_set(handle, XMP_MIXER_MIX, options.mix);
}
if (options.reverse) {
int mix = xmp_mixer_get(handle, XMP_MIXER_MIX);
xmp_mixer_set(handle, XMP_MIXER_MIX, -mix);
}
xmp_set_position(handle, options.start);
/* Mute channels */

@ -83,6 +83,7 @@ static void usage(char *s)
" -F --nofilter Disable IT lowpass filters\n"
" -o --output-file name Mix the module to file ('-' for stdout)\n"
" -P --pan pan Percentual pan separation\n"
" -r --reverse Reverse left/right stereo channels\n"
" -u --unsigned Set the mixer to use unsigned samples\n"
"\nEnvironment options:\n"
" -I --instrument-path Set pathname to external samples\n"
@ -117,6 +118,7 @@ static struct option lopt[] = {
{ "load-only", 0, 0, OPT_LOADONLY },
{ "quiet", 0, 0, 'q' },
{ "random", 0, 0, 'R' },
{ "reverse", 0, 0, 'r' },
{ "solo", 1, 0, 'S' },
{ "start", 1, 0, 's' },
{ "stdout", 0, 0, 'c' },
@ -133,7 +135,7 @@ void get_options(int argc, char **argv, struct options *options)
int optidx = 0;
int o;
#define OPTIONS "a:b:cD:d:Ff:hI:i:LlM:mNo:P:qRS:s:T:t:uVv"
#define OPTIONS "a:b:cD:d:Ff:hI:i:LlM:mNo:P:qRrS:s:T:t:uVv"
while ((o = getopt_long(argc, argv, OPTIONS, lopt, &optidx)) != -1) {
switch (o) {
case 'a':
@ -225,6 +227,9 @@ void get_options(int argc, char **argv, struct options *options)
case 'R':
options->random = 1;
break;
case 'r':
options->reverse = 1;
break;
case 'M':
case 'S':
if (o == 'S') {

Loading…
Cancel
Save