summaryrefslogtreecommitdiffstats
path: root/src/DabModulator.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-09-18 11:53:03 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-09-18 11:53:03 +0200
commit415c6de26b164aad462c9051451cb0b324ac2ffc (patch)
tree5fb517c570c151613a95768aeb58bca14b44c557 /src/DabModulator.cpp
parent19a8c5db77e29b5d8309e1c7589bc3fdc283efae (diff)
downloaddabmod-415c6de26b164aad462c9051451cb0b324ac2ffc.tar.gz
dabmod-415c6de26b164aad462c9051451cb0b324ac2ffc.tar.bz2
dabmod-415c6de26b164aad462c9051451cb0b324ac2ffc.zip
Keep FIR filtertaps after modulator restart
Diffstat (limited to 'src/DabModulator.cpp')
-rw-r--r--src/DabModulator.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/DabModulator.cpp b/src/DabModulator.cpp
index dbd3528..ebfcd63 100644
--- a/src/DabModulator.cpp
+++ b/src/DabModulator.cpp
@@ -61,7 +61,7 @@ DabModulator::DabModulator(
unsigned outputRate, unsigned clockRate,
unsigned dabMode, GainMode gainMode,
float& digGain, float normalise,
- std::string filterTapsFilename
+ std::string& filterTapsFilename
) :
ModCodec(ModFormat(1), ModFormat(0)),
myOutputRate(outputRate),
@@ -219,9 +219,9 @@ int DabModulator::process(Buffer* const dataIn, Buffer* dataOut)
new GuardIntervalInserter(myNbSymbols, mySpacing,
myNullSize, mySymSize));
- FIRFilter* cifFilter = NULL;
+ shared_ptr<FIRFilter> cifFilter;
if (myFilterTapsFilename != "") {
- cifFilter = new FIRFilter(myFilterTapsFilename);
+ cifFilter = make_shared<FIRFilter>(myFilterTapsFilename);
cifFilter->enrol_at(*myRCs);
}
shared_ptr<OutputMemory> myOutput(new OutputMemory(dataOut));
@@ -362,15 +362,14 @@ int DabModulator::process(Buffer* const dataIn, Buffer* dataOut)
myFlowgraph->connect(cifOfdm, cifGain);
myFlowgraph->connect(cifGain, cifGuard);
- if (myFilterTapsFilename != "") {
- shared_ptr<FIRFilter> cifFilterptr(cifFilter);
- myFlowgraph->connect(cifGuard, cifFilterptr);
+ if (cifFilter) {
+ myFlowgraph->connect(cifGuard, cifFilter);
if (cifRes != NULL) {
shared_ptr<Resampler> res(cifRes);
- myFlowgraph->connect(cifFilterptr, res);
+ myFlowgraph->connect(cifFilter, res);
myFlowgraph->connect(res, myOutput);
} else {
- myFlowgraph->connect(cifFilterptr, myOutput);
+ myFlowgraph->connect(cifFilter, myOutput);
}
}
else { //no filtering