writeToArray method
The C struct layout is 17 floats.
0enable 1threshold 2ratio 3knee 4knee_auto 5gain 6gain_auto
7attack 8attack_auto 9release 10release_auto 11knee_multi
12max_attack 13max_release 14crest 15adapt 16no_clip
Implementation
void writeToArray(Float32List arr, int offset) {
arr[offset + 0] = enable ? 1.0 : 0.0;
arr[offset + 1] = (threshold / -60.0).clamp(0.0, 1.0); // dB to 0..1
arr[offset + 2] = ratio; // Native code negates it: ratio_ = -value
arr[offset + 3] = (knee / 60.0).clamp(0.0, 1.0); // Assuming knee is dB width
arr[offset + 4] = kneeAuto ? 1.0 : 0.0;
arr[offset + 5] = (gain / 60.0).clamp(-1.0, 1.0); // dB to normalized
arr[offset + 6] = gainAuto ? 1.0 : 0.0;
arr[offset + 7] = _normalizeAttack(attack);
arr[offset + 8] = attackAuto ? 1.0 : 0.0;
arr[offset + 9] = _normalizeRelease(release);
arr[offset + 10] = releaseAuto ? 1.0 : 0.0;
arr[offset + 11] = kneeMulti;
arr[offset + 12] = _normalizeAttack(maxAttack > 0 ? maxAttack : 100.0);
arr[offset + 13] = _normalizeRelease(maxRelease > 0 ? maxRelease : 1000.0);
arr[offset + 14] = _normalizeRelease(crest > 0 ? crest : 100.0); // crest uses same scale as release
arr[offset + 15] = adapt > 0 ? (math.log(adapt) / 1.386294) : 0.660964; // adapt is in sec, 0.66 default
arr[offset + 16] = noClip ? 1.0 : 0.0;
}