From 4acd98166a9d16c2ec5772f242527a39c32a35a6 Mon Sep 17 00:00:00 2001 From: Claudio Matsuoka Date: Wed, 6 Aug 2014 10:12:50 -0300 Subject: [PATCH] Add option to set the default pan amplitude Signed-off-by: Claudio Matsuoka --- Changelog | 3 +++ configure.ac | 2 +- src/common.h | 1 + src/main.c | 3 +++ src/options.c | 11 ++++++++++- src/xmp.1 | 8 ++++++-- 6 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Changelog b/Changelog index b60597d..25b72f3 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,9 @@ Stable versions --------------- +4.0.9: + - Add option '-p' to set the default pan amplitude + 4.0.8 (20140714): - Add command 'c' to display module comment - Add command-line option -C to display module comment diff --git a/configure.ac b/configure.ac index a07d466..5ed3223 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,7 @@ esac AC_PROG_INSTALL AM_INIT_AUTOMAKE([foreign subdir-objects tar-pax]) -PKG_CHECK_MODULES([libxmp], [libxmp >= 4.1]) +PKG_CHECK_MODULES([libxmp], [libxmp >= 4.3]) dnl Don't use things like /usr/etc or /usr/var diff --git a/src/common.h b/src/common.h index e9c1a77..36ea3f7 100644 --- a/src/common.h +++ b/src/common.h @@ -24,6 +24,7 @@ struct options { int format; /* sample format */ int max_time; /* max. replay time */ int mix; /* channel separation */ + int defpan; /* default pan */ int interp; /* interpolation type */ int dsp; /* dsp effects */ int loop; /* loop module */ diff --git a/src/main.c b/src/main.c index 2a6be15..f9bce51 100644 --- a/src/main.c +++ b/src/main.c @@ -221,6 +221,7 @@ int main(int argc, char **argv) opt.verbose = 1; opt.rate = 44100; opt.mix = -1; + opt.defpan = 100; opt.driver_id = NULL; opt.interp = XMP_INTERP_SPLINE; opt.dsp = XMP_DSP_LOWPASS; @@ -333,6 +334,8 @@ int main(int argc, char **argv) argv[optind], optind - first + 1, argc - first); } + xmp_set_player(xc, XMP_PLAYER_DEFPAN, opt.defpan); + /* load module */ val = xmp_load_module(xc, argv[optind]); diff --git a/src/options.c b/src/options.c index 86554e6..cc6e0c4 100644 --- a/src/options.c +++ b/src/options.c @@ -90,6 +90,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" +" -p --default-pan Percentual default pan setting\n" " -r --reverse Reverse left/right stereo channels\n" " -u --unsigned Set the mixer to use unsigned samples\n" "\nEnvironment options:\n" @@ -109,6 +110,7 @@ static const struct option lopt[] = { { "amplify", 1, 0, 'a' }, { "bits", 1, 0, 'b' }, { "driver", 1, 0, 'd' }, + { "default-pan", 1, 0, 'p' }, { "fix-sample-loops", 0, 0, OPT_FIXLOOP }, { "frequency", 1, 0, 'f' }, { "help", 0, 0, 'h' }, @@ -151,7 +153,7 @@ void get_options(int argc, char **argv, struct options *options) int optidx = 0; int o; -#define OPTIONS "a:b:CcD:d:Ff:hI:i:LlM:mNo:P:qRrS:s:T:t:uVvZz:" +#define OPTIONS "a:b:CcD:d:Ff:hI:i:LlM:mNo:P:p:qRrS:s:T:t:uVvZz:" while ((o = getopt_long(argc, argv, OPTIONS, lopt, &optidx)) != -1) { switch (o) { case 'a': @@ -249,6 +251,13 @@ void get_options(int argc, char **argv, struct options *options) if (options->mix > 100) options->mix = 100; break; + case 'p': + options->defpan = strtoul(optarg, NULL, 0); + if (options->defpan < 0) + options->defpan = 0; + if (options->defpan > 100) + options->defpan = 100; + break; case OPT_PROBEONLY: options->probeonly = 1; break; diff --git a/src/xmp.1 b/src/xmp.1 index ca1ceb2..6f7571e 100644 --- a/src/xmp.1 +++ b/src/xmp.1 @@ -1,4 +1,4 @@ -.TH "XMP" "1" "Version 4\&.0\&.8" "Jul 2014" "Extended Module Player" +.TH "XMP" "1" "Version 4\&.0\&.9" "Ago 2014" "Extended Module Player" .PP .SH "NAME" xmp - Extended Module Player @@ -27,7 +27,8 @@ xmp - Extended Module Player [\fB\-\-nocmd\fP] [\fB\-o, \-\-output\-file\fP \fIfilename\fP] [\fB\-\-offset\-bug\-emulation\fP] -[\fB\-P, \-\-pan\fP \fIpan\fP] +[\fB\-P, \-\-pan\fP \fInum\fP] +[\fB\-p, \-\-default\-pan\fP \fInum\fP] [\fB\-\-probe\-only\fP] [\fB\-q, \-\-quiet\fP] [\fB\-R, \-\-random\fP] @@ -107,6 +108,9 @@ given as the file name, the output will be sent to stdout\&. Emulate Protracker 2.x handling of effect 0x09 (set sample offset)\&. .IP "\fB\-P, \-\-pan\fP \fInum\fP" Set the percentual panning amplitude\&. +.IP "\fB\-P, \-\-default\-pan\fP \fInum\fP" +Set the percentual default pan setting for modules that don\'t set their +own pan values\&. Useful to reduce LRRL pan separation on headphones\&. .IP "\fB\-\-probe\-only\fP" Exit after probing the audio device\&. .IP "\fB\-R, \-\-random\fP"