Exemple #1
0
        private BooleanMixerControl GetMuteControl()
        {
            var waveInEvent = new NAudio.Wave.WaveInEvent();

            try
            {
                //get mixer of default audio device
                var mixer = waveInEvent.GetMixerLine();
                var muter = mixer.Controls.FirstOrDefault(x => x.ControlType == NAudio.Mixer.MixerControlType.Mute) as BooleanMixerControl;
                if (muter == null)
                {
                    throw new Exception(BadMicrophoneMessage);
                }

                return(muter);
            }
            finally
            {
                waveInEvent.Dispose();
            }
        }