Пример #1
0
        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));
        }
Пример #2
0
        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.");
        }
Пример #3
0
 internal static extern int SetStateChangedCallback(IntPtr handle, AudioStateChangedCallback callback, IntPtr user_data);