private void CleanupResources() { if (_directSoundNotify != null) { _directSoundNotify.Dispose(); _directSoundNotify = null; } if (_secondaryBuffer != null) { _secondaryBuffer.Stop(); _secondaryBuffer.Dispose(); _secondaryBuffer = null; } if (_primaryBuffer != null) { _primaryBuffer.Stop(); _primaryBuffer.Dispose(); _primaryBuffer = null; } if (_directSound != null) { _directSound.Dispose(); _directSound = null; } _isInitialized = false; }