From bd7755947b1c46f046cb9ddcff5bcfbf2d151fa1 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 4 Apr 2016 21:32:12 +0200 Subject: [PATCH] Add an option --flat-audio to start with almost all the audio processing turned off. --- flags.cpp | 4 ++++ flags.h | 1 + mixer.cpp | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/flags.cpp b/flags.cpp index f8fea01..7b20995 100644 --- a/flags.cpp +++ b/flags.cpp @@ -13,6 +13,7 @@ void parse_flags(int argc, char * const argv[]) { "theme", required_argument, 0, 't' }, { "va-display", required_argument, 0, 1000 }, { "http-uncompressed-video", no_argument, 0, 1001 }, + { "flat-audio", no_argument, 0, 1002 }, { 0, 0, 0, 0 } }; for ( ;; ) { @@ -35,6 +36,9 @@ void parse_flags(int argc, char * const argv[]) case 1001: global_flags.uncompressed_video_to_http = true; break; + case 1002: + global_flags.flat_audio = true; + break; default: fprintf(stderr, "Unknown option '%s'\n", argv[option_index]); exit(1); diff --git a/flags.h b/flags.h index f175591..24e5b32 100644 --- a/flags.h +++ b/flags.h @@ -8,6 +8,7 @@ struct Flags { std::string va_display; bool uncompressed_video_to_http = false; std::string theme_filename = "theme.lua"; + bool flat_audio = false; }; extern Flags global_flags; diff --git a/mixer.cpp b/mixer.cpp index 9565894..1f1035b 100644 --- a/mixer.cpp +++ b/mixer.cpp @@ -261,6 +261,14 @@ Mixer::Mixer(const QSurfaceFormat &format, unsigned num_cards) locut.init(FILTER_HPF, 2); + // If --flat-audio is given, turn off everything that messes with the sound, + // except the final makeup gain. + if (global_flags.flat_audio) { + set_locut_enabled(false); + set_limiter_enabled(false); + set_compressor_enabled(false); + } + // hlen=16 is pretty low quality, but we use quite a bit of CPU otherwise, // and there's a limit to how important the peak meter is. peak_resampler.setup(OUTPUT_FREQUENCY, OUTPUT_FREQUENCY * 4, /*num_channels=*/2, /*hlen=*/16, /*frel=*/1.0); -- 2.39.5