Template ClockRecovery for ErrorFilter type.

This commit is contained in:
Jared Boone 2015-10-02 22:32:58 -07:00
parent 9879af37d5
commit 474eaa8541
2 changed files with 6 additions and 2 deletions

View File

@ -105,13 +105,16 @@ private:
const float weight;
};
template<typename ErrorFilter>
class ClockRecovery {
public:
ClockRecovery(
const float sampling_rate,
const float symbol_rate,
const ErrorFilter error_filter,
std::function<void(const float)> symbol_handler
) : resampler(sampling_rate, symbol_rate * timing_error_detector.samples_per_symbol),
error_filter { error_filter },
symbol_handler { symbol_handler }
{
}
@ -136,7 +139,7 @@ public:
private:
dsp::interpolation::LinearResampler resampler;
GardnerTimingErrorDetector timing_error_detector;
FixedErrorFilter error_filter;
ErrorFilter error_filter;
std::function<void(const float)> symbol_handler;
void resampler_callback(const float interpolated_sample) {

View File

@ -78,9 +78,10 @@ private:
1
};
clock_recovery::ClockRecovery clock_recovery {
clock_recovery::ClockRecovery<clock_recovery::FixedErrorFilter> clock_recovery {
static_cast<float>(sampling_rate / 4),
9600,
{ 0.0012f },
[this](const float symbol) { this->consume_symbol(symbol); }
};
symbol_coding::NRZIDecoder nrzi_decode;