From 90b050bca401d4a1233aaf8e558c8e41166c524e Mon Sep 17 00:00:00 2001 From: Extremesecrecy <10959169+extremesecrecy@users.noreply.github.com> Date: Wed, 23 Jul 2025 20:23:02 -0700 Subject: [PATCH] Update JackServerSettingsDialog.tsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enhanced “same device” configuration to validate that the selected input device also supports playback, falling back to a device with both capabilities if necessary Updated the “Use same device” change handler so it automatically picks a valid device that supports both capture and playback when enabled Modified the input device label to display “Device” when using the same device for input and output, maintaining consistency with the configuration --- vite/src/pipedal/JackServerSettingsDialog.tsx | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/vite/src/pipedal/JackServerSettingsDialog.tsx b/vite/src/pipedal/JackServerSettingsDialog.tsx index f4879bd..755e6dc 100644 --- a/vite/src/pipedal/JackServerSettingsDialog.tsx +++ b/vite/src/pipedal/JackServerSettingsDialog.tsx @@ -305,10 +305,25 @@ const JackServerSettingsDialog = withStyles( } } - const sameDevice = useSameDevice !== undefined ? useSameDevice : this.state.useSameDevice; + const sameDevice = useSameDevice !== undefined ? useSameDevice : this.state.useSameDevice; if (sameDevice) { - result.alsaOutputDevice = result.alsaInputDevice; - outDevice = inDevice; + if (!inDevice || !inDevice.supportsPlayback) { + const both = alsaDevices.find(d => d.supportsCapture && d.supportsPlayback); + if (both) { + result.alsaInputDevice = both.id; + result.alsaOutputDevice = both.id; + inDevice = both; + outDevice = both; + } else { + result.valid = false; + result.alsaInputDevice = INVALID_DEVICE_ID; + result.alsaOutputDevice = INVALID_DEVICE_ID; + return result; + } + } else { + result.alsaOutputDevice = result.alsaInputDevice; + outDevice = inDevice; + } } if (!inDevice || !outDevice) { @@ -459,7 +474,20 @@ const JackServerSettingsDialog = withStyles( let s = this.state.jackServerSettings.clone(); const useSame = checked; if (useSame) { - s.alsaOutputDevice = s.alsaInputDevice; + const inputDev = this.state.alsaDevices?.find(d => d.id === s.alsaInputDevice && d.supportsCapture); + if (!inputDev || !inputDev.supportsPlayback) { + const both = this.state.alsaDevices?.find(d => d.supportsCapture && d.supportsPlayback); + if (both) { + s.alsaInputDevice = both.id; + s.alsaOutputDevice = both.id; + } else { + s.alsaInputDevice = INVALID_DEVICE_ID; + s.alsaOutputDevice = INVALID_DEVICE_ID; + s.valid = false; + } + } else { + s.alsaOutputDevice = s.alsaInputDevice; + } } let settings = this.applyAlsaDevices(s, this.state.alsaDevices, useSame); this.setState({ @@ -503,7 +531,7 @@ const JackServerSettingsDialog = withStyles(