Beispiel #1
0
        /// <summary>
        /// constructs the recorder which means setting up a first input stream
        /// that is passed to the volume control
        /// </summary>
        public Recorder()
        {
            waveIn            = new NAudio.Wave.WaveIn();
            waveIn.WaveFormat = new NAudio.Wave.WaveFormat(8000, 1);

            waveIn.DataAvailable += new EventHandler <NAudio.Wave.WaveInEventArgs>(waveIn_DataAvailableVolume);
            aggregator            = new SampleAggregator();
            waveIn.StartRecording();
        }
Beispiel #2
0
        /// <summary>
        /// when recording is stopped the current input stream and filewriter are discarded
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void waveIn_RecordingStopped(object sender, NAudio.Wave.StoppedEventArgs e)
        {
            if (waveIn != null)
            {
                waveIn.Dispose();
                waveIn            = new NAudio.Wave.WaveIn();
                waveIn.WaveFormat = new NAudio.Wave.WaveFormat(8000, 1);

                waveIn.DataAvailable += new EventHandler <NAudio.Wave.WaveInEventArgs>(waveIn_DataAvailableVolume);
                aggregator            = new SampleAggregator();
                waveIn.StartRecording();
            }

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