# HG changeset patch # User Daniel O'Connor # Date 1740457420 -37800 # Node ID 2e14ccd1338a8085313f25f9119fb1fc34a3588f # Parent f1e44afb41a3a6797af9657e5ca9a77f83f113f9 Set control data after shape data so it is lined up properly. diff -r f1e44afb41a3 -r 2e14ccd1338a modulator.c --- a/modulator.c Tue Feb 25 14:36:10 2025 +1030 +++ b/modulator.c Tue Feb 25 14:53:40 2025 +1030 @@ -225,8 +225,8 @@ // Up slew for (uint16_t i = 0; i < slew1; i++) { + ctrl[idx] |= PACTIVE; data[idx++] = qtoi(qdiv(qmul(qint(dcofs), qint(i)), qint(slew1))); - ctrl[idx] |= PACTIVE; } for (uint16_t c = 0; c < ncode; c++) { if (c == 0) @@ -242,6 +242,7 @@ interp0->base[2] = (uintptr_t)shape; // Start of shape table } for (uint16_t i = 0; i < shapesamples; i++) { + ctrl[idx] = ctrltmp; if (c == 0) { // Get sample pair uint8_t *sample_pair = (uint8_t *) interp0->peek[2]; @@ -257,7 +258,6 @@ } else // Already done it before, just copy the previous instance data[idx++] = data[bit1startup + i]; - ctrl[idx] = ctrltmp; } if (c == 0) bit1stopup = idx - 1; @@ -265,27 +265,27 @@ // Since the pulse is symmetrical just copy the up slope in reverse // XXX: if we had asymmetrical predistortion this wouldn't be true for (uint16_t i = 0; i < shapesamples; i++) { - data[idx++] = data[bit1stopup - i]; // Could replace this with a separate loop to poke it into place // Similarly for TR switch when implemented if (i == 0 && c == 0) ctrl[idx] = ctrltmp | SENSE1; else ctrl[idx] = ctrltmp; + data[idx++] = data[bit1stopup - i]; } // Code gap if (c < ncode - 1) for (uint16_t i = 0; i < codegap; i++) { + ctrl[idx] = ctrltmp; data[idx++] = dcofs; - ctrl[idx] = ctrltmp; } } // Down slew for (uint16_t i = 0; i < slew2 + 1; i++) { + ctrl[idx] |= PACTIVE; data[idx++] = qtoi(qdiv(qmul(qint(dcofs), qint(slew2 - i)), qint(slew2))); - ctrl[idx] |= PACTIVE; } data[idx++] = 0;