예제 #1
0
 public override void UninitializeAudio()
 {
     if (null != _audioEndpointVolume)
     {
         _audioEndpointVolume.UnregisterControlChangeNotify(classCallBack);
     }
     if (null != _audioClient)
     {
         _audioClient.Stop();
     }
     if (null != _audioMeter)
     {
         //For wait audio meter thread stop. then release memory
         Thread.Sleep(100);
         Marshal.ReleaseComObject(_audioMeter);
         _audioMeter = null;
     }
     if (null != _audioClient)
     {
         Marshal.ReleaseComObject(_audioClient);
         _audioClient = null;
     }
     if (null != _audioEndpointVolume)
     {
         Marshal.ReleaseComObject(_audioEndpointVolume);
         _audioEndpointVolume = null;
     }
     if (null != waveFormat)
     {
         waveFormat = null;
     }
     base.UninitializeAudio();
 }
예제 #2
0
 public void Dispose()
 {
     if (_CallBack != null)
     {
         Marshal.ThrowExceptionForHR(_AudioEndPointVolume.UnregisterControlChangeNotify(_CallBack));
         _CallBack = null;
     }
 }
예제 #3
0
 protected override void Dispose(bool disposing)
 {
     if (callBack != null)
     {
         audioEndPointVolume.UnregisterControlChangeNotify(callBack);
         callBack = null;
     }
 }
예제 #4
0
 /// <summary>
 /// Dispose
 /// </summary>
 public void Dispose()
 {
     if (callBack != null)
     {
         Marshal.ThrowExceptionForHR(audioEndPointVolume.UnregisterControlChangeNotify(callBack));
         callBack = null;
     }
     GC.SuppressFinalize(this);
 }
예제 #5
0
        public void Dispose()
        {
            if (_callBack == null)
            {
                return;
            }

            Marshal.ThrowExceptionForHR(_audioEndpointVolume.UnregisterControlChangeNotify(_callBack));
            _callBack = null;
        }
예제 #6
0
        /// <summary>
        ///     Dispose
        /// </summary>
        public void Dispose()
        {
            if (_callBack != null)
            {
                ComThread.BeginInvoke(() =>
                {
                    _audioEndPointVolume.UnregisterControlChangeNotify(_callBack);
                    _callBack            = null;
                    _audioEndPointVolume = null;
                });
            }

            GC.SuppressFinalize(this);
        }
예제 #7
0
 // The bulk of the clean-up code is implemented in Dispose(bool)
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         // free managed resources here
         if (callBack != null)
         {
             Marshal.ThrowExceptionForHR(_AudioEndPointVolume.UnregisterControlChangeNotify(callBack));
             callBack.Dispose();
             callBack = null;
         }
     }
     // free native resources here if there are any.
 }
예제 #8
0
 public void Dispose()
 {
     if (_CallBack != null)
     {
         try
         {
             Marshal.ThrowExceptionForHR(_AudioEndPointVolume.UnregisterControlChangeNotify(_CallBack));
         }
         catch (Exception)
         {
             // Catch if no device is found
         }
         _CallBack = null;
     }
 }