示例#1
0
 public void Stop()
 {
     if (m_Player != null)
     {
         try
         {
             m_Player.Dispose();
         }
         catch (Exception e)
         {
           //  MessageBox.Show(e.Message);
         }
         finally
         {
             m_Player = null;
         }
     }
     if (m_Recorder != null)
     {
         try
         {
             m_Recorder.Dispose();
         }
         catch (Exception e)
         {
           //  MessageBox.Show(e.Message);
         }
         finally
         {
             m_Recorder = null;
         }
     }
     m_Fifo.Flush(); // clear all pending data
 }
示例#2
0
 public void Start()
 {
     Stop();
     try
     {
         WaveFormat fmt = new WaveFormat(44100, 16, 2);
         m_Player = new WaveOutPlayer(-1, fmt, 16384, 3, new BufferFillEventHandler(Filler));
         m_Recorder = new WaveInRecorder(-1, fmt, 16384, 3, new BufferDoneEventHandler(DataArrived));
     }
     catch
     {
         Stop();
         throw;
     }
 }