From ce44f9989b71961ff2c57216e05c0b14730bd666 Mon Sep 17 00:00:00 2001
From: Florian <florian.taurer@gmx.at>
Date: Wed, 5 Sep 2018 14:01:51 +0200
Subject: [PATCH] set all jamming frequency values to the same level, change to
 complexInverse fft instead of multiplying by -1 and complexforward fft

---
 .../at/ac/fhstp/sonicontrol/NoiseGenerator.java    | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/SoniControl/app/src/main/java/at/ac/fhstp/sonicontrol/NoiseGenerator.java b/SoniControl/app/src/main/java/at/ac/fhstp/sonicontrol/NoiseGenerator.java
index 2bd482f2..d08000e9 100644
--- a/SoniControl/app/src/main/java/at/ac/fhstp/sonicontrol/NoiseGenerator.java
+++ b/SoniControl/app/src/main/java/at/ac/fhstp/sonicontrol/NoiseGenerator.java
@@ -229,14 +229,24 @@ public class NoiseGenerator {
                     complexSignal[(int)l] = 0.0f; //set all frequencies between the higher frequency of one band to the lower frequency of the next band to 0 mirrored to the doubled winLenSamples size
                 }
             }
+            for (int k = 0; k < whiteNoiseBands.length-2; k++) {
+                for (double l = cutoffFreqDownIdx[k]; l <= cutoffFreqUpIdx[k]; l++) {
+                    complexSignal[(int)l] = 10000.0f; //set all frequencies between the higher frequency of one band to the lower frequency of the next band to 0
+                }
+                int helpSamples = winLenSamples * 2;
+                for (double l = helpSamples-cutoffFreqUpIdx[k]; l <= helpSamples-cutoffFreqDownIdx[k]; l++) {
+                    complexSignal[(int)l] = 10000.0f; //set all frequencies between the higher frequency of one band to the lower frequency of the next band to 0 mirrored to the doubled winLenSamples size
+                }
+            }
         }
 
-        for (int i = 0; i < complexSignal.length - 1; i++) {
+        /*for (int i = 0; i < complexSignal.length - 1; i++) {
             complexSignal[i] = complexSignal[i] * (-1); //invert all algebraic signs
         }
 
         mFFT.complexForward(complexSignal); //make the fft on the inverted signal
-
+*/
+        mFFT.complexInverse(complexSignal,false);
         return complexSignal; //return the signal with the complex values
 
     }
-- 
GitLab