Пример #1
0
        /// <summary>
        /// Destroys the audio renderer.
        /// Makes it useless.
        /// </summary>
        private void Destroy()
        {
            try
            {
                if (Application.Current != null)
                {
                    Runner.UIInvoke(DispatcherPriority.Send, () =>
                    {
                        Application.Current.Exit -= OnApplicationExit;
                    });
                }
            }
            catch { }

            if (AudioDevice != null)
            {
                AudioDevice.Pause();
                AudioDevice.Dispose();
                AudioDevice = null;
            }

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

            if (AudioProcessor != null)
            {
                AudioProcessor.Dispose();
                AudioProcessor = null;
            }
        }
        /// <summary>
        /// Destroys the audio renderer.
        /// Makes it useless.
        /// </summary>
        private void Destroy()
        {
            lock (SyncLock)
            {
                if (AudioDevice != null)
                {
                    AudioDevice.Dispose();
                    AudioDevice = null;
                }

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

                if (AudioProcessor == null)
                {
                    return;
                }

                AudioProcessor.Dispose();
                AudioProcessor = null;
            }
        }
Пример #3
0
        /// <summary>
        /// Destroys the audio renderer.
        /// Makes it useless.
        /// </summary>
        private void Destroy()
        {
            lock (SyncLock)
            {
                try
                {
                    if (Application.Current != null)
                    {
                        WindowsPlatform.Instance.Gui?.Invoke(DispatcherPriority.Send, () =>
                        {
                            Application.Current.Exit -= OnApplicationExit;
                        });
                    }
                }
                catch
                {
                    // ignored
                }

                if (AudioDevice != null)
                {
                    AudioDevice.Pause();
                    AudioDevice.Dispose();
                    AudioDevice = null;
                }

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

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