summaryrefslogtreecommitdiffstats
path: root/src/DabMod.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-05-07 14:47:45 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-05-07 14:47:45 +0200
commit30b6ffb8afae8aee5bfc2f92d704202635bc7f3b (patch)
tree21828f314743e4ddf72b7fa58100889e5369ef0c /src/DabMod.cpp
parentbfce4874a0410f8f6521875d7e975f80d05544d4 (diff)
downloaddabmod-30b6ffb8afae8aee5bfc2f92d704202635bc7f3b.tar.gz
dabmod-30b6ffb8afae8aee5bfc2f92d704202635bc7f3b.tar.bz2
dabmod-30b6ffb8afae8aee5bfc2f92d704202635bc7f3b.zip
Add u8 format to FormatConverter
This is compatible with some tools like welle.io that take u8 input
Diffstat (limited to 'src/DabMod.cpp')
-rw-r--r--src/DabMod.cpp11
1 files changed, 8 insertions, 3 deletions
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<ModOutput> prepare_output(
s.normalise = 1.0 / normalise_factor_file_var;
output = make_shared<OutputFile>(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<OutputFile>(s.outputName);
@@ -284,8 +287,10 @@ int launch_modulator(int argc, char* argv[])
modulator_data m;
shared_ptr<FormatConverter> format_converter;
- if (mod_settings.useFileOutput and mod_settings.fileOutputFormat == "s8") {
- format_converter = make_shared<FormatConverter>();
+ if (mod_settings.useFileOutput and
+ (mod_settings.fileOutputFormat == "s8" or
+ mod_settings.fileOutputFormat == "u8")) {
+ format_converter = make_shared<FormatConverter>(mod_settings.fileOutputFormat);
}
auto output = prepare_output(mod_settings);