Beispiel #1
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                // free managed resources
                if (soundInSource != null)
                {
                    soundInSource.Dispose();
                    soundInSource = null;
                }

                if (mMDeviceEnumerator != null)
                {
                    mMDeviceEnumerator.Dispose();
                    mMDeviceEnumerator = null;
                }

                if (mMNotificationClient != null)
                {
                    mMNotificationClient.Dispose();
                    mMNotificationClient = null;
                }

                if (_soundIn != null)
                {
                    _soundIn.Dispose();
                    _soundIn = null;
                }
            }
        }
Beispiel #2
0
 void client_DefaultDeviceChanged(object sender, DefaultDeviceChangedEventArgs e)
 {
     if (Settings.SoundOutDeviceID == "-0" && e.DeviceID != _currentDeviceId)
     {
         _currentDeviceId = e.DeviceID;
         Thread t = new Thread(() =>
         {
             Thread.Sleep(100);
             Application.Current.Dispatcher.Invoke(UpdateSoundOut);
         })
         {
             IsBackground = true
         };
         t.Start();
     }
     _client.Dispose();
 }
Beispiel #3
0
 private void UnloadMMnotify()
 {
     M.D(190, "UnloadMMnotify");
     if (MMN != null)
     {
         MMN.DefaultDeviceChanged -= MMN_DefaultDeviceChanged;
         MMN.DeviceStateChanged   -= MMN_DeviceStateChanged;
         MMN.DeviceRemoved        -= MMN_DeviceRemoved;
     }
     MMN.Dispose();
     M.D(199);
 }
        /// <summary>
        /// Called to dispose/finalize contained objects.
        /// </summary>
        /// <param name="disposing">True if disposing, false if called from a finalizer.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_notificationClient != null)
                {
                    _notificationClient.Dispose();
                    _notificationClient = null;
                }

                if (_realEnumerator != null)
                {
                    // although GC would do this for us, we want it done now
                    Marshal.ReleaseComObject(_realEnumerator);
                    _realEnumerator = null;
                }
            }
        }
        public void Dispose()
        {
            // Client up our MM objects in reverse order
            if (iAudioEndpointVolumeMixerCallback != null && iAudioEndpointVolume != null)
            {
                iAudioEndpointVolume.UnregisterControlChangeNotify(iAudioEndpointVolumeMixerCallback);
            }

            if (iAudioEndpointVolumeMixerCallback != null)
            {
                iAudioEndpointVolumeMixerCallback.NotifyRecived -= iVolumeChangedHandler;
                iAudioEndpointVolumeMixerCallback = null;
            }

            if (iAudioEndpointVolume != null)
            {
                iAudioEndpointVolume.Dispose();
                iAudioEndpointVolume = null;
            }

            if (_mMdevice != null)
            {
                _mMdevice.Dispose();
                _mMdevice = null;
            }

            if (iMultiMediaNotificationClient != null)
            {
                iMultiMediaNotificationClient.DefaultDeviceChanged -= iDefaultDeviceChangedHandler;
                iMultiMediaNotificationClient.Dispose();
                iMultiMediaNotificationClient = null;
            }

            if (_mMdeviceEnumerator != null)
            {
                _mMdeviceEnumerator.Dispose();
                _mMdeviceEnumerator = null;
            }
            Stop();
            Close();
        }
Beispiel #6
0
 public void Dispose()
 {
     _mmNotificationClient.Dispose();
 }
Beispiel #7
0
 public void Dispose()
 {
     _mmNotificationClient.Dispose();
     SystemEvents.PowerModeChanged -= SystemEvents_PowerModeChanged;
 }