From 30b6ffb8afae8aee5bfc2f92d704202635bc7f3b Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 7 May 2017 14:47:45 +0200 Subject: Add u8 format to FormatConverter This is compatible with some tools like welle.io that take u8 input --- src/DabMod.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/DabMod.cpp') diff --git a/src/DabMod.cpp b/src/DabMod.cpp index 4e4cdab..88c7524 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -197,8 +197,11 @@ static shared_ptr prepare_output( s.normalise = 1.0 / normalise_factor_file_var; output = make_shared(s.outputName); } - else if (s.fileOutputFormat == "s8") { + else if (s.fileOutputFormat == "s8" or + s.fileOutputFormat == "u8") { // We must normalise the samples to the interval [-127.0; 127.0] + // The formatconverter will add 127 for u8 so that it ends up in + // [0; 255] s.normalise = 127.0f / normalise_factor; output = make_shared(s.outputName); @@ -284,8 +287,10 @@ int launch_modulator(int argc, char* argv[]) modulator_data m; shared_ptr format_converter; - if (mod_settings.useFileOutput and mod_settings.fileOutputFormat == "s8") { - format_converter = make_shared(); + if (mod_settings.useFileOutput and + (mod_settings.fileOutputFormat == "s8" or + mod_settings.fileOutputFormat == "u8")) { + format_converter = make_shared(mod_settings.fileOutputFormat); } auto output = prepare_output(mod_settings); -- cgit v1.2.3