diff --git a/app/components-react/windows/advanced-audio/SourceSettings.tsx b/app/components-react/windows/advanced-audio/SourceSettings.tsx index 5f4210540db0..012f2355dd07 100644 --- a/app/components-react/windows/advanced-audio/SourceSettings.tsx +++ b/app/components-react/windows/advanced-audio/SourceSettings.tsx @@ -298,28 +298,30 @@ function DeviceInputs(p: { source: Source }) { }); setStatefulSettings({ ...statefulSettings, [name]: value }); } + const isOutputCapture: boolean = p.source.type === 'wasapi_process_output_capture'; + const settingId = isOutputCapture ? statefulSettings.window : statefulSettings.device_id; + const inputField = isOutputCapture ? 'window' : 'device_id'; + const inputLabel = isOutputCapture ? 'Window' : 'Device'; + const foundDevice: boolean = deviceOptions.some(option => option.value === settingId); - const input = - p.source.type === 'wasapi_process_output_capture' ? ( - handleInput('window', value)} - /> - ) : ( - handleInput('device_id', value)} - /> - ); + // Ensure the input is still valid. If not, reset to Default device which should be at index 0. + const inputId = + foundDevice || deviceOptions.length === 0 ? settingId : deviceOptions[0].value; + if (!foundDevice && deviceOptions.length > 0) { + handleInput(inputField, deviceOptions[0].value); + } return ( <> - {input} - {p.source.type !== 'wasapi_process_output_capture' && handleInput(inputField, value)} + /> + } + {!isOutputCapture && handleInput('use_device_timing', value)}