| 30 | static bool registered; |
| 31 | |
| 32 | WaveSampler::WaveSampler( |
| 33 | SamplingProperties const &props, |
| 34 | const Decider *decider, |
| 35 | QObject *parent) : CancellableTask(parent) |
| 36 | { |
| 37 | if (!registered) { |
| 38 | qRegisterMetaType<SigDigger::WaveSampleSet>(); |
| 39 | registered = true; |
| 40 | } |
| 41 | // The number of symbols is already decided on properties |
| 42 | this->properties = props; |
| 43 | this->decider = decider; |
| 44 | |
| 45 | this->delta = props.length / props.symbolCount; |
| 46 | this->sampOffset = this->properties.symbolSync / delta; |
| 47 | |
| 48 | this->bnor = SU_ABS2NORM_BAUD(props.fs, props.rate); |
| 49 | |
| 50 | if (this->bnor > 1) |
| 51 | this->bnor = 1; |
| 52 | |
| 53 | // Gardner by default |
| 54 | if (this->properties.sync == SamplingClockSync::GARDNER) { |
| 55 | #ifdef SIGDIGGER_WAVESAMPLER_USE_MF |
| 56 | SUFLOAT tau = 1. / bnor; |
| 57 | unsigned span; |
| 58 | #endif // SIGDIGGER_WAVESAMPLER_USE_MF |
| 59 | |
| 60 | SU_ATTEMPT( |
| 61 | su_clock_detector_init( |
| 62 | &this->cd, |
| 63 | props.loopGain, |
| 64 | this->bnor, |
| 65 | SIGDIGGER_WAVESAMPLER_FEEDER_BLOCK_LENGTH) != -1); |
| 66 | this->cdInit = true; |
| 67 | |
| 68 | #ifdef SIGDIGGER_WAVESAMPLER_USE_MF |
| 69 | span = tau * SIGDIGGER_WAVESAMPLER_MF_PERIODS > SIGDIGGER_WAVESAMPLER_MAX_MF_SPAN |
| 70 | ? SIGDIGGER_WAVESAMPLER_MAX_MF_SPAN |
| 71 | : tau * SIGDIGGER_WAVESAMPLER_MF_PERIODS; |
| 72 | |
| 73 | SU_ATTEMPT( |
| 74 | su_iir_rrc_init( |
| 75 | &this->mf, |
| 76 | SIGDIGGER_WAVESAMPLER_MF_PERIODS, |
| 77 | tau, |
| 78 | props.loopGain)); |
| 79 | this->mfInit = true; |
| 80 | #endif // SIGDIGGER_WAVESAMPLER_USE_MF |
| 81 | } |
| 82 | |
| 83 | } |
| 84 | |
| 85 | WaveSampler::~WaveSampler() |
| 86 | { |
nothing calls this directly
no outgoing calls
no test coverage detected