/// <summary>
        /// Determines whether the specified Object is equal to the current Object.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (obj == this)
            {
                return(true);
            }

            AudioSettingsInfo other = obj as AudioSettingsInfo;

            if (obj == null)
            {
                return(false);
            }

            if (!(Volume.Equals(other.Volume) &&
                  Mute.Equals(other.Mute) &&
                  Devices.Equals(other.Devices)))
            {
                return(false);
            }

            IEnumerator <DeviceInfo> otherEnumerator = other.Devices.GetEnumerator();
            IEnumerator <DeviceInfo> ownEnumerator   = Devices.GetEnumerator();

            while (ownEnumerator.MoveNext() && otherEnumerator.MoveNext())
            {
                if (!ownEnumerator.Current.Equals(otherEnumerator.Current))
                {
                    return(false);
                }
            }

            return(ownEnumerator.MoveNext() != otherEnumerator.MoveNext());
        }
        /// <summary>
        /// Occurs when the recording settings has been changed.
        /// </summary>
        /// <param name="info">Contains information about the settings.</param>
        public void MicrophoneSettingsHasChanged(AudioSettingsInfo info)
        {
            if (microphone == null) return;

            microphone.Volume = info.Volume;
            microphone.Muted = info.Mute;

            if (microphone.DeviceInfo.DeviceID != info.SelectedDevice)
            {
                  var list = Microphone.GetDevices();
                  foreach (var audioDeviceInfo in list)
                  {
                      if (audioDeviceInfo.DeviceID == info.SelectedDevice)
                      {
                          microphone.Stop();
                          microphone.LevelChanged -= (Microphone_LevelChanged);
                          mediaConnector.Disconnect(microphone, AudioProcessor);
                          microphone = Microphone.GetDevice(audioDeviceInfo);
                          mediaConnector.Connect(microphone,AudioProcessor);
                          microphone.LevelChanged += (Microphone_LevelChanged);
                          microphone.Start();
                      }
                  }
            }
        }
        /// <summary>
        /// Occurs when the playback settings has been changed
        /// </summary>
        /// <param name="info">Contains information about the settings</param>
        public void SpeakerSettingsHasChanged(AudioSettingsInfo info)
        {
            if (speaker == null) return;

            speaker.Volume = info.Volume;
            speaker.Muted = info.Mute;
            if (speaker.DeviceInfo.DeviceID != info.SelectedDevice)
            {
                var list = Speaker.GetDevices();
                foreach (var speakerDeviceInfo in list)
                {
                    if (speakerDeviceInfo.DeviceID == info.SelectedDevice)
                    {
                        speaker.Stop();
                        speaker.LevelChanged -= (Speaker_LevelChanged);
                        mediaConnector.Disconnect(incomingDataMixer, speaker);
                        speaker = Speaker.GetDevice(speakerDeviceInfo);
                        mediaConnector.Connect(incomingDataMixer,speaker);
                        speaker.LevelChanged += (Speaker_LevelChanged);
                        speaker.Start();
                    }
                }
            }
        }