/// <summary> /// Disposes of the resources used by this SoundPlayer instance. /// <param name="Disposed">Was this resource disposed explicitly?</param> /// </summary> protected virtual void Dispose(bool Disposed) { if (Disposed) { if (m_ASound != null) { m_ASound.Dispose(); } //Short answer: Don't bother disposing of your tasks. //https://devblogs.microsoft.com/pfxteam/do-i-need-to-dispose-of-tasks/ /*if (m_StreamingTask != null) * { * m_StreamingTask.Wait(); * m_StreamingTask.Dispose(); * }*/ // Prevent the finalizer from calling ~SoundPlayer, since the object is already disposed at this point. GC.SuppressFinalize(this); } else { m_Logger.Error("Soundplayer not explicitly disposed!"); } }
/// <summary> /// Disposes of the resources used by this MP3Player instance. /// <param name="CleanUpNativeAndManagedResources">Should both native and managed resources be cleaned?</param> /// </summary> protected virtual void Dispose(bool CleanUpNativeAndManagedResources) { if (CleanUpNativeAndManagedResources) { if (m_ASound != null) { m_ASound.Dispose(); } } }
/// <summary> /// Disposes of the resources used by this SoundPlayer instance. /// <param name="Disposed">Was this resource disposed explicitly?</param> /// </summary> protected virtual void Dispose(bool Disposed) { if (Disposed) { if (m_ASound != null) { m_ASound.Dispose(); } if (m_StreamingTask != null) { m_StreamingTask.Dispose(); } // Prevent the finalizer from calling ~SoundPlayer, since the object is already disposed at this point. GC.SuppressFinalize(this); } else { m_Logger.Error("Soundplayer not explicitly disposed!"); } }