From 32f439da1cd55835021bd02d9c18c8e58373d011 Mon Sep 17 00:00:00 2001 From: PeaZomboss Date: Thu, 17 Oct 2024 15:28:23 +0800 Subject: [PATCH] Correct result when taps is odd --- src/sinc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sinc.rs b/src/sinc.rs index 13e169d..5f339bb 100644 --- a/src/sinc.rs +++ b/src/sinc.rs @@ -133,7 +133,7 @@ impl Converter { let mut right; if taps % 2 == 1 { let pos = coef * self.quan; - let posu = coef as usize; + let posu = pos as usize; let h1 = self.filter[posu]; let h2 = self.filter[posu + 1]; let h = h1 + (h2 - h1) * (pos - posu as f64);