示例#1
0
 /// <summary>
 /// 结束喊话
 /// </summary>
 private void StopCollectSound()
 {
     try
     {
         if (!IsRecoding)
         {
             return;
         }
         //停止音频采集
         var rtn = PcmAudio.waveInStop(hRecord);
         if (rtn == 0) //停止采集成功,立即重置设备,重置设备将会导致所有的buffer反馈给程序
         {
             IsRecoding = false;
             //ShowMsg("停止采集音频数据。");
             rtn = PcmAudio.waveInReset(hRecord);  //重置设备
         }
         Thread.Sleep(500);
         if (rtn == 0)                            //重置设备成功,立即关闭设备
         {
             rtn = PcmAudio.waveInClose(hRecord); //关闭设备
         }
         //GC.Collect();
     }
     catch (Exception ex)
     {
         //ShowMsg(ex.Message);
     }
 }