コード例 #1
0
 public void StopRecording()
 {
     if (SoundCardRecorder == null)
     {
         throw new Exception(""); //TODO needs mutexes prolly
     }
     SoundCardRecorder.Stop();
     SoundCardRecorder.Dispose();
     SoundCardRecorder = null;
 }
コード例 #2
0
        public void StartRecording(MMDevice device)
        {
            if (device == null)
            {
                throw new Exception("");
            }
            if (SoundCardRecorder != null)
            {
                throw new Exception(""); //TODO needs mutexes prolly
            }

            SoundCardRecorder = new SoundCardRecorder(device);
            SoundCardRecorder.Start();
        }
コード例 #3
0
        public ToolsAudioGrab()
        {
            DeviceEnumerator = new NAudio.CoreAudioApi.MMDeviceEnumerator();
            var devices = DeviceEnumerator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active).ToList();

            // instantiate the sound recorder once in an attempt to reduce lag the first time used
            try
            {
                SoundCardRecorder = new SoundCardRecorder((MMDevice)devices[0]);
                SoundCardRecorder.Dispose();
                SoundCardRecorder = null;
            }
            catch (Exception)
            {
            }
        }