From 177eb8d875a5513731e8c9b3019ca44d311e55c3 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 26 Jun 2015 14:58:48 +0200 Subject: Add TII configuration to ini file --- src/DabMod.cpp | 8 +++++++- src/DabModulator.cpp | 16 ++++++++++++---- src/DabModulator.h | 5 ++++- src/TII.cpp | 4 +--- 4 files changed, 24 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/DabMod.cpp b/src/DabMod.cpp index 1fc7e3c..618e0fe 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -132,6 +132,8 @@ int launch_modulator(int argc, char* argv[]) float normalise = 1.0f; GainMode gainMode = GAIN_VAR; + int tiiPattern = 0; + int tiiComb = 0; /* UHD requires the input I and Q samples to be in the interval * [-1.0,1.0], otherwise they get truncated, which creates very @@ -578,6 +580,10 @@ int launch_modulator(int argc, char* argv[]) outputuhd_conf.muteNoTimestamps = (pt.get("delaymanagement.mutenotimestamps", 0) == 1); #endif + + /* Read TII parameters from config file */ + tiiComb = pt.get("tii.comb", 0); + tiiPattern = pt.get("tii.pattern", 0); } if (rcs.get_no_controllers() == 0) { @@ -750,7 +756,7 @@ int launch_modulator(int argc, char* argv[]) shared_ptr modulator( new DabModulator(tist_offset_s, tist_delay_stages, &rcs, outputRate, clockRate, dabMode, gainMode, digitalgain, - normalise, filterTapsFilename)); + normalise, filterTapsFilename, tiiComb, tiiPattern)); flowgraph.connect(input, modulator); if (format_converter) { diff --git a/src/DabModulator.cpp b/src/DabModulator.cpp index 97c36da..dbc6827 100644 --- a/src/DabModulator.cpp +++ b/src/DabModulator.cpp @@ -61,7 +61,8 @@ DabModulator::DabModulator( unsigned outputRate, unsigned clockRate, unsigned dabMode, GainMode gainMode, float digGain, float normalise, - std::string filterTapsFilename + std::string filterTapsFilename, + int tiiComb, int tiiPattern ) : ModCodec(ModFormat(1), ModFormat(0)), myOutputRate(outputRate), @@ -73,6 +74,8 @@ DabModulator::DabModulator( myEtiReader(EtiReader(tist_offset_s, tist_delay_stages, rcs)), myFlowgraph(NULL), myFilterTapsFilename(filterTapsFilename), + myTiiComb(tiiComb), + myTiiPattern(tiiPattern), myRCs(rcs) { PDEBUG("DabModulator::DabModulator(%u, %u, %u, %u) @ %p\n", @@ -195,8 +198,10 @@ int DabModulator::process(Buffer* const dataIn, Buffer* dataOut) (float)mySpacing * (float)myOutputRate / 2048000.0f, cic_ratio)); - - shared_ptr tii(new TII(myDabMode, 3, 16)); + shared_ptr tii; + if (myTiiComb != 0) { + tii = make_shared(myDabMode, myTiiPattern, myTiiComb); + } shared_ptr cifOfdm( new OfdmGenerator((1 + myNbSymbols), myNbCarriers, mySpacing)); @@ -347,7 +352,10 @@ int DabModulator::process(Buffer* const dataIn, Buffer* dataOut) myFlowgraph->connect(cifFreq, cifDiff); myFlowgraph->connect(cifNull, cifSig); myFlowgraph->connect(cifDiff, cifSig); - myFlowgraph->connect(tii, cifSig); + if (tii) { + myFlowgraph->connect(tii, cifSig); + } + if (useCicEq) { myFlowgraph->connect(cifSig, cifCicEq); myFlowgraph->connect(cifCicEq, cifOfdm); diff --git a/src/DabModulator.h b/src/DabModulator.h index 1a9e477..48cdd42 100644 --- a/src/DabModulator.h +++ b/src/DabModulator.h @@ -54,7 +54,8 @@ public: unsigned outputRate = 2048000, unsigned clockRate = 0, unsigned dabMode = 0, GainMode gainMode = GAIN_VAR, float digGain = 1.0, float normalise = 1.0, - std::string filterTapsFilename = ""); + std::string filterTapsFilename = "", + int tiiComb = 0, int tiiPattern = 0); DabModulator(const DabModulator& copy); virtual ~DabModulator(); @@ -77,6 +78,8 @@ protected: Flowgraph* myFlowgraph; OutputMemory* myOutput; std::string myFilterTapsFilename; + int myTiiComb; + int myTiiPattern; RemoteControllers* myRCs; size_t myNbSymbols; diff --git a/src/TII.cpp b/src/TII.cpp index bafa343..5c85302 100644 --- a/src/TII.cpp +++ b/src/TII.cpp @@ -196,11 +196,9 @@ int TII::process(Buffer* const dataIn, Buffer* dataOut) } void TII::enable_carrier(int k) { - fprintf(stderr, "k = %d\n", k); - int ix = m_carriers/2 + k; - if (ix < 0 or ix > (ssize_t)m_dataIn.size()) { + if (ix < 0 or ix+1 >= (ssize_t)m_dataIn.size()) { throw std::runtime_error( "TII::enable_carrier invalid k!"); } -- cgit v1.2.3