コード例 #1
0
        public void BeginAudioCapture()
        {
            try
            {
                AudioAgent.StopAudioCapture();

                if (SelectedCaptureDevicesCollection.Any())
                {
                    AudioAgent.BeginAudioCapture(SelectedCaptureDevicesCollection.First());
                }
            }
            catch (Exception ex)
            {
                ApplicationLogger.Log(ex.Message, ex.StackTrace);
            }
        }
コード例 #2
0
        private void OnAudioMeterTimerElapsed(object sender, EventArgs e)
        {
            try
            {
                if (SelectedCaptureDevicesCollection.Any())
                {
                    SelectedCaptureDevicesCollection[0].AudioPeak = (int)(WasapiLoopbackCapture.GetDefaultLoopbackCaptureDevice().AudioMeterInformation.MasterPeakValue * 100);
                }

                SelectedOutputDevicesCollection.ToList().ForEach(outputDevice =>
                {
                    outputDevice.AudioPeak = (int)(outputDevice.AudioMeterInformation?.MasterPeakValue ?? 0 * 100);
                });
            }
            catch (Exception ex)
            {
                ApplicationLogger.Log(ex.Message, ex.StackTrace);
            }
        }