示例#1
0
        /// <summary>
        /// Stops the audio capture and disposes of the recorder.
        /// </summary>
        /// <returns>true, if the operation was successful</returns>
        /// <seealso cref="WasapiRecorder"/>
        /// <seealso cref="WasapiRecorder.Stop"/>
        public bool StopAudio()
        {
            if (_audio == null)
            {
                return(false);
            }

            _audio.Dispose();
            _audio = null;
            return(true);
        }
示例#2
0
        /// <summary>
        /// Creates the audio recorder and starts capture with the specified parameters.
        /// </summary>
        /// <param name="sampleRate">the target sample rate</param>
        /// <param name="bitsPerSample">the target bits per sample</param>
        /// <returns>true, if the operation was successful</returns>
        /// <seealso cref="WasapiRecorder"/>
        /// <seealso cref="WasapiRecorder.Start"/>
        public bool StartAudio(int sampleRate, int bitsPerSample)
        {
            if (_audio != null)
            {
                return(false);
            }

            _audio = new WasapiRecorder(sampleRate, bitsPerSample, _dataHandler);
            _audio.Start();
            return(true);
        }