Exemplo n.º 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));
            };

            AudioOutput.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero)
            .ThrowIfFailed("Failed to set state changed callback.");
        }
Exemplo n.º 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));
            };

            AudioIOUtil.ThrowIfError(
                AudioOutput.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero),
                $"Failed to create {nameof(AudioPlayback)}");
        }