Ejemplo n.º 1
0
        private static void RegisterFocusStateWatch()
        {
            _focusStateWatchCallback = (id, options, focusState, reason, extraInfo, _) =>
            {
                _streamFocusStateChanged?.Invoke(null,
                                                 new StreamFocusStateChangedEventArgs(options, focusState, reason, extraInfo));
            };

            Interop.AudioStreamPolicy.AddFocusStateWatchCallback(
                AudioStreamFocusOptions.Playback | AudioStreamFocusOptions.Recording,
                _focusStateWatchCallback, IntPtr.Zero, out var cbId).
            ThrowIfError("Failed to initialize focus state event");
        }
Ejemplo n.º 2
0
        private static void RegisterFocusStateWatch()
        {
            _focusStateWatchCallback = (int id, AudioStreamFocusOptions options, AudioStreamFocusState focusState,
                                        AudioStreamFocusChangedReason reason, string extraInfo, IntPtr userData) =>
            {
                _streamFocusStateChanged?.Invoke(null,
                                                 new StreamFocusStateChangedEventArgs(options, focusState, reason, extraInfo));
            };

            Interop.AudioStreamPolicy.AddFocusStateWatchCallback(
                AudioStreamFocusOptions.Playback | AudioStreamFocusOptions.Recording,
                _focusStateWatchCallback, IntPtr.Zero, out var cbId).
            Validate("Failed to initialize focus state event");
        }