private void Dispose(bool manually) { if (!this.disposed) { this.disposed = true; DualityApp.AppDataChanged -= this.DualityApp_AppDataChanged; // Shut down the streaming thread if (this.streamWorker != null) { this.streamWorkerEnd = true; if (!this.streamWorker.Join(1000)) { this.streamWorker.Abort(); } this.streamWorkerQueueEvent.Dispose(); this.streamWorkerEnd = false; this.streamWorkerQueueEvent = null; this.streamWorkerQueue = null; this.streamWorker = null; } try { // Clear all playing sounds foreach (SoundInstance inst in this.sounds) { inst.Dispose(); } this.sounds.Clear(); // Clear all audio related Resources ContentProvider.RemoveAllContent <AudioData>(); ContentProvider.RemoveAllContent <Sound>(); // Clear OpenAL source pool foreach (int alSource in this.alSourcePool) { AL.DeleteSource(alSource); } // Shut down OpenAL context if (this.context != null) { this.context.Dispose(); this.context = null; } AudioLibraryLoader.UnloadAudioLibrary(); } catch (Exception e) { Log.Core.WriteError("An error occured while shutting down OpenAL: {0}", Log.Exception(e)); } } }
private void Dispose(bool manually) { if (!this.disposed) { this.disposed = true; DualityApp.AppDataChanged -= this.DualityApp_AppDataChanged; foreach (SoundInstance inst in this.sounds) { inst.Dispose(); } this.sounds.Clear(); ContentProvider.RemoveAllContent <Sound>(); if (this.context != null) { this.context.Dispose(); this.context = null; } } }