private void ChangeAudioSettings(AudioSettingsInfo audioSettings) { IWavePlayer newPlayer = audioSettings.CreateWavePlayer(); IWavePlayer oldPlayer = Interlocked.Exchange(ref _wavePlayer, newPlayer); oldPlayer.SafeDispose(); newPlayer.PlaybackStopped += OnPlaybackStopped; }