Ejemplo n.º 1
0
 private void Stop()
 {
     if (m_Player != null)
     {
         try
         {
             m_Player.Active = false;
             m_Player.Dispose();
         }
         finally
         {
             m_Player = null;
         }
     }
     if (m_Recorder != null)
     {
         try
         {
             m_Recorder.Active = false;
             m_Recorder.Dispose();
         }
         finally
         {
             m_Recorder = null;
         }
     }
 }
Ejemplo n.º 2
0
        private void Start()
        {
            Stop();
            System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
            try
            {//16384
                DSELib.Audio.Wave.Win32.WaveFormat fmt = new DSELib.Audio.Wave.Win32.WaveFormat(DSELib.Audio.Wave.Enums.Enum_SampleRates.SampleRates_8_0_kHz, DSELib.Audio.Wave.Enums.Enum_BitRates.BitRates_8bit, DSELib.Audio.Wave.Enums.Enum_Channels.Channels_Mono);

                m_Player            = new DSELib.Audio.Wave.WaveOutDevice(-1, fmt, (int)(fmt.BytesPerSecond / 20));
                m_Player.DataStream = m_Stream;
                m_Player.Active     = true;

                m_Recorder              = new DSELib.Audio.Wave.WaveInDevice(-1, fmt, (int)(fmt.BytesPerSecond / 40));
                m_Recorder.OnProcessed += new DSELib.Audio.Wave.ProcessedEventHandler(DataArrived);
                m_Recorder.Active       = true;
            }
            catch
            {
                Stop();
                throw;
            }
        }