From ad22489be7dc1c79c7214465acc51d28a580a4cb Mon Sep 17 00:00:00 2001
From: Extremesecrecy <10959169+extremesecrecy@users.noreply.github.com>
Date: Wed, 23 Jul 2025 19:37:11 -0700
Subject: [PATCH] Same Device Con't
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When “Use same device” is enabled, changing that setting now ensures the input device also supports playback, switching to the first bidirectional device if necessary
The input device dropdown hides devices lacking playback capability whenever the same-device option is active
The device change handlers now call “applyAlsaDevices” with the latest settings to recalculate latency and validation, ensuring UI state matches valid ALSA configurations
“applyAlsaDevices” accepts an optional same-device flag so callers can specify when input and output devices should be treated as identica
---
vite/src/pipedal/JackServerSettingsDialog.tsx | 34 ++++++++++---------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/vite/src/pipedal/JackServerSettingsDialog.tsx b/vite/src/pipedal/JackServerSettingsDialog.tsx
index c90166d..f4879bd 100644
--- a/vite/src/pipedal/JackServerSettingsDialog.tsx
+++ b/vite/src/pipedal/JackServerSettingsDialog.tsx
@@ -162,11 +162,6 @@ function getBestBuffers(
{
return { bufferSize:bufferSize, numberOfBuffers: numberOfBuffers};
}
- const device = inDevice || outDevice;
- if (!device)
- {
- return { bufferSize:bufferSize, numberOfBuffers:numberOfBuffers};
- }
// If the numberOfbuffers is fine as is, don't change the number of Buffers.
// set default values. Otherwise, choose the best buffer count from available buffer counts.
@@ -286,7 +281,7 @@ const JackServerSettingsDialog = withStyles(
});
}
- applyAlsaDevices(jackServerSettings: JackServerSettings, alsaDevices?: AlsaDeviceInfo[]) {
+ applyAlsaDevices(jackServerSettings: JackServerSettings, alsaDevices?: AlsaDeviceInfo[], useSameDevice?: boolean) {
let result = jackServerSettings.clone();
if (!alsaDevices || alsaDevices.length === 0) {
result.valid = false;
@@ -310,7 +305,8 @@ const JackServerSettingsDialog = withStyles(
}
}
- if (this.state.useSameDevice) {
+ const sameDevice = useSameDevice !== undefined ? useSameDevice : this.state.useSameDevice;
+ if (sameDevice) {
result.alsaOutputDevice = result.alsaInputDevice;
outDevice = inDevice;
}
@@ -437,34 +433,40 @@ const JackServerSettingsDialog = withStyles(
if (this.state.useSameDevice) {
s.alsaOutputDevice = d;
}
+ let settings = this.applyAlsaDevices(s, this.state.alsaDevices);
this.setState({
- jackServerSettings: s,
- okEnabled: isOkEnabled(s, this.state.alsaDevices)
+ jackServerSettings: settings,
+ latencyText: getLatencyText(settings),
+ okEnabled: isOkEnabled(settings, this.state.alsaDevices)
});
}
- handleOutputDeviceChanged(e: any) {
+ handleOutputDeviceChanged(e: any) {
const d = e.target.value as string;
let s = this.state.jackServerSettings.clone();
s.alsaOutputDevice = d;
if (this.state.useSameDevice) {
s.alsaInputDevice = d;
}
+ let settings = this.applyAlsaDevices(s, this.state.alsaDevices);
this.setState({
- jackServerSettings: s,
- okEnabled: isOkEnabled(s, this.state.alsaDevices)
+ jackServerSettings: settings,
+ latencyText: getLatencyText(settings),
+ okEnabled: isOkEnabled(settings, this.state.alsaDevices)
});
}
- handleUseSameDeviceChanged(e: any, checked: boolean) {
+ handleUseSameDeviceChanged(e: any, checked: boolean) {
let s = this.state.jackServerSettings.clone();
const useSame = checked;
if (useSame) {
s.alsaOutputDevice = s.alsaInputDevice;
}
+ let settings = this.applyAlsaDevices(s, this.state.alsaDevices, useSame);
this.setState({
useSameDevice: useSame,
- jackServerSettings: s,
- okEnabled: isOkEnabled(s, this.state.alsaDevices)
+ jackServerSettings: settings,
+ latencyText: getLatencyText(settings),
+ okEnabled: isOkEnabled(settings, this.state.alsaDevices)
});
}
render() {
@@ -509,7 +511,7 @@ const JackServerSettingsDialog = withStyles(
disabled={!this.state.alsaDevices || this.state.alsaDevices.length === 0}
style={{ width: 220 }}
>
- {this.state.alsaDevices?.filter(d => d.supportsCapture).map(d => (
+ {this.state.alsaDevices?.filter(d => d.supportsCapture && (!this.state.useSameDevice || d.supportsPlayback)).map(d => (
)) || }