diff options
author | andreas128 <Andreas> | 2017-04-01 12:13:01 +0100 |
---|---|---|
committer | andreas128 <Andreas> | 2017-04-02 11:42:38 +0100 |
commit | 89ac4f53d0a10d1c07980fae5ddeb8818e7b9733 (patch) | |
tree | 01efcbbe06769e94e1a1acd3bc66299f01b30c2b | |
parent | 6243a4fac50a9c8690e13c2df65c058e69fdcae5 (diff) | |
download | dabmod-89ac4f53d0a10d1c07980fae5ddeb8818e7b9733.tar.gz dabmod-89ac4f53d0a10d1c07980fae5ddeb8818e7b9733.tar.bz2 dabmod-89ac4f53d0a10d1c07980fae5ddeb8818e7b9733.zip |
Fix file reading
-rw-r--r-- | src/ConfigParser.cpp | 6 | ||||
-rw-r--r-- | src/ConfigParser.h | 2 | ||||
-rw-r--r-- | src/DabMod.cpp | 6 | ||||
-rw-r--r-- | src/DabModulator.cpp | 26 | ||||
-rw-r--r-- | src/DabModulator.h | 4 | ||||
-rw-r--r-- | src/MemlessPoly.cpp | 1 | ||||
-rw-r--r-- | src/MemlessPoly.h | 4 |
7 files changed, 38 insertions, 11 deletions
diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp index 393f58a..b7649df 100644 --- a/src/ConfigParser.cpp +++ b/src/ConfigParser.cpp @@ -168,6 +168,12 @@ static void parse_configfile( pt.get<std::string>("firfilter.filtertapsfile", "default"); } + // Poly coefficients: + if (pt.get("poly.enabled", 0) == 1) { + mod_settings.polyCoefFilename = + pt.get<std::string>("poly.polycoeffile", "default"); + } + // Output options std::string output_selected; try { diff --git a/src/ConfigParser.h b/src/ConfigParser.h index 02b798a..fede801 100644 --- a/src/ConfigParser.h +++ b/src/ConfigParser.h @@ -74,6 +74,8 @@ struct mod_settings_t { std::string filterTapsFilename = ""; + std::string polyCoefFilename = ""; + #if defined(HAVE_OUTPUT_UHD) OutputUHDConfig outputuhd_conf; diff --git a/src/DabMod.cpp b/src/DabMod.cpp index 4e4cdab..adc4cf2 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -322,7 +322,8 @@ int launch_modulator(int argc, char* argv[]) mod_settings.digitalgain, mod_settings.normalise, mod_settings.gainmodeVariance, - mod_settings.filterTapsFilename); + mod_settings.filterTapsFilename, + mod_settings.polyCoefFilename); if (format_converter) { flowgraph.connect(modulator, format_converter); @@ -426,7 +427,8 @@ int launch_modulator(int argc, char* argv[]) mod_settings.digitalgain, mod_settings.normalise, mod_settings.gainmodeVariance, - mod_settings.filterTapsFilename); + mod_settings.filterTapsFilename, + mod_settings.polyCoefFilename); if (format_converter) { flowgraph.connect(modulator, format_converter); diff --git a/src/DabModulator.cpp b/src/DabModulator.cpp index bd14396..81257f4 100644 --- a/src/DabModulator.cpp +++ b/src/DabModulator.cpp @@ -62,7 +62,8 @@ DabModulator::DabModulator( unsigned dabMode, GainMode gainMode, float& digGain, float normalise, float gainmodeVariance, - const std::string& filterTapsFilename + const std::string& filterTapsFilename, + const std::string& polyCoefFilename ) : ModInput(), myOutputRate(outputRate), @@ -75,6 +76,7 @@ DabModulator::DabModulator( myEtiSource(etiSource), myFlowgraph(NULL), myFilterTapsFilename(filterTapsFilename), + myPolyCoefFilename(polyCoefFilename), myTiiConfig(tiiConfig) { PDEBUG("DabModulator::DabModulator(%u, %u, %u, %zu) @ %p\n", @@ -218,8 +220,12 @@ int DabModulator::process(Buffer* dataOut) } shared_ptr<MemlessPoly> cifPoly; - cifPoly = make_shared<MemlessPoly>("default"); - rcs.enrol(cifPoly.get()); + if (not myPolyCoefFilename.empty()) { + cifPoly = make_shared<MemlessPoly>(myPolyCoefFilename); + std::cout << myPolyCoefFilename << "\n"; + std::cout << cifPoly->m_taps[0] << " " << cifPoly->m_taps[1] << " "<< cifPoly->m_taps[2] << " "<< cifPoly->m_taps[3] << " "<< cifPoly->m_taps[4] << " "<< cifPoly->m_taps[5] << " "<< cifPoly->m_taps[6] << " "<< cifPoly->m_taps[7] << "\n"; + rcs.enrol(cifPoly.get()); + } auto myOutput = make_shared<OutputMemory>(dataOut); @@ -371,13 +377,19 @@ int DabModulator::process(Buffer* dataOut) // myFlowgraph->connect(cifGuard, myOutput); // } //} + //if (cifRes) { + // myFlowgraph->connect(cifGuard, cifRes); + // myFlowgraph->connect(cifRes, cifPoly); + // myFlowgraph->connect(cifPoly, myOutput); + //} else { + // myFlowgraph->connect(cifGuard, cifPoly); + // myFlowgraph->connect(cifPoly, myOutput); + //} if (cifRes) { myFlowgraph->connect(cifGuard, cifRes); - myFlowgraph->connect(cifRes, cifPoly); - myFlowgraph->connect(cifPoly, myOutput); + myFlowgraph->connect(cifRes, myOutput); } else { - myFlowgraph->connect(cifGuard, cifPoly); - myFlowgraph->connect(cifPoly, myOutput); + myFlowgraph->connect(cifGuard, myOutput); } } diff --git a/src/DabModulator.h b/src/DabModulator.h index c9bdbe1..0c691dd 100644 --- a/src/DabModulator.h +++ b/src/DabModulator.h @@ -55,7 +55,8 @@ public: unsigned dabMode, GainMode gainMode, float& digGain, float normalise, float gainmodeVariance, - const std::string& filterTapsFilename); + const std::string& filterTapsFilename, + const std::string& polyCoefFilename); DabModulator(const DabModulator& other) = delete; DabModulator& operator=(const DabModulator& other) = delete; virtual ~DabModulator(); @@ -80,6 +81,7 @@ protected: Flowgraph* myFlowgraph; OutputMemory* myOutput; std::string myFilterTapsFilename; + std::string myPolyCoefFilename; tii_config_t& myTiiConfig; size_t myNbSymbols; diff --git a/src/MemlessPoly.cpp b/src/MemlessPoly.cpp index b4bd5d0..1faf338 100644 --- a/src/MemlessPoly.cpp +++ b/src/MemlessPoly.cpp @@ -84,6 +84,7 @@ void MemlessPoly::load_filter_taps(const std::string &tapsFile) { std::vector<float> filter_taps; if (tapsFile == "default") { + std::cout << "MemlessPoly default\n"; std::copy(default_coefficients.begin(), default_coefficients.end(), std::back_inserter(filter_taps)); } diff --git a/src/MemlessPoly.h b/src/MemlessPoly.h index fe372d8..33ae202 100644 --- a/src/MemlessPoly.h +++ b/src/MemlessPoly.h @@ -63,6 +63,9 @@ public: virtual const std::string get_parameter( const std::string& parameter) const; +//TODO to protected + std::vector<float> m_taps; + protected: int internal_process(Buffer* const dataIn, Buffer* dataOut); @@ -71,6 +74,5 @@ protected: std::string m_taps_file; mutable std::mutex m_taps_mutex; - std::vector<float> m_taps; }; |