From 019965802547684141ceeff7f0098f7cac095fa2 Mon Sep 17 00:00:00 2001 From: "5684185+vsariola@users.noreply.github.com" <5684185+vsariola@users.noreply.github.com> Date: Wed, 30 Apr 2025 16:24:48 +0300 Subject: [PATCH] style(tracker): use for range loops everywhere in detector.go --- tracker/detector.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tracker/detector.go b/tracker/detector.go index 5ea1043..eb872f1 100644 --- a/tracker/detector.go +++ b/tracker/detector.go @@ -230,13 +230,13 @@ func (d *loudnessDetector) update(chunk sointu.AudioBuffer) LoudnessResult { setSliceLength(&d.tmp2, l) setSliceLength(&d.tmpbool, l) var total float32 - for chn := 0; chn < 2; chn++ { + for chn := range 2 { // deinterleave the channels - for i := 0; i < len(chunk); i++ { + for i := range chunk { d.tmp[i] = chunk[i][chn] } // filter the signal with the weighting filter - for k := 0; k < len(d.weighting); k++ { + for k := range d.weighting { d.states[chn][k].Filter(d.tmp[:len(chunk)], d.weighting[k]) } // square the samples @@ -302,7 +302,7 @@ func decibelToPower(loudness Decibel) float32 { func (state *biquadState) Filter(buffer []float32, coeff biquadCoeff) { s := *state - for i := 0; i < len(buffer); i++ { + for i := range buffer { x := buffer[i] y := coeff.b0*x + coeff.b1*s.x1 + coeff.b2*s.x2 - coeff.a1*s.y1 - coeff.a2*s.y2 s.x2, s.x1 = s.x1, x