コード例 #1
0
 public override void FreePlan(IntPtr fftPlan)
 {
     lock (lockObject)
     {
         FFTWFNativeMethods.destroy_plan(fftPlan);
     }
 }
コード例 #2
0
 public override void FreeUnmanagedMemory(IntPtr memoryBlock)
 {
     lock (lockObject)
     {
         FFTWFNativeMethods.free(memoryBlock);
     }
 }
コード例 #3
0
 public override IntPtr GetFFTPlan(int length, IntPtr input, IntPtr output)
 {
     lock (lockObject)
     {
         return(FFTWFNativeMethods.dft_r2c_1d(length, input, output, InteropFFTWFlags.Estimate));
     }
 }
コード例 #4
0
 public override IntPtr GetInput(int length)
 {
     lock (lockObject)
     {
         return(FFTWFNativeMethods.malloc(4 * length));
     }
 }
コード例 #5
0
        public override float[] FFTForward(float[] signal, int startIndex, int length)
        {
            IntPtr input   = GetInput(length);
            IntPtr output  = GetOutput(length);
            IntPtr fftPlan = GetFFTPlan(length, input, output);

            float[] applyTo = new float[length];
            Array.Copy(signal, startIndex, applyTo, 0, length);
            Marshal.Copy(applyTo, 0, input, length);
            // is this also neccesary?? (other lock are it seems!)
            lock (lockObject)
            {
                FFTWFNativeMethods.execute(fftPlan);
            }
            float[] result = new float[length * 2];
            Marshal.Copy(output, result, 0, length * 2);
            FreeUnmanagedMemory(input);
            FreeUnmanagedMemory(output);
            FreePlan(fftPlan);
            return(result);
        }
コード例 #6
0
 public override void Execute(IntPtr fftPlan)
 {
     FFTWFNativeMethods.execute(fftPlan);
 }