예제 #1
0
        void sourceOutStream_RecordingStopped(object sender, StoppedEventArgs e)
        {
            if (sourceOutStream != null)
            {
                sourceOutStream.Dispose();
                sourceOutStream = null;
            }

            if (waveWriter != null)
            {
                waveWriter.Close();
                waveWriter.Dispose();
                waveWriter = null;
            }
            if (equalizerWrite != null)
            {
                equalizerWrite = null;
            }
        }
예제 #2
0
        void InitOutputStream(string path)
        {
            sourceOutStream = new WasapiLoopbackCapture();

            sourceOutStream.DataAvailable    += new EventHandler <WaveInEventArgs>(sourceOutStream_DataAvailable);
            sourceOutStream.RecordingStopped += new EventHandler <StoppedEventArgs>(sourceOutStream_RecordingStopped);

            string fullName = string.Format(@"{0}\{1}_{2}.wav", path,
                                            Environment.UserName.ToUpper(),
                                            DateTime.Now.ToString("d_MMM_yyyy_HH_mm_ssff"));

            waveWriter = new WaveFileWriter(fullName, sourceOutStream.WaveFormat);

            equalizerWrite = new EqualizerForWrite(eqBand, sourceOutStream.WaveFormat.Channels,
                                                   sourceOutStream.WaveFormat.SampleRate);

            sourceOutStream.StartRecording();

            OnThreadLabelTimeEventStart();
        }