diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-01-30 11:14:26 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-01-30 11:14:26 +0100 |
commit | c87e26649a69e21be1009ca07b015d84b6c2b713 (patch) | |
tree | 3d63b90e83f2795675ef07939b98c2599918b6ab /src/DabMod.cpp | |
parent | a1995ea7ffd6783a8445e72f12fcc92d09287c2b (diff) | |
download | dabmod-c87e26649a69e21be1009ca07b015d84b6c2b713.tar.gz dabmod-c87e26649a69e21be1009ca07b015d84b6c2b713.tar.bz2 dabmod-c87e26649a69e21be1009ca07b015d84b6c2b713.zip |
Print all startup settings at once to stderr
Diffstat (limited to 'src/DabMod.cpp')
-rw-r--r-- | src/DabMod.cpp | 70 |
1 files changed, 38 insertions, 32 deletions
diff --git a/src/DabMod.cpp b/src/DabMod.cpp index bf3de94..cca0ac1 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -111,57 +111,63 @@ static run_modulator_state_t run_modulator(modulator_data& m); static void printModSettings(const mod_settings_t& mod_settings) { + stringstream ss; // Print settings - fprintf(stderr, "Input\n"); - fprintf(stderr, " Type: %s\n", mod_settings.inputTransport.c_str()); - fprintf(stderr, " Source: %s\n", mod_settings.inputName.c_str()); - fprintf(stderr, "Output\n"); + ss << "Input\n"; + ss << " Type: " << mod_settings.inputTransport << "\n"; + ss << " Source: " << mod_settings.inputName << "\n"; + + ss << "Output\n"; if (mod_settings.useFileOutput) { - fprintf(stderr, " Name: %s\n", mod_settings.outputName.c_str()); + ss << " Name: " << mod_settings.outputName << "\n"; } #if defined(HAVE_OUTPUT_UHD) else if (mod_settings.useUHDOutput) { - fprintf(stderr, " UHD\n" - " Device: %s\n" - " Subdevice: %s\n" - " master_clock_rate: %ld\n" - " refclk: %s\n" - " pps source: %s\n", - mod_settings.sdr_device_config.device.c_str(), - mod_settings.sdr_device_config.subDevice.c_str(), - mod_settings.sdr_device_config.masterClockRate, - mod_settings.sdr_device_config.refclk_src.c_str(), - mod_settings.sdr_device_config.pps_src.c_str()); + ss << " UHD\n" << + " Device: " << mod_settings.sdr_device_config.device << "\n" << + " Subdevice: " << + mod_settings.sdr_device_config.subDevice << "\n" << + " master_clock_rate: " << + mod_settings.sdr_device_config.masterClockRate << "\n" << + " refclk: " << + mod_settings.sdr_device_config.refclk_src << "\n" << + " pps source: " << + mod_settings.sdr_device_config.pps_src << "\n"; } #endif #if defined(HAVE_SOAPYSDR) else if (mod_settings.useSoapyOutput) { - fprintf(stderr, " SoapySDR\n" - " Device: %s\n" - " master_clock_rate: %ld\n", - mod_settings.sdr_device_config.device.c_str(), - mod_settings.sdr_device_config.masterClockRate); + ss << " SoapySDR\n" + " Device: " << mod_settings.sdr_device_config.device << "\n" << + " master_clock_rate: " << + mod_settings.sdr_device_config.masterClockRate << "\n"; } #endif else if (mod_settings.useZeroMQOutput) { - fprintf(stderr, " ZeroMQ\n" - " Listening on: %s\n" - " Socket type : %s\n", - mod_settings.outputName.c_str(), - mod_settings.zmqOutputSocketType.c_str()); + ss << " ZeroMQ\n" << + " Listening on: " << mod_settings.outputName << "\n" << + " Socket type : " << mod_settings.zmqOutputSocketType << "\n"; } - fprintf(stderr, " Sampling rate: "); + ss << " Sampling rate: "; if (mod_settings.outputRate > 1000) { if (mod_settings.outputRate > 1000000) { - fprintf(stderr, "%.4g MHz\n", mod_settings.outputRate / 1000000.0); - } else { - fprintf(stderr, "%.4g kHz\n", mod_settings.outputRate / 1000.0); + ss << std::fixed << std::setprecision(4) << + mod_settings.outputRate / 1000000.0 << + " MHz\n"; + } + else { + ss << std::fixed << std::setprecision(4) << + mod_settings.outputRate / 1000.0 << + " kHz\n"; } - } else { - fprintf(stderr, "%zu Hz\n", mod_settings.outputRate); } + else { + ss << std::fixed << std::setprecision(4) << + mod_settings.outputRate << " Hz\n"; + } + fprintf(stderr, "%s", ss.str().c_str()); } static shared_ptr<ModOutput> prepare_output( |