public IQBalancer(CWExpert form) { makewindow(2048, ref window); fft = new Fourier(); fftPtr = new ComplexF[4096]; spectrumPtr = new float[4096]; zero = new ComplexF[2048]; MainForm = form; iqfix.phase = 0.0f; iqfix.gain = 1.0f; iqfix.mu = 0.0f; iqfix.leakage = 0.000000f; iqfix.MASK = 2047; iqfix.index = 0; iqfix.w = new ComplexF[2048]; iqfix.b = new ComplexF[2048]; iqfix.y = new ComplexF[2048]; iqfix.del = new ComplexF[2048]; Reset(FFTBins); }
private unsafe void RunDisplay() { try { float[] display_data = new float[4096]; Thread.Sleep(100); fft = new Fourier(); while (runDisplay) { Thread.Sleep(refresh_time); if (this.WindowState != FormWindowState.Minimized) { #if(DirectX) if (VideoDriver == DisplayDriver.DIRECTX) { fixed (float* ptr = &DX.new_display_data[0]) GetPanadapter(0, ptr); Array.Copy(DX.new_display_data, picMonitor_buffer, 4096); Array.Copy(DX.new_display_data, DX.new_waterfall_data, 4096); DX.DataReady = true; if (!DX.RenderDirectX()) { this.Invoke(new CrossThreadCallback(CrossThreadCommand), "Reinit DirectX", ""); Thread.Sleep(100); } if (display_mode == DisplayMode.PANAFALL || display_mode == DisplayMode.PANAFALL_INV) { DX.WaterfallDataReady = true; } if (grpLogBook.Visible) picMonitorRender(); } else #endif { if (Display_GDI.IsInitialized) { fixed (float* ptr = &Display_GDI.new_display_data[0]) GetPanadapter(0, ptr); Array.Copy(Display_GDI.new_display_data, picMonitor_buffer, 4096); Array.Copy(Display_GDI.new_display_data, Display_GDI.new_waterfall_data, 4096); if (grpLogBook.Visible && !mox) picMonitor.Invalidate(); Display_GDI.DataReady = true; picPanadapter.Invalidate(); picWaterfall.Invalidate(); Display_GDI.WaterfallDataReady = true; } } } } } catch (Exception ex) { Debug.Write(ex.ToString()); } }
public bool PSKStart() { bool result = false; fft = new Fourier(); iq_balancer = new IQBalancer(MainForm); try { if (Init()) { run_thread = true; PSKThread1 = new Thread(new ThreadStart(PSK_ThreadRX1)); PSKThread1.Name = "PSK Thread RX1"; PSKThread1.Priority = ThreadPriority.Normal; PSKThread1.IsBackground = true; PSKThread1.Start(); PSKThread2 = new Thread(new ThreadStart(PSK_ThreadRX2)); PSKThread2.Name = "PSK Thread RX2"; PSKThread2.Priority = ThreadPriority.Normal; PSKThread2.IsBackground = true; PSKThread2.Start(); result = true; } return result; } catch (Exception ex) { Debug.Write(ex.ToString()); return false; } }
public PSK(CWExpert form) { MainForm = form; AudioEvent1 = new AutoResetEvent(false); AudioEvent2 = new AutoResetEvent(false); iq_buffer = new ComplexF[2048]; ch1_buffer = new float[2048]; ch2_buffer = new float[2048]; buffer_ch1 = new float[2048]; buffer_ch2 = new float[2048]; display_timer = new HiPerfTimer(); trx = new TRX(); trx.modem = new psk[MODEM_NR]; trx.outbuf = new ComplexF[819]; trx.outbuf1 = new ComplexF[8192]; trx.mon_outbuf = new ComplexF[8192]; iq_balancer = new IQBalancer(form); cs_audio = (void*)0x0; cs_audio = NewCriticalSection(); if (InitializeCriticalSectionAndSpinCount(cs_audio, 0x00000080) == 0) { Debug.WriteLine("CriticalSection Failed"); } fft = new Fourier(); }