public SygnalAnalyzerForm()
 {
     InitializeComponent();
     _wfmt = new WaveFormat();
     _wfmt.SetPCMFormat(11025, 1, 16);
     _bufferSize = FFT.NextPowerOfTwo((UInt32)(_wfmt.BytesPerSecond * FFT_SPEED));
     _numSamples = 0;
     _numOutBuffers = 0;
    // ------------------------------------------------------
     InputZGraphCtrl.GraphPane.Title.Text = "Input, mV";
     InputZGraphCtrl.GraphPane.XAxis.Title.Text = "time, ms";
     InputZGraphCtrl.GraphPane.YAxis.Title.Text = "signal, mV";
     InputZGraphCtrl.GraphPane.XAxis.MinorGrid.IsVisible = true;
     InputZGraphCtrl.GraphPane.YAxis.MinorGrid.IsVisible = true;
     SpectrumZGraphCtrl.GraphPane.Title.Text = "Spectrum, dB";
     SpectrumZGraphCtrl.GraphPane.XAxis.MinorGrid.IsVisible = true;
     SpectrumZGraphCtrl.GraphPane.YAxis.MinorGrid.IsVisible = true;
     SpectrumZGraphCtrl.GraphPane.YAxis.Type = AxisType.Log;
     SpectrumZGraphCtrl.GraphPane.YAxis.Title.Text = "Amplitude, db";
     SpectrumZGraphCtrl.GraphPane.XAxis.Title.Text = "frequency, Hz";
 }
Esempio n. 2
0
 public int Open(int deviceId, WaveFormat wfmt)
 {
     int mmr = WaveConstants.MMSYSERR_HANDLEBUSY;
     if (!IsOpen())
     {
         _Callback = new DriverCallback(waveOutProc);
         GCHandle handle = GCHandle.Alloc(_Callback);
         mmr = WaveOutput.waveOutOpen(ref _hWaveOut, deviceId, ref wfmt.wfmt.Format,
                                   Marshal.GetFunctionPointerForDelegate(_Callback),
                                   IntPtr.Zero,
                                   WaveConstants.CALLBACK_FUNCTION);
         handle.Free();
         if (mmr == WaveConstants.MMSYSERR_NOERROR)
         {
             Interlocked.Exchange(ref _DeviceState, (int)WaveStatus.waveStopped);
         }
     }
     return mmr;
 }