[SCM] calf/master: + Bandlimiter: adjust brickwall cutoff equally for positive and negative frequencies

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:37:26 UTC 2013


The following commit has been merged in the master branch:
commit 5581b2b0b464823e3289b5ca70ca348b24d199e3
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Fri Aug 1 19:26:08 2008 +0000

    + Bandlimiter: adjust brickwall cutoff equally for positive and negative frequencies
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@245 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/src/calf/osc.h b/src/calf/osc.h
index 1b12ec1..d1ffdb2 100644
--- a/src/calf/osc.h
+++ b/src/calf/osc.h
@@ -120,21 +120,25 @@ struct bandlimiter
         // waveform has few widely spread harmonics)
         if (foldover)
         {
-            std::complex<float> half(0.5);
+            std::complex<float> fatt(0.5);
             cutoff /= 2;
+            if (cutoff < 2)
+                cutoff = 2;
             for (int i = SIZE / 2; i >= cutoff; i--)
             {
-                new_spec[i / 2] += new_spec[i] * half;
-                new_spec[SIZE - 1 - i / 2] += new_spec[SIZE - 1 - i] * half;
+                new_spec[i / 2] += new_spec[i] * fatt;
+                new_spec[SIZE - i / 2] += new_spec[SIZE - i] * fatt;
                 new_spec[i] = 0.f,
-                new_spec[SIZE - 1 - i] = 0.f;
+                new_spec[SIZE - i] = 0.f;
             }
         }
         else
         {
+            if (cutoff < 1)
+                cutoff = 1;
             for (int i = cutoff; i < SIZE / 2; i++)
                 new_spec[i] = 0.f,
-                new_spec[SIZE - 1 - i] = 0.f;
+                new_spec[SIZE - i] = 0.f;
         }
         // convert back to time domain (IFFT) and extract only real part
         fft.calculate(new_spec.data(), iffted.data(), true);

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list