In particular, fiddling with the fallback gain level, and tuning the
audio conversion quality.
+
+static const char *const dithers[] = {
+ "none", "rpdf", "tpdf", "tpdf-hf", 0
+};
+
+static const char *const shapes[] = {
+ "none", "error-feedback", "simple", "medium", "high", 0
+};
+
+static int dither = -1;
+static int shape = -1;
+static gdouble fallback = 0.0;
static struct stream_header hdr;
static struct stream_header hdr;
g_object_set(source, "location", file, END);
g_object_set(sink, "sync", FALSE, END);
g_object_set(source, "location", file, END);
g_object_set(sink, "sync", FALSE, END);
+ /* Configure the converter. Leave things as their defaults if the user
+ * hasn't made an explicit request.
+ */
+ if(dither >= 0) g_object_set(convert, "dithering", dither, END);
+ if(shape >= 0) g_object_set(convert, "noise-shaping", shape, END);
+
/* Set up the sink's capabilities. */
for(i = 0; i < N(widths); i++) {
c = gst_caps_new_simple("audio/x-raw-int",
/* Set up the sink's capabilities. */
for(i = 0; i < N(widths); i++) {
c = gst_caps_new_simple("audio/x-raw-int",
*/
if(mode != OFF) {
gain = gst_element_factory_make("rgvolume", "gain");
*/
if(mode != OFF) {
gain = gst_element_factory_make("rgvolume", "gain");
- g_object_set(gain, "album-mode", mode == ALBUM, END);
+ g_object_set(gain,
+ "album-mode", mode == ALBUM,
+ "fallback-gain", fallback,
+ END);
gst_bin_add(GST_BIN(pipeline), gain);
link_elements(gain, tail); tail = gain;
}
gst_bin_add(GST_BIN(pipeline), gain);
link_elements(gain, tail); tail = gain;
}
disorder_fatal(0, "unknown %s `%s'", what, s);
}
disorder_fatal(0, "unknown %s `%s'", what, s);
}
+static double getfloat(const char *what, const char *s)
+{
+ double d;
+ char *q;
+
+ errno = 0;
+ d = strtod(s, &q);
+ if(*q || errno) disorder_fatal(0, "invalid %s `%s'", what, s);
+ return d;
+}
+
static const struct option options[] = {
{ "help", no_argument, 0, 'h' },
{ "version", no_argument, 0, 'V' },
static const struct option options[] = {
{ "help", no_argument, 0, 'h' },
{ "version", no_argument, 0, 'V' },
+ { "dither", required_argument, 0, 'd' },
+ { "fallback-gain", required_argument, 0, 'f' },
+ { "noise-shape", required_argument, 0, 'n' },
{ "replay-gain", required_argument, 0, 'r' },
{ 0, 0, 0, 0 }
};
{ "replay-gain", required_argument, 0, 'r' },
{ 0, 0, 0, 0 }
};
"Options:\n"
" --help, -h Display usage message\n"
" --version, -V Display version number\n"
"Options:\n"
" --help, -h Display usage message\n"
" --version, -V Display version number\n"
+ " --dither TYPE, -d TYPE TYPE is `none', `rpdf', `tpdf', or "
+ "`tpdf-hf'\n"
+ " --fallback-gain DB, -f DB For tracks without ReplayGain data\n"
+ " --noise-shape TYPE, -n TYPE TYPE is `none', `error-feedback',\n"
+ " `simple', `medium' or `high'\n"
" --replay-gain MODE, -r MODE MODE is `off', `track' or `album'\n"
"\n"
"Alternative audio decoder for DisOrder. Only intended to be\n"
" --replay-gain MODE, -r MODE MODE is `off', `track' or `album'\n"
"\n"
"Alternative audio decoder for DisOrder. Only intended to be\n"
if(!setlocale(LC_CTYPE, "")) disorder_fatal(errno, "calling setlocale");
/* Parse command line. */
if(!setlocale(LC_CTYPE, "")) disorder_fatal(errno, "calling setlocale");
/* Parse command line. */
- while((n = getopt_long(argc, argv, "hVr:", options, 0)) >= 0) {
+ while((n = getopt_long(argc, argv, "hVd:f:n:r:", options, 0)) >= 0) {
switch(n) {
case 'h': help();
case 'V': version("disorder-gstdecode");
switch(n) {
case 'h': help();
case 'V': version("disorder-gstdecode");
+ case 'd': dither = getenum("dither type", optarg, dithers); break;
+ case 'f': fallback = getfloat("fallback gain", optarg); break;
+ case 'n': shape = getenum("noise-shaping type", optarg, shapes); break;
case 'r': mode = getenum("ReplayGain mode", optarg, modes); break;
default: disorder_fatal(0, "invalid option");
}
case 'r': mode = getenum("ReplayGain mode", optarg, modes); break;
default: disorder_fatal(0, "invalid option");
}