We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9b4fb65 commit c5f6493Copy full SHA for c5f6493
src/main.rs
@@ -235,7 +235,8 @@ where
235
_has_update.store(false, Ordering::Release);
236
};
237
238
- let blocks_needed = data.len() / 2 / BLOCK_SIZE;
+ let block_step = data.len() / channels;
239
+ let blocks_needed = block_step / BLOCK_SIZE;
240
let block_step = channels * BLOCK_SIZE;
241
let mut rms: Vec<f32> = vec![0.0; channels];
242
for current_block in 0..blocks_needed {
@@ -248,7 +249,7 @@ where
248
249
}
250
251
- rms = rms.into_iter().map(|x| (x/512.0).sqrt() ).collect();
252
+ rms = rms.into_iter().map(|x| (x / block_step as f32).sqrt() ).collect();
253
// left rms[0] right rms[1]
254
255
let ptr_l = ringbuf_l.load(Ordering::SeqCst);
0 commit comments