Skip to content

Commit a02cff9

Browse files
pragmatrixCopilot
andauthored
Update filter-test/src/main.rs
Co-authored-by: Copilot <[email protected]>
1 parent 8452a09 commit a02cff9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

filter-test/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ fn process_audio_file(
171171
let samples_per_channel = mono_samples.len() / channels.count();
172172
let mut downmixed = Vec::with_capacity(samples_per_channel);
173173

174-
for i in 0..samples_per_channel {
174+
for i in (0..mono_samples.len()).step_by(channels.count()) {
175175
let mut sum = 0i32;
176176
for ch in 0..channels.count() {
177-
sum += mono_samples[i + ch * samples_per_channel] as i32;
177+
sum += mono_samples[i + ch] as i32;
178178
}
179179
downmixed.push((sum / channels.count() as i32) as i16);
180180
}

0 commit comments

Comments
 (0)