Exemple #1
0
 public override void windowsClosed()
 {
     if (newWaveIn != null)
     {
         newWaveIn.StopRecording();
         stopListening();
     }
 }
Exemple #2
0
 private void buttonStop_Click(object sender, EventArgs e)
 {
     timer.Enabled = false;
     if (!stopped)
     {
         waveIn.StopRecording();
     }
 }
Exemple #3
0
 public void Dispose()
 {
     if (_waveIn != null)
     {
         _waveIn.StopRecording();
         _waveIn.DataAvailable -= OnDataAvailable;
         _waveIn.Dispose();
     }
     _writer?.Close();
 }
Exemple #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (_recording)
     {
         waveIn.StopRecording();
     }
     else
     {
         _recording = true;
         waveIn.StartRecording();
         SendGameEvent();
     }
 }
Exemple #5
0
 /// <summary>
 /// If a file is being recorded, stop recording and tidy up the stream.
 /// </summary>
 private void StopRecording()
 {
     recordButton.Text = recordText;
     if (dataEvent)
     {
         waveIn.DataAvailable -= OnDataAvailable;
         dataEvent             = false;
     }
     if (waveIn != null)
     {
         waveIn.StopRecording();
     }
     FinalizeWaveFile(writer);
 }
 public void Dispose()
 {
     if (wave_in != null)
     {
         wave_in.StopRecording();
         wave_in.Dispose();
         wave_in = null;
     }
     if (writer != null)
     {
         writer.Close();
         writer = null;
     }
 }
Exemple #7
0
 public void Dispose()
 {
     if (_waveIn != null)
     {
         _waveIn.StopRecording();
         _waveIn.Dispose();
         _waveIn = null;
     }
     if (_writer != null)
     {
         _writer.Close();
         _writer = null;
     }
 }
        private void StopReading()
        {
            input?.StopRecording();

            Start.Enabled = true;
            Stop.Enabled  = false;
        }
 private void ExecuteStop()
 {
     //SpectralAnaliser0.Stop();
     //SpectralAnaliser1.Stop();
     wave_in.StopRecording();
     wave_in.Dispose();
 }
 private void InitializeWaveIn()
 {
     if (_waveIn != null)
     {
         _waveIn.StopRecording();
         _waveIn.DataAvailable    -= OnDataAvailable;
         _waveIn.RecordingStopped -= OnRecordingStopped;
         _waveIn.Dispose();
     }
     _waveIn = new WaveInEvent {
         WaveFormat = new WaveFormat(SAMPLING_RATE, SAMPLING_BITS, SAMPLING_CHANNELS)
     };
     //_waveIn = new WasapiCapture((MMDevice)ComboBoxRecordingDevice.SelectedItem);
     _waveIn.DataAvailable    += OnDataAvailable;
     _waveIn.RecordingStopped += OnRecordingStopped;
 }
Exemple #11
0
        private void EndStreaming()
        {
            streaming = false;

            if (gzipCompressor != null)
            {
                gzipCompressor.Close();
                gzipCompressor.Dispose();
            }

            if (waveIn != null)
            {
                waveIn.StopRecording();
                waveIn.Dispose();
                waveIn = null;
            }

            if (keyboardHook != null)
            {
                keyboardHook.Dispose();
                keyboardHook = null;
            }

            Disconnect();
            UpdateTrayMenuAndIcon();
        }
Exemple #12
0
        //private void DisposeAudioWriters() {
        //    mutAudioFileProcess.WaitOne();

        //    audioFileWriters = null;
        //    mutAudioFileProcess.ReleaseMutex();
        //}



        public void Dispose()
        {
            isDisposing = true;
            camera.StopCameras();
            camera.Dispose();
            mutAudioFileProcess.Dispose();
            mutVideoRecord.Dispose();
            try
            {
                threadVideoDisplay.Join();
                threadVideoDisplay = null;

                threadVideoFrameExtract.Join();
                threadVideoFrameExtract = null;

                threadAudioDisplay.Join();
                threadAudioDisplay = null;
                AudioDataAvailable = null;
                VideoDataAvailable = null;
                // audio complete
                audioCaptureDevice.DataAvailable -= OnAudioDataAvailable;
                audioCaptureDevice.StopRecording();
                audioCaptureDevice.Dispose();
            }
            catch (Exception e)
            {
                Debug.WriteLine($"An exception occured when the {field.ToString()}-view Kinect is being closed!");
                Debug.WriteLine(e.ToString());
            }
        }
Exemple #13
0
 public void Stop()
 {
     _waveIn.StopRecording();
     _waveIn.Dispose();
     _waveIn = null;
     //_buffer = null;
 }
Exemple #14
0
 public void close()
 {
     if (!_online)
     {
         return;
     }
     // Close Device
     if (openDev.audioDeviceType == AudioDeviceType.Windows)
     {
         try
         {
             waveIn.StopRecording();
             waveIn.Dispose();
         }
         catch (Exception E)
         {
         }
         waveIn  = null;
         openDev = null;
     }
     else     // WASAPI Device
     {
         try
         {
             WASAPIwaveIn.StopRecording();
             WASAPIwaveIn.Dispose();
         }
         catch (Exception E)
         {
         }
         WASAPIwaveIn = null;
         openDev      = null;
     }
     _online = false;
 }
