MCPcopy Create free account
hub / github.com/BatchDrake/SigDigger / sampleGardner

Method sampleGardner

Tasks/WaveSampler.cpp:177–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177bool
178WaveSampler::sampleGardner(void)
179{
180 long amount = static_cast<long>(this->properties.length) - this->p;
181 long p = this->p;
182 SUCOMPLEX x = 0, prev = this->prevSample;
183 SUSDIFF count;
184
185 if (amount > SIGDIGGER_WAVESAMPLER_FEEDER_BLOCK_LENGTH)
186 amount = SIGDIGGER_WAVESAMPLER_FEEDER_BLOCK_LENGTH;
187
188 if (this->properties.space == FREQUENCY) {
189 // Perform quadrature demodulation directly in here.
190 while (amount--) {
191 x = this->properties.data[p++];
192 su_clock_detector_feed(&this->cd, x * SU_C_CONJ(prev));
193 prev = x;
194 }
195
196 this->prevSample = prev;
197 } else {
198 while (amount--)
199 su_clock_detector_feed(&this->cd, this->properties.data[p++]);
200 }
201
202 count = su_clock_detector_read(
203 &this->cd,
204 this->set.block,
205 SIGDIGGER_WAVESAMPLER_FEEDER_BLOCK_LENGTH);
206
207 this->p = p;
208 this->set.len = static_cast<size_t>(count);
209
210 this->progress = this->p / static_cast<qreal>(this->properties.length);
211
212 return this->p < static_cast<long>(this->properties.length);
213}
214
215bool
216WaveSampler::sampleZeroCrossing(void)

Callers 1

workMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected