From 19468232004a77c1fb6aead78396b2d4669536af Mon Sep 17 00:00:00 2001 From: bnnm Date: Sat, 1 Aug 2020 12:25:00 +0200 Subject: [PATCH] Add CLI -D for downmixing testing --- cli/vgmstream_cli.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/cli/vgmstream_cli.c b/cli/vgmstream_cli.c index 80f48e1b..2e866756 100644 --- a/cli/vgmstream_cli.c +++ b/cli/vgmstream_cli.c @@ -55,18 +55,20 @@ static void usage(const char* name, int is_full) { " -x: decode and print adxencd command line to encode as ADX\n" " -g: decode and print oggenc command line to encode as OGG\n" " -b: decode and print batch variable commands\n" - " -h: print extra commands\n" + " -h: print extra commands (for testing)\n" , name); - if (is_full) { - fprintf(stderr, - " -v: validate extensions (for extension testing)\n" - " -r: output a second file after resetting (for reset testing)\n" - " -k N: seeks to N samples before decoding (for seek testing)\n" - " -K N: seeks to N samples before decoding again (for seek testing)\n" - " -t file: print tags found in file (for tag testing)\n" - " -O: decode but don't write to file (for performance testing)\n" - ); - } + if (!is_full) + return; + fprintf(stderr, + " -v: validate extensions (for extension testing)\n" + " -r: output a second file after resetting (for reset testing)\n" + " -k N: seeks to N samples before decoding (for seek testing)\n" + " -K N: seeks again to N samples before decoding (for seek testing)\n" + " -t file: print tags found in file (for tag testing)\n" + " -D : downmix to (for plugin downmix testing)\n" + " -O: decode but don't write to file (for performance testing)\n" + ); + } @@ -98,6 +100,7 @@ typedef struct { int seek_samples1; int seek_samples2; int decode_only; + int downmix_channels; /* not quite config but eh */ int lwav_loop_start; @@ -119,7 +122,7 @@ static int parse_config(cli_config* cfg, int argc, char** argv) { opterr = 0; /* read config */ - while ((opt = getopt(argc, argv, "o:l:f:d:ipPcmxeLEFrgb2:s:t:k:K:hOv")) != -1) { + while ((opt = getopt(argc, argv, "o:l:f:d:ipPcmxeLEFrgb2:s:t:k:K:hOvD:")) != -1) { switch (opt) { case 'o': cfg->outfilename = optarg; @@ -194,6 +197,9 @@ static int parse_config(cli_config* cfg, int argc, char** argv) { case 'v': cfg->validate_extensions = 1; break; + case 'D': + cfg->downmix_channels = atoi(optarg); + break; case 'h': usage(argv[0], 1); goto fail; @@ -507,6 +513,8 @@ int main(int argc, char** argv) { input_channels = vgmstream->channels; /* enable after config but before outbuf */ + if (cfg.downmix_channels) + vgmstream_mixing_autodownmix(vgmstream, cfg.downmix_channels); vgmstream_mixing_enable(vgmstream, SAMPLE_BUFFER_SIZE, &input_channels, &channels); /* get final play config */