Exemple #15
0
 private void StopRecording()
 {
     if (recorder != null)
     {
         recorder.StopRecording();
     }
 }
Exemple #16
0
 public void Dispose(ref string tex)
 {
     lock (mixOut)
     {
         if (startReading != null)
         {
             startReading.Dispose();
             startReading = null;
         }
     }
     Logger.mix.a("dispose recCap"); tex = "recCap"; if (recCap != null)
     {
         recCap.StopRecording();
     }
     Logger.mix.a("dispose micCap"); tex = "micCap"; if (micCap != null)
     {
         micCap.StopRecording();
     }
     Logger.mix.a("dispose mixOut"); tex = "mixOut"; if (mixOut != null)
     {
         mixOut.Dispose();
     }
     Logger.mix.a("dispose recRe"); tex = "recRe"; if (recRe != null)
     {
         recRe.Dispose();
     }
     Logger.mix.a("dispose micRe"); tex = "micRe"; if (micRe != null)
     {
         micRe.Dispose();
     }
     Logger.mix.a("disposed");
 }
Exemple #17
0
 /// <summary>断开与音频输入设备的连接</summary>
 public void Stop()
 {
     if (this.IsRunning)
     {
         if (waveIn == null)
         {
             return;
         }
         try
         {
             waveIn.StopRecording();
             waveIn.Dispose();
         }
         catch (Exception ex)
         {
             Console.WriteLine(" -> audio.stop.error");
             Console.WriteLine(ex.ToString());
         }
         finally
         {
             waveIn = null;
         }
     }
     this.IsRunning = false;
 }
Exemple #18
0
        public void CloseRecording()
        {
            if (captureDevice != null)
            {
                captureDevice.StopRecording();
            }

            if (writer != null)
            {
                // this will fix up the data lengths in the recorded memory stream
                writer.Close();
                writer = null;
                recordedStream.Position = 0;
                RaiseCaptureStopped();
            }
        }
Exemple #19
0
 private void StopRecording()
 {
     if (waveIn != null)
     {
         waveIn.StopRecording();
     }
     FinalizeWaveFile(writer);
 }
Exemple #20
0
 public void Recordstop()
 {
     //Debug.WriteLine("StopRecording");
     if (waveIn != null)
     {
         waveIn.StopRecording();
     }
 }
Exemple #21
0
 /// <summary>
 /// 停止录音
 /// </summary>
 public void StopRecording()
 {
     if (m_WaveIn != null)
     {
         m_WaveIn?.StopRecording();
     }
     Cleanup();
 }
 public void StopRecording()
 {
     if (_waveIn == null)
     {
         return;
     }
     _waveIn.StopRecording();
 }
Exemple #23
0
 public void StopRecording()
 {
     waveIn.StopRecording();
     waveIn.Dispose();
     waveFileWriter.Close();
     OnRecordingStopped();
     ConvertWavToMp3Thread();
 }
Exemple #24
0
 // 停止录音的外部接口
 public void StopRecording()
 {
     waveIn.StopRecording();
     waveIn.Dispose();
     waveIn = null;
     writer.Dispose();
     writer = null;
 }
Exemple #25
0
 void StopRecording()
 {
     Debug.WriteLine("StopRecording");
     if (waveIn != null)
     {
         waveIn.StopRecording();
     }
 }
Exemple #26
0
 public void Stop()
 {
     if (GetStatus == true)
     {
         waveIn.StopRecording();
         GetStatus = false;
     }
 }
 public void StopAudioAlgorithm()
 {
     waveIn.StopRecording();
     _laserAnimationStatus.AnimationSpeed    = AnimationSpeed.Off;
     _laserAnimationStatus.AnimationCanceled = true;
     _timer.Enabled = false;
     _timer.Stop();
 }
Exemple #28
0
 public void Stop()
 {
     if (!_isrecording)
     {
         return;
     }
     _isrecording = false;
     _waveIn.StopRecording();
 }
Exemple #29
0
 void StopRecording()
 {
     Debug.WriteLine("StopRecording");
     //captureDevice?.StopRecording();
     if (captureDevice != null)
     {
         captureDevice.StopRecording();
     }
 }
        protected override void OnHandleDestroyed(EventArgs e)
        {
            player?.Stop();
            player?.Dispose();
            recorder?.StopRecording();
            recorder?.Dispose();

            base.OnHandleDestroyed(e);
        }
        public MemoryStream GetWavSample(int seconds, string filepath)
        {
            var stream = new MemoryStream();
            _fileName = filepath;
            _waveIn = new WasapiLoopbackCapture();
            _writer = new WaveFileWriter(stream, _waveIn.WaveFormat);
            _waveIn.DataAvailable += OnDataAvailable;
            _waveIn.RecordingStopped += OnRecordingStopped;
            _waveIn.StartRecording();
            _isRecording = true;
            System.Threading.Thread.Sleep(seconds * 1000);
            _waveIn.StopRecording();

            if (filepath != "")
                using (var file = new FileStream(filepath, FileMode.Create, FileAccess.Write))
                    stream.WriteTo(file);

            return stream;
        }