Exemple #1
0
        /// <summary>
        /// Start the Microphone
        /// </summary>
        async public void Start()
        {
            bool shouldStart = false;

            lock (startStopLock)
            {
                this.Reset();

                // don't try to restart over an existing session, call Stop first
                if (!this.startedCapturing)
                {
                    this.startedCapturing = true;
                    shouldStart           = true; // can't do the await inside the lock
                }
            }

            if (shouldStart)
            {
                this.waveIn = new WasapiCapture(); // gets the default capture device
                this.waveIn.DataAvailableEventHandler += CaptureDataAvailable;
                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                              () =>
                {
                    this.waveIn.StartRecording();
                });

                this.EventWriterDLL.FlushBuildString(EventWriterDLL.SeverityTypes.Information, 0x01);
                await Task.Delay(10);
            }
        }
        /// <summary>
        /// Start the Microphone
        /// </summary>
        public void Start()
        {
            this.waveIn = new WasapiCapture(); // gets the default capture device
            //this.waveIn.DataAvailable += CaptureDataAvailable;
            //await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
            //() =>
            //{
            //    this.waveIn.StartRecording();
            //});

            //this.startedCapturing = true;

            //await Task.Delay(100);
        }
Exemple #3
0
        /// <summary>
        /// Stop the Microphone.
        /// </summary>
        async public void Stop()
        {
            lock (startStopLock)
            {
                if (this.waveIn != null)
                {
                    this.waveIn.StopRecording();
                    this.waveIn = null;
                }
                this.startedCapturing = false;
            }
            await Task.Delay(10);

            this.Reset();
        }