1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-21 02:17:08 +00:00

Promote DigitalPhaseLockedLoop to a template, simplify to O(1) add_pulse.

This commit is contained in:
Thomas Harte
2020-01-12 17:25:21 -05:00
parent 2c742a051e
commit f42655a0fc
11 changed files with 115 additions and 95 deletions
+2 -2
View File
@@ -14,18 +14,18 @@
// just return a copy of that segment.
Storage::Disk::PCMSegment Storage::Disk::track_serialisation(const Track &track, Time length_of_a_bit) {
unsigned int history_size = 16;
DigitalPhaseLockedLoop pll(100, history_size);
std::unique_ptr<Track> track_copy(track.clone());
// ResultAccumulator exists to append whatever comes out of the PLL to
// its PCMSegment.
struct ResultAccumulator: public DigitalPhaseLockedLoop::Delegate {
struct ResultAccumulator {
PCMSegment result;
void digital_phase_locked_loop_output_bit(int value) {
result.data.push_back(!!value);
}
} result_accumulator;
result_accumulator.result.length_of_a_bit = length_of_a_bit;
DigitalPhaseLockedLoop<ResultAccumulator> pll(100);
// Obtain a length multiplier which is 100 times the reciprocal
// of the expected bit length. So a perfect bit length from