{"record":{"id":"7c57bdeb329bcc35","repo":"babalae/better-genshin-impact","slug":"error-7c57bd","errorCode":null,"errorMessage":"等待进程音频接口激活超时","messagePattern":"等待进程音频接口激活超时","errorType":"exception","errorClass":"TimeoutException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoSkip/Audio/ProcessLoopbackAudioCapture.cs","lineNumber":359,"sourceCode":"            {\n                if (!_disposed)\n                {\n                    try\n                    {\n                        _completed.Set();\n                    }\n                    catch (ObjectDisposedException)\n                    {\n                    }\n                }\n            }\n        }\n\n        public IAudioClient WaitForAudioClient()\n        {\n            if (!_completed.Wait(TimeSpan.FromSeconds(5)))\n            {\n                throw new TimeoutException(\"等待进程音频接口激活超时\");\n            }\n\n            if (_exception != null)\n            {\n                throw _exception;\n            }\n\n            return _audioClient ?? throw new InvalidOperationException(\"进程音频接口激活失败\");\n        }\n\n        public void Dispose()\n        {\n            _disposed = true;\n            _completed.Dispose();\n        }\n    }\n}\n","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoSkip/Audio/ProcessLoopbackAudioCapture.cs#L341-L377","documentation":"TimeoutException raised by AudioInterfaceActivationHandler.WaitForAudioClient when the WinRT ActivateAudioInterfaceAsync completion handler does not signal _completed within 5 seconds. The activation is for per-process loopback capture (PROCESS_LOOPBACK) on the Genshin process. Timeouts typically mean the COM activation never called ActivateCompleted.","triggerScenarios":"Calling ProcessLoopbackAudioCapture on a process that has no active audio stream/graph yet; calling before the game has initialized its audio client; Windows audio service (Audiosrv) stalled or disabled; target process already exited (targetProcessId stale) so the async activation hangs.","commonSituations":"AutoSkip's voice-dialogue detection started before Genshin finishes loading; audio device disabled/muted at OS level; WASAPI loopback unsupported on the configured endpoint; user switched default audio device mid-session; game launched without sound.","solutions":["Ensure Windows audio service is running and a default render endpoint is enabled.","Start the audio capture only after the game is fully loaded and on the main world screen.","Verify the targetProcessId is still a live Genshin process before activating.","Disable the AutoSkip voice-detection feature if no microphone/audio output is available.","Retry capture activation after a short delay (game audio client spins up lazily)."],"exampleFix":"// before\nif (!_completed.Wait(TimeSpan.FromSeconds(5)))\n    throw new TimeoutException(\"等待进程音频接口激活超时\");\n\n// after: extend the wait and surface a hint\nvar timeout = TimeSpan.FromSeconds(15);\nif (!_completed.Wait(timeout))\n    throw new TimeoutException($\"等待进程音频接口激活超时（{timeout.TotalSeconds:0}s）。请确认游戏已加载且 Windows 音频服务正常。\");","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { client = handler.WaitForAudioClient(); }\ncatch (TimeoutException) { /* audio client not ready yet; disable voice detection and continue without audio */ Logger.LogWarning(\"音频接口激活超时，关闭语音跳过检测\"); }","preventionTips":["Defer audio-capture start until the game reports 'loaded' state.","Verify Windows audio service + a default render endpoint before activating.","Make the voice-based AutoSkip feature degrade to silent skipping on audio failure."],"tags":["audio","wasapi","timeout","com","loopback"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}