diff options
Diffstat (limited to 'src/DabModulator.cpp')
-rw-r--r-- | src/DabModulator.cpp | 69 |
1 files changed, 31 insertions, 38 deletions
diff --git a/src/DabModulator.cpp b/src/DabModulator.cpp index 8ba8af6..5b77d18 100644 --- a/src/DabModulator.cpp +++ b/src/DabModulator.cpp @@ -3,7 +3,7 @@ Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2017 + Copyright (C) 2018 Matthias P. Braendli, matthias.braendli@mpb.li http://opendigitalradio.org @@ -162,10 +162,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; @@ -218,7 +221,7 @@ int DabModulator::process(Buffer* dataOut) rcs.enrol(cifPoly.get()); } - auto myOutput = make_shared<OutputMemory>(dataOut); + myOutput = make_shared<OutputMemory>(dataOut); shared_ptr<Resampler> cifRes; if (m_settings.outputRate != 2048000) { @@ -347,43 +350,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); - } - } - else { - if (cifRes) { - myFlowgraph->connect(cifGuard, cifRes); - myFlowgraph->connect(cifRes, cifOut); - } - else { - myFlowgraph->connect(cifGuard, 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; } } - - if (cifPoly) { - myFlowgraph->connect(cifPoly, myOutput); - } } //////////////////////////////////////////////////////////////////// @@ -392,3 +376,12 @@ int DabModulator::process(Buffer* dataOut) return myFlowgraph->run(); } +meta_vec_t DabModulator::process_metadata(const meta_vec_t& metadataIn) +{ + if (myOutput) { + return myOutput->get_latest_metadata(); + } + + return {}; +} + |