WakewordModel: clean up stale comment, clarify ring-fill boundary case
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user