Revert "Split IO"
This commit is contained in:
@@ -9,8 +9,6 @@ export default class AlsaDeviceInfo {
|
||||
this.sampleRates = input.sampleRates as number[];
|
||||
this.minBufferSize = input.minBufferSize;
|
||||
this.maxBufferSize = input.maxBufferSize;
|
||||
this.supportsCapture = input.supportsCapture ? true : false;
|
||||
this.supportsPlayback = input.supportsPlayback ? true : false;
|
||||
return this;
|
||||
}
|
||||
static deserialize_array(input: any): AlsaDeviceInfo[]
|
||||
@@ -64,7 +62,5 @@ export default class AlsaDeviceInfo {
|
||||
longName: string = "";
|
||||
sampleRates: number[] = [];
|
||||
minBufferSize: number = 0;
|
||||
maxBufferSize: number = 0;
|
||||
supportsCapture: boolean = false;
|
||||
supportsPlayback: boolean = false;
|
||||
maxBufferSize: number = 0;
|
||||
};
|
||||
@@ -25,8 +25,7 @@ export default class JackServerSettings {
|
||||
this.isOnboarding = input.isOnboarding;
|
||||
this.isJackAudio = input.isJackAudio;
|
||||
this.rebootRequired = input.rebootRequired;
|
||||
this.alsaInputDevice = input.alsaInputDevice ?? "";
|
||||
this.alsaOutputDevice = input.alsaOutputDevice ?? "";
|
||||
this.alsaDevice = input.alsaDevice?? "";
|
||||
this.sampleRate = input.sampleRate;
|
||||
this.bufferSize = input.bufferSize;
|
||||
this.numberOfBuffers = input.numberOfBuffers;
|
||||
@@ -40,7 +39,7 @@ export default class JackServerSettings {
|
||||
// if (numberOfBuffers) {
|
||||
// this.valid = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
clone(): JackServerSettings
|
||||
{
|
||||
return new JackServerSettings().deserialize(this);
|
||||
@@ -49,18 +48,16 @@ export default class JackServerSettings {
|
||||
isOnboarding: boolean = true;
|
||||
rebootRequired = false;
|
||||
isJackAudio = false;
|
||||
alsaInputDevice: string = "";
|
||||
alsaOutputDevice: string = "";
|
||||
alsaDevice: string = "";
|
||||
sampleRate = 48000;
|
||||
bufferSize = 64;
|
||||
numberOfBuffers = 3;
|
||||
|
||||
getSummaryText() {
|
||||
if (this.valid) {
|
||||
let inDev = this.alsaInputDevice.startsWith("hw:") ? this.alsaInputDevice .substring(3) : this.alsaInputDevice;
|
||||
let outDev = this.alsaOutputDevice.startsWith("hw:") ? this.alsaOutputDevice.substring(3) : this.alsaOutputDevice;
|
||||
return "In: "+inDev+" Out: "+outDev+" — Rate "+this.sampleRate+", "+this.bufferSize+"×"+this.numberOfBuffers;
|
||||
|
||||
let device = this.alsaDevice;
|
||||
if (device.startsWith("hw:")) device = device.substring(3);
|
||||
return device + " - Rate: " + this.sampleRate + " BufferSize: " + this.bufferSize + " Buffers: " + this.numberOfBuffers;
|
||||
} else {
|
||||
return "Not configured";
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
import { Component } from 'react';
|
||||
@@ -40,8 +40,6 @@ import DialogContent from '@mui/material/DialogContent';
|
||||
import MenuItem from '@mui/material/MenuItem';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import { PiPedalModel, PiPedalModelFactory } from './PiPedalModel';
|
||||
import IconButtonEx from './IconButtonEx';
|
||||
import RefreshIcon from '@mui/icons-material/Refresh';
|
||||
|
||||
import AlsaDeviceInfo from './AlsaDeviceInfo';
|
||||
|
||||
@@ -116,22 +114,6 @@ function getValidBufferCounts(bufferSize: number, alsaDeviceInfo?: AlsaDeviceInf
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function intersectArrays(a: number[], b: number[]): number[] {
|
||||
return a.filter((v) => b.indexOf(v) !== -1);
|
||||
}
|
||||
|
||||
function getValidBufferCountsMultiple(bufferSize: number, inDevice?: AlsaDeviceInfo, outDevice?: AlsaDeviceInfo): number[] {
|
||||
let c1 = getValidBufferCounts(bufferSize, inDevice);
|
||||
if (!outDevice) return c1;
|
||||
return intersectArrays(c1, getValidBufferCounts(bufferSize, outDevice));
|
||||
}
|
||||
|
||||
function getValidBufferSizesMultiple(inDevice?: AlsaDeviceInfo, outDevice?: AlsaDeviceInfo): number[] {
|
||||
let s1 = getValidBufferSizes(inDevice);
|
||||
if (!outDevice) return s1;
|
||||
return intersectArrays(s1, getValidBufferSizes(outDevice));
|
||||
}
|
||||
function getValidBufferSizes(alsaDeviceInfo? : AlsaDeviceInfo): number[]
|
||||
{
|
||||
if (!alsaDeviceInfo )
|
||||
@@ -149,31 +131,23 @@ function getValidBufferSizes(alsaDeviceInfo? : AlsaDeviceInfo): number[]
|
||||
return result;
|
||||
}
|
||||
function getBestBuffers(
|
||||
inDevice: AlsaDeviceInfo | undefined,
|
||||
outDevice: AlsaDeviceInfo | undefined,
|
||||
bufferSize: number,
|
||||
alsaDeviceInfo: AlsaDeviceInfo | undefined,
|
||||
bufferSize: number,
|
||||
numberOfBuffers: number,
|
||||
bufferSizeChanging: boolean = false
|
||||
) : BufferSetting {
|
||||
if (!inDevice && !outDevice)
|
||||
if (!alsaDeviceInfo)
|
||||
{
|
||||
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.
|
||||
let validBuffercounts = getValidBufferCountsMultiple(bufferSize,inDevice,outDevice);
|
||||
const minSize = Math.max(inDevice?.minBufferSize ?? MIN_BUFFER_SIZE, outDevice?.minBufferSize ?? MIN_BUFFER_SIZE);
|
||||
const maxSize = Math.min(inDevice?.maxBufferSize ?? MAX_BUFFER_SIZE, outDevice?.maxBufferSize ?? MAX_BUFFER_SIZE);
|
||||
let validBuffercounts = getValidBufferCounts(bufferSize,alsaDeviceInfo);
|
||||
let ix = validBuffercounts.indexOf(numberOfBuffers);
|
||||
if (ix !== -1) {
|
||||
if (bufferSize*numberOfBuffers <= maxSize
|
||||
&& bufferSize*numberOfBuffers >= minSize)
|
||||
if (bufferSize*numberOfBuffers <= alsaDeviceInfo.maxBufferSize
|
||||
&& bufferSize*numberOfBuffers >= alsaDeviceInfo.minBufferSize)
|
||||
{
|
||||
return {bufferSize: bufferSize, numberOfBuffers: numberOfBuffers};
|
||||
}
|
||||
@@ -200,15 +174,15 @@ function getBestBuffers(
|
||||
// otherwise select a sensible starting value.
|
||||
|
||||
// favored default: 64x3.
|
||||
if (64*3 >= minSize && 64*3 <= maxSize)
|
||||
if (64*3 >= alsaDeviceInfo.minBufferSize && 64*3 <= alsaDeviceInfo.maxBufferSize)
|
||||
{
|
||||
return { bufferSize: 64, numberOfBuffers: 3};
|
||||
}
|
||||
// if that isn't possible then minBufferSize/2 x 4.
|
||||
bufferSize = minSize/2;
|
||||
bufferSize = alsaDeviceInfo.minBufferSize/2;
|
||||
numberOfBuffers = 4;
|
||||
// otherwise, minBufferSize/2 x 2.
|
||||
if (bufferSize*numberOfBuffers > maxSize)
|
||||
if (bufferSize*numberOfBuffers > alsaDeviceInfo.maxBufferSize)
|
||||
{
|
||||
numberOfBuffers = 2;
|
||||
}
|
||||
@@ -220,21 +194,29 @@ function isOkEnabled(jackServerSettings: JackServerSettings, alsaDevices?: AlsaD
|
||||
{
|
||||
if (!jackServerSettings.valid) return false;
|
||||
if (!alsaDevices) return false;
|
||||
const inDevice = alsaDevices.find(d => d.id === jackServerSettings.alsaInputDevice && d.supportsCapture);
|
||||
const outDevice = alsaDevices.find(d => d.id === jackServerSettings.alsaOutputDevice && d.supportsPlayback);
|
||||
if (!inDevice || !outDevice) return false;
|
||||
|
||||
const deviceBufferSize = jackServerSettings.bufferSize * jackServerSettings.numberOfBuffers;
|
||||
const minSize = Math.max(inDevice.minBufferSize, outDevice.minBufferSize);
|
||||
const maxSize = Math.min(inDevice.maxBufferSize, outDevice.maxBufferSize);
|
||||
if (deviceBufferSize < minSize || deviceBufferSize > maxSize) return false;
|
||||
|
||||
const validBufferCounts = getValidBufferCountsMultiple(jackServerSettings.bufferSize, inDevice, outDevice);
|
||||
if (validBufferCounts.indexOf(jackServerSettings.numberOfBuffers) === -1) return false;
|
||||
|
||||
const sampleRates = intersectArrays(inDevice.sampleRates, outDevice.sampleRates);
|
||||
if (sampleRates.indexOf(jackServerSettings.sampleRate) === -1) return false;
|
||||
|
||||
let alsaDevice: AlsaDeviceInfo | undefined = undefined;
|
||||
for (let i = 0; i < alsaDevices.length; ++i)
|
||||
{
|
||||
if (alsaDevices[i].id === jackServerSettings.alsaDevice)
|
||||
{
|
||||
alsaDevice = alsaDevices[i];
|
||||
}
|
||||
}
|
||||
if (!alsaDevice)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
let deviceBufferSize = jackServerSettings.bufferSize * jackServerSettings.numberOfBuffers;
|
||||
if (deviceBufferSize < alsaDevice.minBufferSize || deviceBufferSize > alsaDevice.maxBufferSize)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
let validBufferCounts = getValidBufferCounts(jackServerSettings.bufferSize, alsaDevice);
|
||||
let ix = validBufferCounts.indexOf(jackServerSettings.numberOfBuffers);
|
||||
if (ix === -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -282,49 +264,35 @@ const JackServerSettingsDialog = withStyles(
|
||||
|
||||
applyAlsaDevices(jackServerSettings: JackServerSettings, alsaDevices?: AlsaDeviceInfo[]) {
|
||||
let result = jackServerSettings.clone();
|
||||
if (!alsaDevices || alsaDevices.length === 0) {
|
||||
result.valid = false;
|
||||
result.alsaInputDevice = INVALID_DEVICE_ID;
|
||||
result.alsaOutputDevice = INVALID_DEVICE_ID;
|
||||
if (!alsaDevices) {
|
||||
return result;
|
||||
}
|
||||
result.valid = false;
|
||||
if (alsaDevices.length === 0) {
|
||||
result.alsaDevice = INVALID_DEVICE_ID;
|
||||
return result;
|
||||
}
|
||||
|
||||
let inDevice = alsaDevices.find(d => d.id === result.alsaInputDevice && d.supportsCapture);
|
||||
let outDevice = alsaDevices.find(d => d.id === result.alsaOutputDevice && d.supportsPlayback);
|
||||
if (!inDevice) {
|
||||
inDevice = alsaDevices.find(d => d.supportsCapture);
|
||||
if (inDevice) {
|
||||
result.alsaInputDevice = inDevice.id;
|
||||
}
|
||||
}
|
||||
if (!outDevice) {
|
||||
outDevice = alsaDevices.find(d => d.supportsPlayback);
|
||||
if (outDevice) {
|
||||
result.alsaOutputDevice = outDevice.id;
|
||||
let selectedDevice: AlsaDeviceInfo | undefined = undefined;
|
||||
for (let i = 0; i < alsaDevices.length; ++i) {
|
||||
if (alsaDevices[i].id === result.alsaDevice) {
|
||||
selectedDevice = alsaDevices[i]
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!selectedDevice) {
|
||||
selectedDevice = alsaDevices[0];
|
||||
result.alsaDevice = selectedDevice.id;
|
||||
|
||||
if (!inDevice || !outDevice) {
|
||||
result.valid = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
if (result.sampleRate === 0) result.sampleRate = 48000;
|
||||
let sampleRates = intersectArrays(inDevice.sampleRates, outDevice.sampleRates);
|
||||
if (sampleRates.length === 0) sampleRates = inDevice.sampleRates;
|
||||
let bestSr = sampleRates[0];
|
||||
let bestErr = 1e36;
|
||||
for (let sr of sampleRates) {
|
||||
let err = (sr - result.sampleRate) * (sr - result.sampleRate);
|
||||
if (err < bestErr) { bestErr = err; bestSr = sr; }
|
||||
}
|
||||
result.sampleRate = bestSr;
|
||||
if (result.sampleRate === 0) result.sampleRate = 48000;
|
||||
result.sampleRate = selectedDevice.closestSampleRate(result.sampleRate);
|
||||
|
||||
let bestBuffers = getBestBuffers(inDevice, outDevice, result.bufferSize, result.numberOfBuffers);
|
||||
let bestBuffers = getBestBuffers(selectedDevice,result.bufferSize,result.numberOfBuffers);
|
||||
result.bufferSize = bestBuffers.bufferSize;
|
||||
result.numberOfBuffers = bestBuffers.numberOfBuffers;
|
||||
|
||||
result.valid = !!result.alsaInputDevice && !!result.alsaOutputDevice;
|
||||
result.valid = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -353,22 +321,37 @@ const JackServerSettingsDialog = withStyles(
|
||||
this.mounted = false;
|
||||
|
||||
}
|
||||
getSelectedDevice(deviceId: string): AlsaDeviceInfo | undefined {
|
||||
if (!this.state.alsaDevices) return undefined;
|
||||
getSelectedDevice(deviceId: string): AlsaDeviceInfo | null {
|
||||
if (!this.state.alsaDevices) return null;
|
||||
for (let i = 0; i < this.state.alsaDevices.length; ++i) {
|
||||
if (this.state.alsaDevices[i].id === deviceId) {
|
||||
return this.state.alsaDevices[i];
|
||||
}
|
||||
|
||||
}
|
||||
return undefined;
|
||||
return null;
|
||||
}
|
||||
|
||||
handleDeviceChanged(e: any) {
|
||||
let device = e.target.value as string;
|
||||
|
||||
let selectedDevice = this.getSelectedDevice(device);
|
||||
if (!selectedDevice) return;
|
||||
let settings = this.state.jackServerSettings.clone();
|
||||
settings.alsaDevice = device;
|
||||
settings = this.applyAlsaDevices(settings,this.state.alsaDevices);
|
||||
|
||||
this.setState({
|
||||
jackServerSettings: settings,
|
||||
latencyText: getLatencyText(settings),
|
||||
okEnabled: isOkEnabled(settings,this.state.alsaDevices)
|
||||
});
|
||||
}
|
||||
handleRateChanged(e: any) {
|
||||
let rate = e.target.value as number;
|
||||
let inDev = this.getSelectedDevice(this.state.jackServerSettings.alsaInputDevice);
|
||||
let outDev = this.getSelectedDevice(this.state.jackServerSettings.alsaOutputDevice);
|
||||
if (!inDev && !outDev) return;
|
||||
console.log("New rate: " + rate);
|
||||
let selectedDevice = this.getSelectedDevice(this.state.jackServerSettings.alsaDevice);
|
||||
if (!selectedDevice) return;
|
||||
let settings = this.state.jackServerSettings.clone();
|
||||
settings.sampleRate = rate;
|
||||
|
||||
@@ -381,12 +364,11 @@ const JackServerSettingsDialog = withStyles(
|
||||
handleSizeChanged(e: any) {
|
||||
let size = e.target.value as number;
|
||||
|
||||
let inDev = this.getSelectedDevice(this.state.jackServerSettings.alsaInputDevice);
|
||||
let outDev = this.getSelectedDevice(this.state.jackServerSettings.alsaOutputDevice);
|
||||
if (!inDev && !outDev) return;
|
||||
let selectedDevice = this.getSelectedDevice(this.state.jackServerSettings.alsaDevice);
|
||||
if (!selectedDevice) return;
|
||||
let settings = this.state.jackServerSettings.clone();
|
||||
settings.bufferSize = size;
|
||||
let bestBufferSetting = getBestBuffers(inDev,outDev,settings.bufferSize,settings.numberOfBuffers,true);
|
||||
let bestBufferSetting = getBestBuffers(selectedDevice,settings.bufferSize,settings.numberOfBuffers,true);
|
||||
settings.bufferSize = bestBufferSetting.bufferSize;
|
||||
settings.numberOfBuffers = bestBufferSetting.numberOfBuffers;
|
||||
|
||||
@@ -399,9 +381,8 @@ const JackServerSettingsDialog = withStyles(
|
||||
handleNumberOfBuffersChanged(e: any) {
|
||||
let bufferCount = e.target.value as number;
|
||||
|
||||
let inDev = this.getSelectedDevice(this.state.jackServerSettings.alsaInputDevice);
|
||||
let outDev = this.getSelectedDevice(this.state.jackServerSettings.alsaOutputDevice);
|
||||
if (!inDev && !outDev) return;
|
||||
let selectedDevice = this.getSelectedDevice(this.state.jackServerSettings.alsaDevice);
|
||||
if (!selectedDevice) return;
|
||||
let settings = this.state.jackServerSettings.clone();
|
||||
settings.numberOfBuffers = bufferCount;
|
||||
|
||||
@@ -418,25 +399,7 @@ const JackServerSettingsDialog = withStyles(
|
||||
this.props.onApply(this.state.jackServerSettings.clone());
|
||||
}
|
||||
};
|
||||
handleInputDeviceChanged(e: any) {
|
||||
const d = e.target.value as string;
|
||||
let s = this.state.jackServerSettings.clone();
|
||||
s.alsaInputDevice = d;
|
||||
this.setState({
|
||||
jackServerSettings: s,
|
||||
okEnabled: isOkEnabled(s, this.state.alsaDevices)
|
||||
});
|
||||
}
|
||||
|
||||
handleOutputDeviceChanged(e: any) {
|
||||
const d = e.target.value as string;
|
||||
let s = this.state.jackServerSettings.clone();
|
||||
s.alsaOutputDevice = d;
|
||||
this.setState({
|
||||
jackServerSettings: s,
|
||||
okEnabled: isOkEnabled(s, this.state.alsaDevices)
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const classes = withStyles.getClasses(this.props);
|
||||
|
||||
@@ -445,17 +408,21 @@ const JackServerSettingsDialog = withStyles(
|
||||
const handleClose = () => {
|
||||
onClose();
|
||||
};
|
||||
|
||||
let selectedInputDevice = this.getSelectedDevice(this.state.jackServerSettings.alsaInputDevice);
|
||||
let selectedOutputDevice = this.getSelectedDevice(this.state.jackServerSettings.alsaOutputDevice);
|
||||
|
||||
let bufferSizes: number[] = getValidBufferSizesMultiple(selectedInputDevice, selectedOutputDevice);
|
||||
let bufferCounts = getValidBufferCountsMultiple(this.state.jackServerSettings.bufferSize, selectedInputDevice, selectedOutputDevice);
|
||||
let bufferSizeDisabled = !(selectedInputDevice || selectedOutputDevice);
|
||||
let bufferCountDisabled = !(selectedInputDevice || selectedOutputDevice);
|
||||
let sampleRates = selectedInputDevice && selectedOutputDevice ?
|
||||
intersectArrays(selectedInputDevice.sampleRates, selectedOutputDevice.sampleRates)
|
||||
: (selectedInputDevice ? selectedInputDevice.sampleRates : (selectedOutputDevice ? selectedOutputDevice.sampleRates : []));
|
||||
let waitingForDevices = !this.state.alsaDevices
|
||||
let noDevices = this.state.alsaDevices && this.state.alsaDevices.length === 0;
|
||||
let selectedDevice: AlsaDeviceInfo | undefined = undefined;
|
||||
if (this.state.alsaDevices) {
|
||||
for (let device of this.state.alsaDevices) {
|
||||
if (device.id === this.state.jackServerSettings.alsaDevice) {
|
||||
selectedDevice = device;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
let bufferSizes: number[] = getValidBufferSizes(selectedDevice);
|
||||
let bufferCounts = getValidBufferCounts(this.state.jackServerSettings.bufferSize,selectedDevice);
|
||||
let bufferSizeDisabled = !selectedDevice;
|
||||
let bufferCountDisabled = !selectedDevice;
|
||||
|
||||
return (
|
||||
<DialogEx tag="jack" onClose={handleClose} aria-labelledby="select-channels-title" open={open}
|
||||
@@ -465,48 +432,39 @@ const JackServerSettingsDialog = withStyles(
|
||||
|
||||
>
|
||||
<DialogContent>
|
||||
<div style={{ display: "flex", alignItems: "center" }}>
|
||||
{/* Audio Input Device */}
|
||||
<div>
|
||||
<FormControl className={classes.formControl}>
|
||||
<InputLabel htmlFor="jsd_inputDevice">Input Device</InputLabel>
|
||||
<Select
|
||||
id="jsd_inputDevice"
|
||||
value={this.state.jackServerSettings.alsaInputDevice}
|
||||
onChange={e => this.handleInputDeviceChanged(e)}
|
||||
disabled={!this.state.alsaDevices || this.state.alsaDevices.length === 0}
|
||||
style={{ width: 220 }}
|
||||
>
|
||||
{this.state.alsaDevices?.filter(d => d.supportsCapture).map(d => (
|
||||
<MenuItem key={d.id} value={d.id}>{d.name}</MenuItem>
|
||||
)) || <MenuItem value="" disabled>Loading...</MenuItem>}
|
||||
</Select>
|
||||
</FormControl>
|
||||
<InputLabel htmlFor="jsd_device">Device</InputLabel>
|
||||
<Select variant="standard" onChange={(e) => this.handleDeviceChanged(e)}
|
||||
value={this.state.jackServerSettings.alsaDevice}
|
||||
style={{width: 220}}
|
||||
inputProps={{
|
||||
name: "Device",
|
||||
id: "jsd_device",
|
||||
}}
|
||||
>
|
||||
{(noDevices && !waitingForDevices) &&
|
||||
(
|
||||
<MenuItem value={INVALID_DEVICE_ID}>No suitable devices.</MenuItem>
|
||||
)
|
||||
}
|
||||
{((!noDevices) && !waitingForDevices) && (
|
||||
this.state.alsaDevices!.map((device) =>
|
||||
(
|
||||
<MenuItem key={device.id} value={device.id}>{device.name}</MenuItem>
|
||||
)
|
||||
|
||||
{/* Audio Output Device */}
|
||||
<FormControl className={classes.formControl}>
|
||||
<InputLabel htmlFor="jsd_outputDevice">Output Device</InputLabel>
|
||||
<Select
|
||||
id="jsd_outputDevice"
|
||||
value={this.state.jackServerSettings.alsaOutputDevice}
|
||||
onChange={e => this.handleOutputDeviceChanged(e)}
|
||||
disabled={!this.state.alsaDevices || this.state.alsaDevices.length === 0}
|
||||
style={{ width: 220 }}
|
||||
>
|
||||
{this.state.alsaDevices?.filter(d => d.supportsPlayback).map(d => (
|
||||
<MenuItem key={d.id} value={d.id}>{d.name}</MenuItem>
|
||||
)) || <MenuItem value="" disabled>Loading...</MenuItem>}
|
||||
</Select>
|
||||
</FormControl>
|
||||
<IconButtonEx tooltip="Refresh devices" onClick={() => this.requestAlsaInfo()} aria-label="refresh-audio-devices">
|
||||
<RefreshIcon />
|
||||
</IconButtonEx>
|
||||
)
|
||||
)}
|
||||
</Select>
|
||||
</FormControl>
|
||||
</div><div>
|
||||
<FormControl className={classes.formControl}>
|
||||
<InputLabel htmlFor="jsd_sampleRate">Sample rate</InputLabel>
|
||||
<Select variant="standard"
|
||||
onChange={(e) => this.handleRateChanged(e)}
|
||||
value={this.state.jackServerSettings.sampleRate}
|
||||
disabled={sampleRates.length === 0}
|
||||
disabled={!selectedDevice}
|
||||
inputProps={{
|
||||
id: 'jsd_sampleRate',
|
||||
style: {
|
||||
@@ -514,9 +472,11 @@ const JackServerSettingsDialog = withStyles(
|
||||
}
|
||||
}}
|
||||
>
|
||||
{sampleRates.map((sr) => {
|
||||
return (<MenuItem value={sr}>{sr}</MenuItem> );
|
||||
})}
|
||||
{selectedDevice &&
|
||||
selectedDevice.sampleRates.map((sr) => {
|
||||
return ( <MenuItem value={sr}>{sr}</MenuItem> );
|
||||
})
|
||||
}
|
||||
</Select>
|
||||
</FormControl>
|
||||
<div style={{ display: "inline", whiteSpace: "nowrap" }}>
|
||||
|
||||
Reference in New Issue
Block a user