private void Dispose(bool isDisposing) { if (_isDisposed) { return; } if (isDisposing) { _info.Dispose(); _info = null; _requestListenersDelegates.Clear(); _requestListenersDelegates = null; _indexTriggerIdToName.Clear(); _indexTriggerIdToName = null; _triggerByName.Clear(); _triggerByName = null; } //remove listener from c++ IntPtr fnPtr = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(_requestListener); NativeAudioSystem.RemoveAudioRequestListener(fnPtr); _requestListener = null; _isDisposed = true; }
private static void RemoveListener() { if (_requestListener == null) { return; } // Remove listener from c++ IntPtr fnPtr = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(_requestListener); NativeAudioSystem.RemoveAudioRequestListener(fnPtr); _requestListener = null; }