Beispiel #1
0
        public OutbandPowerSpectrumSignal(int nsize)
        {
            this.block_size = nsize;

            this.window      = new float[nsize];
            this.ps_results  = new float[nsize * 2];
            this.ps_average  = new float[nsize * 2];
            this.filt_design = new FilterDesigner();

            filt_design.makewindow(WindowType_e.BLACKMANHARRIS_WINDOW,
                                   nsize,
                                   ref window);

            this.ps_cpx  = new CPX[nsize * 2];
            this.tmp_cpx = new CPX[nsize * 2];

            h_ps   = GCHandle.Alloc(ps_cpx, GCHandleType.Pinned);
            h_temp = GCHandle.Alloc(tmp_cpx, GCHandleType.Pinned);

            // in: tmp_cpx_1 out: ps_cpx
            plan_fwd_ps = FFTW.dft_1d(nsize * 2,
                                      h_temp.AddrOfPinnedObject(),
                                      h_ps.AddrOfPinnedObject(),
                                      FFTW.fftw_direction.Forward,
                                      FFTW.fftw_flags.Measure);
        }
        public PowerSpectrumSignal(ref DSPBuffer dsp_buffer_obj)
        {
            this.d = dsp_buffer_obj;
            this.s = d.State;

            this.sample_rate  = s.DSPSampleRate;
            this.block_size   = s.DSPBlockSize;
            this.strobe_count = (int)this.sample_rate / (this.block_size * this.rate);

            this.window      = new float[s.DSPBlockSize];
            this.ps_results  = new float[s.DSPBlockSize * 2];
            this.ps_average  = new float[s.DSPBlockSize * 2];
            this.filt_design = new FilterDesigner();

            filt_design.makewindow(WindowType_e.BLACKMANHARRIS_WINDOW,
                                   s.DSPBlockSize,
                                   ref window);

            this.ps_cpx  = new CPX[s.DSPBlockSize * 2];
            this.tmp_cpx = new CPX[s.DSPBlockSize * 2];

            h_ps   = GCHandle.Alloc(ps_cpx, GCHandleType.Pinned);
            h_temp = GCHandle.Alloc(tmp_cpx, GCHandleType.Pinned);

            // in: tmp_cpx_1 out: ps_cpx
            plan_fwd_ps = FFTW.dft_1d(s.DSPBlockSize * 2,
                                      h_temp.AddrOfPinnedObject(),
                                      h_ps.AddrOfPinnedObject(),
                                      FFTW.fftw_direction.Forward,
                                      FFTW.fftw_flags.Measure);
        }
Beispiel #3
0
        public OutbandPowerSpectrumSignal(ref DSPBuffer dsp_buffer_obj, WindowType_e filterType)
        {
            this.d = dsp_buffer_obj;
            this.s = d.State;

            this.block_size = s.DSPBlockSize;

            this.window      = new float[s.DSPBlockSize];
            this.ps_results  = new float[s.DSPBlockSize * 2];
            this.ps_average  = new float[s.DSPBlockSize * 2];
            this.filt_design = new FilterDesigner();

            filt_design.makewindow(filterType,
                                   s.DSPBlockSize,
                                   ref window);

            this.ps_cpx  = new CPX[s.DSPBlockSize * 2];
            this.tmp_cpx = new CPX[s.DSPBlockSize * 2];

            h_ps   = GCHandle.Alloc(ps_cpx, GCHandleType.Pinned);
            h_temp = GCHandle.Alloc(tmp_cpx, GCHandleType.Pinned);

            // in: tmp_cpx_1 out: ps_cpx
            plan_fwd_ps = FFTW.dft_1d(s.DSPBlockSize * 2,
                                      h_temp.AddrOfPinnedObject(),
                                      h_ps.AddrOfPinnedObject(),
                                      FFTW.fftw_direction.Forward,
                                      FFTW.fftw_flags.Measure);
        }