private void ReleaseUnmanagedResources() { using (var handle = _handle.Lock()) { if (handle.Value != IntPtr.Zero) { ClearFilterPreprocessor(throwOnError: false); AudioPluginDissonanceNative.Dissonance_DestroyPreprocessor(handle.Value); handle.Value = IntPtr.Zero; } } }
public void Reset() { using (var handle = _handle.Lock()) { Log.Debug("Resetting WebRtcPreprocessor"); if (handle.Value != IntPtr.Zero) { //Clear from playback filter. This internally acquires a lock and will not complete until it is safe to (i.e. no one else is using the preprocessor concurrently). ClearFilterPreprocessor(); //Destroy it AudioPluginDissonanceNative.Dissonance_DestroyPreprocessor(handle.Value); handle.Value = IntPtr.Zero; } //Create a new one handle.Value = CreatePreprocessor(); //Associate with playback filter SetFilterPreprocessor(handle.Value); } }