WakewordModel: clean up stale comment, clarify ring-fill boundary case

This commit is contained in:
2026-06-12 11:43:28 +00:00
parent e18aed53d7
commit b43a1ce17f
+5 -3
View File
@@ -110,7 +110,11 @@ internal sealed class WakewordModel : IDisposable
_rawRingFill += copyToFront; _rawRingFill += copyToFront;
if (copyToFront < FrameSamples) if (copyToFront < FrameSamples)
{ {
// Shouldn't happen on the very first call, but defensive. // Boundary case: ring was partially full and the new frame overshoots
// remaining capacity. Fires exactly once during warm-up (typically call 2,
// when _rawRingFill = 1280 and the incoming 1280 samples overshoot the
// remaining 480 capacity). Shift the older samples left to make room,
// then write the leftover at the tail.
int leftover = FrameSamples - copyToFront; int leftover = FrameSamples - copyToFront;
Array.Copy(_rawRing, leftover, _rawRing, 0, MelInputSamples - leftover); Array.Copy(_rawRing, leftover, _rawRing, 0, MelInputSamples - leftover);
Array.Copy(frame1280, copyToFront, _rawRing, MelInputSamples - leftover, leftover); Array.Copy(frame1280, copyToFront, _rawRing, MelInputSamples - leftover, leftover);
@@ -191,8 +195,6 @@ internal sealed class WakewordModel : IDisposable
return clsOut[0, 0]; return clsOut[0, 0];
} }
// ... methods follow in Step 2 ...
public void Dispose() public void Dispose()
{ {
_mel.Dispose(); _mel.Dispose();