diff --git a/src/detector/analysis.rs b/src/detector/analysis.rs index b0d1c1d..0d8f972 100644 --- a/src/detector/analysis.rs +++ b/src/detector/analysis.rs @@ -13,13 +13,13 @@ pub(super) fn analyse_buffer_by_stepped_windows( let mut total = 0u32; let mut len = 0u32; - for window in buf.windows(CHUNK_SIZE).step_by(CHUNK_STEP) { + for (i, window) in buf.windows(CHUNK_SIZE).enumerate().step_by(CHUNK_STEP) { let window_total = window.iter().copied().sum::(); let window_avg = window_total / CHUNK_SIZE as u16; let diff = average.saturating_sub(window_avg); if diff > BLIP_THRESHOLD { - peaks.push(diff); + peaks.push(i as u16); } else { total += window_total as u32; len += CHUNK_SIZE as u32;