You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(audio): invalidate Sample statistics after applyGain #4520
Sample::applyGain changes PCM data, while SampleImpl memoizes RMS and zero-crossing frequency. If those statistics were read before applying gain, subsequent reads return pre-gain values.
Repro: create Sample([1000,-1000]), call rms() (1000), applyGain(2), then rms(); expected 2000, actual 1000. Scaling [1,-1] to zero similarly leaves a cached nonzero zero-crossing statistic.
Proposal
Invalidate or recompute cached statistics whenever the PCM buffer changes.
Acceptance criteria
Focused tests demonstrate RED→GREEN for RMS after positive gain and zero-crossing frequency after gain 0.
Repeated reads after mutation agree with statistics recomputed from the resulting PCM.
Decisions
Scope is cache coherence for applyGain; audit other mutable PCM paths during implementation.
Priority: medium; stale analysis values affect downstream audio behavior.
Activity
zackees commentedon Sep 23, 2026
Please do an adversarial review on this. I don't know if this is the right decision.