diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-03-20 14:59:34 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-03-20 15:02:10 +0100 |
commit | 676cc46f076efeaddba52a578345e189e4f8f53e (patch) | |
tree | 77f5cd517a3e84013b5e75e8c48ece766e8024a8 /src/FIRFilter.cpp | |
parent | 4422ab97c43e13735d274219a2957aae7ec60d76 (diff) | |
download | dabmod-676cc46f076efeaddba52a578345e189e4f8f53e.tar.gz dabmod-676cc46f076efeaddba52a578345e189e4f8f53e.tar.bz2 dabmod-676cc46f076efeaddba52a578345e189e4f8f53e.zip |
Replace a few fprintf calls by etiLog
Diffstat (limited to 'src/FIRFilter.cpp')
-rw-r--r-- | src/FIRFilter.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/FIRFilter.cpp b/src/FIRFilter.cpp index 96ad1b9..740d8ed 100644 --- a/src/FIRFilter.cpp +++ b/src/FIRFilter.cpp @@ -101,23 +101,21 @@ void FIRFilter::load_filter_taps(const std::string &tapsFile) } else { std::ifstream taps_fstream(tapsFile.c_str()); - if(!taps_fstream) { - fprintf(stderr, "FIRFilter: file %s could not be opened !\n", tapsFile.c_str()); - throw std::runtime_error("FIRFilter: Could not open file with taps! "); + if (!taps_fstream) { + throw std::runtime_error("FIRFilter: Could not open taps file " + tapsFile); } int n_taps; taps_fstream >> n_taps; if (n_taps <= 0) { - fprintf(stderr, "FIRFilter: warning: taps file has invalid format\n"); throw std::runtime_error("FIRFilter: taps file has invalid format."); } if (n_taps > 100) { - fprintf(stderr, "FIRFilter: warning: taps file has more than 100 taps\n"); + etiLog.level(warn) << "FIRFilter: warning: taps file has more than 100 taps"; } - fprintf(stderr, "FIRFilter: Reading %d taps...\n", n_taps); + etiLog.level(debug) << "FIRFilter: Reading " << n_taps << " taps..."; filter_taps.resize(n_taps); @@ -126,9 +124,11 @@ void FIRFilter::load_filter_taps(const std::string &tapsFile) taps_fstream >> filter_taps[n]; PDEBUG("FIRFilter: tap: %f\n", (double)filter_taps[n] ); if (taps_fstream.eof()) { - fprintf(stderr, "FIRFilter: file %s should contains %d taps, but EOF reached "\ - "after %d taps !\n", tapsFile.c_str(), n_taps, n); - throw std::runtime_error("FIRFilter: filtertaps file invalid ! "); + throw std::runtime_error( + "FIRFilter: file " + tapsFile + + " should contain " + to_string(n_taps) + + " taps, but EOF reached after " + to_string(n) + + " taps!"); } } } @@ -156,7 +156,6 @@ int FIRFilter::internal_process(Buffer* const dataIn, Buffer* dataOut) size_t sizeIn = dataIn->getLength() / sizeof(float); if ((uintptr_t)(&out[0]) % 16 != 0) { - fprintf(stderr, "FIRFilterWorker: out not aligned %p ", out); throw std::runtime_error("FIRFilterWorker: out not aligned"); } |