diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-11-03 11:08:46 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-11-03 11:08:46 +0100 |
commit | e3de2f4092d1df941d0e5117c8c6533612c52bbc (patch) | |
tree | cb13f6832140ba28dc31b6aa19d25468c1ac9b4a /src/DabModulator.cpp | |
parent | 53c3963b8a47d485e6776caa06e86d14a8520c0c (diff) | |
download | dabmod-e3de2f4092d1df941d0e5117c8c6533612c52bbc.tar.gz dabmod-e3de2f4092d1df941d0e5117c8c6533612c52bbc.tar.bz2 dabmod-e3de2f4092d1df941d0e5117c8c6533612c52bbc.zip |
Replace flowgraph setup if chain by a loop
Diffstat (limited to 'src/DabModulator.cpp')
-rw-r--r-- | src/DabModulator.cpp | 56 |
1 files changed, 20 insertions, 36 deletions
diff --git a/src/DabModulator.cpp b/src/DabModulator.cpp index 0914469..2bd33b4 100644 --- a/src/DabModulator.cpp +++ b/src/DabModulator.cpp @@ -163,10 +163,13 @@ int DabModulator::process(Buffer* dataOut) } } - auto cifCicEq = make_shared<CicEqualizer>( + shared_ptr<CicEqualizer> cifCicEq; + if (useCicEq) { + cifCicEq = make_shared<CicEqualizer>( myNbCarriers, (float)mySpacing * (float)m_settings.outputRate / 2048000.0f, cic_ratio); + } shared_ptr<TII> tii; shared_ptr<PhaseReference> tiiRef; @@ -346,43 +349,24 @@ int DabModulator::process(Buffer* dataOut) myFlowgraph->connect(tii, cifSig); } - if (useCicEq) { - myFlowgraph->connect(cifSig, cifCicEq); - myFlowgraph->connect(cifCicEq, cifOfdm); - } - else { - myFlowgraph->connect(cifSig, cifOfdm); - } - myFlowgraph->connect(cifOfdm, cifGain); - myFlowgraph->connect(cifGain, cifGuard); - - auto cifOut = cifPoly ? - static_pointer_cast<ModPlugin>(cifPoly) : - static_pointer_cast<ModPlugin>(myOutput); - - if (cifFilter) { - myFlowgraph->connect(cifGuard, cifFilter); - if (cifRes) { - myFlowgraph->connect(cifFilter, cifRes); - myFlowgraph->connect(cifRes, cifOut); - } - else { - myFlowgraph->connect(cifFilter, cifOut); + shared_ptr<ModPlugin> prev_plugin = static_pointer_cast<ModPlugin>(cifSig); + const std::list<shared_ptr<ModPlugin> > plugins({ + static_pointer_cast<ModPlugin>(cifCicEq), + static_pointer_cast<ModPlugin>(cifOfdm), + static_pointer_cast<ModPlugin>(cifGain), + static_pointer_cast<ModPlugin>(cifGuard), + static_pointer_cast<ModPlugin>(cifFilter), // optional block + static_pointer_cast<ModPlugin>(cifRes), // optional block + static_pointer_cast<ModPlugin>(cifPoly), // optional block + static_pointer_cast<ModPlugin>(myOutput), + }); + + for (auto& p : plugins) { + if (p) { + myFlowgraph->connect(prev_plugin, p); + prev_plugin = p; } } - else { - if (cifRes) { - myFlowgraph->connect(cifGuard, cifRes); - myFlowgraph->connect(cifRes, cifOut); - } - else { - myFlowgraph->connect(cifGuard, cifOut); - } - } - - if (cifPoly) { - myFlowgraph->connect(cifPoly, myOutput); - } } //////////////////////////////////////////////////////////////////// |