private void RegisterStateChangedCallback() { _stateChangedCallback = (IntPtr handle, int previous, int current, bool byPolicy, IntPtr _) => { _state = (AudioIOState)current; StateChanged?.Invoke(this, new AudioIOStateChangedEventArgs((AudioIOState)previous, _state, byPolicy)); }; AudioIOUtil.ThrowIfError( AudioInput.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero)); }
private void RegisterStateChangedCallback() { _stateChangedCallback = (IntPtr handle, int previous, int current, bool byPolicy, IntPtr _) => { _state = (AudioIOState)current; StateChanged?.Invoke(this, new AudioIOStateChangedEventArgs((AudioIOState)previous, _state, byPolicy)); }; AudioOutput.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero) .ThrowIfFailed("Failed to set state changed callback."); }
internal static extern int SetStateChangedCallback(IntPtr handle, AudioStateChangedCallback callback, IntPtr user_data);