Tabs and check script and dependency

Removed tabs (tabs to spaces). Remove the check_deps.sh. removed libwebsocketpp-dev from dependencies. BTW, this is in cmake.yml.
This commit is contained in:
Extremesecrecy
2025-07-24 20:31:40 -07:00
parent 225eddcf96
commit 56d66ef7db
17 changed files with 94 additions and 134 deletions
+2 -10
View File
@@ -21,21 +21,13 @@ Run the following commands to install dependent libraries required by the PiPeda
sudo apt update sudo apt update
sudo apt upgrade sudo apt upgrade
sudo apt install -y liblilv-dev libboost-dev \ sudo apt install -y liblilv-dev libboost-dev \
libsystemd-dev catch libasound2-dev uuid-dev \ libsystemd-dev catch libasound2-dev uuid-dev \
authbind libavahi-client-dev libnm-dev libicu-dev \ authbind libavahi-client-dev libnm-dev libicu-dev \
libsdbus-c++-dev libzip-dev google-perftools \ libsdbus-c++-dev libzip-dev google-perftools \
libgoogle-perftools-dev \ libgoogle-perftools-dev \
libpipewire-0.3-dev libwebsocketpp-dev libpipewire-0.3-dev
After installing these packages, run the dependency checker to verify that
everything required is present:
```bash
cd ~/src/pipedal
./scripts/check_deps.sh
```
### Installing Sources ### Installing Sources
+1 -3
View File
@@ -13,8 +13,6 @@ available through the Code plugins store) has configured itself, build commands
If you are not using Visual Studio Code, you can configure, build and install PiPedal using CMake build tools. For your convenience, If you are not using Visual Studio Code, you can configure, build and install PiPedal using CMake build tools. For your convenience,
the following shell scripts have been provided in the root of the project. the following shell scripts have been provided in the root of the project.
./scripts/check_deps.sh # Verify required system packages
./init.sh # Configure the CMake build for the first time, or if you ./init.sh # Configure the CMake build for the first time, or if you
# have changed one of the CMakeList.txt files. (release build) # have changed one of the CMakeList.txt files. (release build)
@@ -24,7 +22,7 @@ the following shell scripts have been provided in the root of the project.
sudo ./makePackage.sh # Build a .deb file for distribution. sudo ./makePackage.sh # Build a .deb file for distribution.
If you are using a development environment other than Visual Studio Code, it should be fairly straightforward to figure out how If you are using a development environment other than Visual Studio Code, it should be fairly straightforward to figure out how
to incorporate the PiPedal build procedure into your IDE workflow by using the contents of the build shell scripts as a model. to incorporate the PiPedal build procedure into your IDE workflow by using the contents of the build shell scripts as a model.
-30
View File
@@ -1,30 +0,0 @@
#!/usr/bin/env bash
# Check for required system packages for building PiPedal.
set -e
packages=(\
liblilv-dev libboost-dev libsystemd-dev catch libasound2-dev uuid-dev \
authbind libavahi-client-dev libnm-dev libicu-dev \
libsdbus-c++-dev libzip-dev google-perftools \
libgoogle-perftools-dev libpipewire-0.3-dev \
libwebsocketpp-dev
)
missing=()
for pkg in "${packages[@]}"; do
if ! dpkg -s "$pkg" >/dev/null 2>&1; then
missing+=("$pkg")
fi
done
if [ ${#missing[@]} -ne 0 ]; then
echo "Missing packages:" >&2
for pkg in "${missing[@]}"; do
echo " $pkg" >&2
done
exit 1
else
echo "All required packages are installed." >&2
fi
+6 -6
View File
@@ -618,7 +618,7 @@ namespace pipedal
if (this->captureHandle) if (this->captureHandle)
{ {
this->alsa_device_name = this->jackServerSettings.GetAlsaInputDevice(); this->alsa_device_name = this->jackServerSettings.GetAlsaInputDevice();
AlsaConfigureStream( AlsaConfigureStream(
this->alsa_device_name, this->alsa_device_name,
"capture", "capture",
@@ -630,7 +630,7 @@ namespace pipedal
} }
if (this->playbackHandle) if (this->playbackHandle)
{ {
this->alsa_device_name = this->jackServerSettings.GetAlsaOutputDevice(); this->alsa_device_name = this->jackServerSettings.GetAlsaOutputDevice();
AlsaConfigureStream( AlsaConfigureStream(
this->alsa_device_name, this->alsa_device_name,
"playback", "playback",
@@ -1226,7 +1226,7 @@ namespace pipedal
int err; int err;
std::string inputName = jackServerSettings.GetAlsaInputDevice(); std::string inputName = jackServerSettings.GetAlsaInputDevice();
std::string outputName = jackServerSettings.GetAlsaOutputDevice(); std::string outputName = jackServerSettings.GetAlsaOutputDevice();
this->numberOfBuffers = jackServerSettings.GetNumberOfBuffers(); this->numberOfBuffers = jackServerSettings.GetNumberOfBuffers();
@@ -1237,7 +1237,7 @@ namespace pipedal
{ {
this->alsa_device_name = outputName; this->alsa_device_name = outputName;
err = snd_pcm_open(&playbackHandle, outputName.c_str(), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); err = snd_pcm_open(&playbackHandle, outputName.c_str(), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
if (err < 0) if (err < 0)
{ {
switch (errno) switch (errno)
@@ -1271,8 +1271,8 @@ namespace pipedal
{ {
snd_pcm_nonblock(playbackHandle, 0); snd_pcm_nonblock(playbackHandle, 0);
} }
this->alsa_device_name = inputName; this->alsa_device_name = inputName;
err = snd_pcm_open(&captureHandle, inputName.c_str(), SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK); err = snd_pcm_open(&captureHandle, inputName.c_str(), SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK);
if (err < 0) if (err < 0)
+1 -1
View File
@@ -2120,7 +2120,7 @@ public:
if (this->audioDriver != nullptr) if (this->audioDriver != nullptr)
{ {
result.cpuUsage_ = audioDriver->CpuUse(); result.cpuUsage_ = audioDriver->CpuUse();
if (!std::isfinite(result.cpuUsage_)) if (!std::isfinite(result.cpuUsage_))
{ {
result.cpuUsage_ = 0.0f; result.cpuUsage_ = 0.0f;
} }
+1 -1
View File
@@ -517,7 +517,7 @@ namespace pipedal
result.sampleRates_.push_back(48000); result.sampleRates_.push_back(48000);
result.minBufferSize_ = 16; result.minBufferSize_ = 16;
result.maxBufferSize_ = 1024; result.maxBufferSize_ = 1024;
result.supportsCapture_ = true; result.supportsCapture_ = true;
result.supportsPlayback_ = true; result.supportsPlayback_ = true;
return result; return result;
} }
+1 -1
View File
@@ -148,7 +148,7 @@ void JackServerSettings::ReadJackDaemonConfiguration()
this->bufferSize_ = GetJackArg(argv, "-p", "--period"); this->bufferSize_ = GetJackArg(argv, "-p", "--period");
this->numberOfBuffers_ = (uint32_t)GetJackArg(argv, "-n", "--nperiods"); this->numberOfBuffers_ = (uint32_t)GetJackArg(argv, "-n", "--nperiods");
this->sampleRate_ = (uint32_t)GetJackArg(argv, "-r", "--rate"); this->sampleRate_ = (uint32_t)GetJackArg(argv, "-r", "--rate");
// read new dual device flags, fallback on old -d/--device // read new dual device flags, fallback on old -d/--device
std::string capDev = GetJackStringArg(argv, "-C", "--capture"); std::string capDev = GetJackStringArg(argv, "-C", "--capture");
std::string playDev = GetJackStringArg(argv, "-P", "--playback"); std::string playDev = GetJackStringArg(argv, "-P", "--playback");
std::string dev = ""; std::string dev = "";
+4 -4
View File
@@ -31,9 +31,9 @@ namespace pipedal
bool isOnboarding_ = true; bool isOnboarding_ = true;
bool isJackAudio_ = JACK_HOST ? true : false; bool isJackAudio_ = JACK_HOST ? true : false;
bool rebootRequired_ = false; bool rebootRequired_ = false;
std::string alsaInputDevice_; std::string alsaInputDevice_;
std::string alsaOutputDevice_; std::string alsaOutputDevice_;
std::string alsaDevice_; // legacy std::string alsaDevice_; // legacy
uint64_t sampleRate_ = 0; uint64_t sampleRate_ = 0;
uint32_t bufferSize_ = 64; uint32_t bufferSize_ = 64;
uint32_t numberOfBuffers_ = 3; uint32_t numberOfBuffers_ = 3;
@@ -61,7 +61,7 @@ namespace pipedal
uint64_t GetSampleRate() const { return sampleRate_; } uint64_t GetSampleRate() const { return sampleRate_; }
uint32_t GetBufferSize() const { return bufferSize_; } uint32_t GetBufferSize() const { return bufferSize_; }
uint32_t GetNumberOfBuffers() const { return numberOfBuffers_; } uint32_t GetNumberOfBuffers() const { return numberOfBuffers_; }
const std::string &GetAlsaInputDevice() const { return alsaInputDevice_; } const std::string &GetAlsaInputDevice() const { return alsaInputDevice_; }
const std::string &GetAlsaOutputDevice() const { return alsaOutputDevice_; } const std::string &GetAlsaOutputDevice() const { return alsaOutputDevice_; }
const std::string &GetLegacyAlsaDevice() const { return alsaDevice_; } //legacy const std::string &GetLegacyAlsaDevice() const { return alsaDevice_; } //legacy
void SetLegacyAlsaDevice(const std::string &d) { alsaDevice_ = d; } void SetLegacyAlsaDevice(const std::string &d) { alsaDevice_ = d; }
@@ -89,7 +89,7 @@ namespace pipedal
// { // {
// this->valid_ = true; // this->valid_ = true;
// this->rebootRequired_ = true; // this->rebootRequired_ = true;
// this->alsaInputDevice_ = device; // this->alsaInputDevice_ = device;
// this->alsaOutputDevice_ = device; // this->alsaOutputDevice_ = device;
// this->sampleRate_ = sampleRate; // this->sampleRate_ = sampleRate;
// this->bufferSize_ = bufferSize; // this->bufferSize_ = bufferSize;
+7 -7
View File
@@ -107,7 +107,7 @@ std::vector<AlsaDeviceInfo> PiPedalAlsaDevices::GetAlsaDevices()
if (captureOk || playbackOk) if (captureOk || playbackOk)
{ {
snd_pcm_t *hDevice = captureOk ? captureDevice : playbackDevice; snd_pcm_t *hDevice = captureOk ? captureDevice : playbackDevice;
snd_pcm_hw_params_t *params = nullptr; snd_pcm_hw_params_t *params = nullptr;
err = snd_pcm_hw_params_malloc(&params); err = snd_pcm_hw_params_malloc(&params);
if (err == 0) if (err == 0)
@@ -118,7 +118,7 @@ std::vector<AlsaDeviceInfo> PiPedalAlsaDevices::GetAlsaDevices()
unsigned int minRate = 0, maxRate = 0; unsigned int minRate = 0, maxRate = 0;
snd_pcm_uframes_t minBufferSize = 0, maxBufferSize = 0; snd_pcm_uframes_t minBufferSize = 0, maxBufferSize = 0;
int dir; int dir;
err = snd_pcm_hw_params_get_rate_min(params, &minRate, &dir); err = snd_pcm_hw_params_get_rate_min(params, &minRate, &dir);
if (err == 0) if (err == 0)
{ {
@@ -134,7 +134,7 @@ std::vector<AlsaDeviceInfo> PiPedalAlsaDevices::GetAlsaDevices()
} }
} }
} }
else else
{ {
Lv2Log::warning(SS("Failed to get maximum sample rate for device '" << info.name_ << "'.")); Lv2Log::warning(SS("Failed to get maximum sample rate for device '" << info.name_ << "'."));
} }
@@ -143,9 +143,9 @@ std::vector<AlsaDeviceInfo> PiPedalAlsaDevices::GetAlsaDevices()
{ {
Lv2Log::warning(SS("Failed to get minimum sample rate for device '" << info.name_ << "'.")); Lv2Log::warning(SS("Failed to get minimum sample rate for device '" << info.name_ << "'."));
err = 0; // continue using fallback rate for other parameters err = 0; // continue using fallback rate for other parameters
} }
err = snd_pcm_hw_params_get_buffer_size_min(params, &minBufferSize); err = snd_pcm_hw_params_get_buffer_size_min(params, &minBufferSize);
if (err == 0) if (err == 0)
{ {
err = snd_pcm_hw_params_get_buffer_size_max(params, &maxBufferSize); err = snd_pcm_hw_params_get_buffer_size_max(params, &maxBufferSize);
@@ -177,7 +177,7 @@ std::vector<AlsaDeviceInfo> PiPedalAlsaDevices::GetAlsaDevices()
{ {
result.push_back(info); result.push_back(info);
} }
} }
else else
{ {
if (getCachedDevice(info.name_, &info)) if (getCachedDevice(info.name_, &info))
+1 -1
View File
@@ -31,7 +31,7 @@ namespace pipedal {
std::string longName_; std::string longName_;
std::vector<uint32_t> sampleRates_; std::vector<uint32_t> sampleRates_;
uint32_t minBufferSize_ = 0,maxBufferSize_ = 0; uint32_t minBufferSize_ = 0,maxBufferSize_ = 0;
bool supportsCapture_ = false; bool supportsCapture_ = false;
bool supportsPlayback_ = false; bool supportsPlayback_ = false;
bool isDummyDevice() const { bool isDummyDevice() const {
+3 -3
View File
@@ -1284,7 +1284,7 @@ public:
{ {
JackServerSettings jackServerSettings; JackServerSettings jackServerSettings;
pReader->read(&jackServerSettings); pReader->read(&jackServerSettings);
CheckJackServerSettings(jackServerSettings); CheckJackServerSettings(jackServerSettings);
this->model.SetJackServerSettings(jackServerSettings); this->model.SetJackServerSettings(jackServerSettings);
this->Reply(replyTo, "setJackserverSettings"); this->Reply(replyTo, "setJackserverSettings");
} }
@@ -1304,7 +1304,7 @@ public:
{ {
WifiConfigSettings wifiConfigSettings; WifiConfigSettings wifiConfigSettings;
pReader->read(&wifiConfigSettings); pReader->read(&wifiConfigSettings);
CheckWifiConfigSettings(wifiConfigSettings); CheckWifiConfigSettings(wifiConfigSettings);
if (!GetAdminClient().CanUseAdminClient()) if (!GetAdminClient().CanUseAdminClient())
{ {
throw PiPedalException("Can't change server settings when running interactively."); throw PiPedalException("Can't change server settings when running interactively.");
@@ -1326,7 +1326,7 @@ public:
{ {
WifiDirectConfigSettings wifiDirectConfigSettings; WifiDirectConfigSettings wifiDirectConfigSettings;
pReader->read(&wifiDirectConfigSettings); pReader->read(&wifiDirectConfigSettings);
CheckWifiDirectConfigSettings(wifiDirectConfigSettings); CheckWifiDirectConfigSettings(wifiDirectConfigSettings);
if (!GetAdminClient().CanUseAdminClient()) if (!GetAdminClient().CanUseAdminClient())
{ {
throw PiPedalException("Can't change server settings when running interactively."); throw PiPedalException("Can't change server settings when running interactively.");
+1 -1
View File
@@ -1598,7 +1598,7 @@ pipedal::JackServerSettings Storage::GetJackServerSettings()
{ {
json_reader reader(f); json_reader reader(f);
reader.read(&result); reader.read(&result);
if (!result.GetLegacyAlsaDevice().empty() && if (!result.GetLegacyAlsaDevice().empty() &&
result.GetAlsaInputDevice().empty() && result.GetAlsaInputDevice().empty() &&
result.GetAlsaOutputDevice().empty()) result.GetAlsaOutputDevice().empty())
{ {
+1 -1
View File
@@ -457,7 +457,7 @@ std::string uri_builder::str() const {
s << '?'; s << '?';
for (size_t i = 0; i < queries_.size(); ++i) for (size_t i = 0; i < queries_.size(); ++i)
{ {
if (i != 0) s << '&'; if (i != 0) s << '&';
s << queries_[i].key << "="; s << queries_[i].key << "=";
HtmlHelper::encode_url_segment(s,queries_[i].value,true); HtmlHelper::encode_url_segment(s,queries_[i].value,true);
} }
+1 -1
View File
@@ -21,7 +21,7 @@ export default class AlsaDeviceInfo {
this.sampleRates = input.sampleRates as number[]; this.sampleRates = input.sampleRates as number[];
this.minBufferSize = input.minBufferSize; this.minBufferSize = input.minBufferSize;
this.maxBufferSize = input.maxBufferSize; this.maxBufferSize = input.maxBufferSize;
this.supportsCapture = input.supportsCapture ? true : false; this.supportsCapture = input.supportsCapture ? true : false;
this.supportsPlayback = input.supportsPlayback ? true : false; this.supportsPlayback = input.supportsPlayback ? true : false;
return this; return this;
} }
+2 -2
View File
@@ -60,7 +60,7 @@ export class FakeAndroidHost implements AndroidHostInterface
launchExternalUrl(_url:string): boolean launchExternalUrl(_url:string): boolean
{ {
return false; return false;
} }
private theme = 1; private theme = 1;
@@ -72,7 +72,7 @@ export class FakeAndroidHost implements AndroidHostInterface
} }
setServerVersion(_serverVersion: string): void { setServerVersion(_serverVersion: string): void {
// No-op for fake host // No-op for fake host
} }
private keepScreenOn = false; private keepScreenOn = false;
+3 -3
View File
@@ -49,8 +49,8 @@ export default class JackServerSettings {
isOnboarding: boolean = true; isOnboarding: boolean = true;
rebootRequired = false; rebootRequired = false;
isJackAudio = false; isJackAudio = false;
alsaInputDevice: string = ""; alsaInputDevice: string = "";
alsaOutputDevice: string = ""; alsaOutputDevice: string = "";
sampleRate = 48000; sampleRate = 48000;
bufferSize = 64; bufferSize = 64;
numberOfBuffers = 3; numberOfBuffers = 3;
@@ -69,7 +69,7 @@ export default class JackServerSettings {
if (inDev === outDev) { if (inDev === outDev) {
return inDev; return inDev;
} else { } else {
return inDev+" → "+outDev; return inDev+" → "+outDev;
} }
+59 -59
View File
@@ -87,7 +87,7 @@ interface JackServerSettingsDialogState {
alsaDevices?: AlsaDeviceInfo[]; alsaDevices?: AlsaDeviceInfo[];
okEnabled: boolean; okEnabled: boolean;
fullScreen: boolean; fullScreen: boolean;
compactWidth: boolean; compactWidth: boolean;
jackStatus?: JackHostStatus; jackStatus?: JackHostStatus;
showDeviceWarning: boolean; showDeviceWarning: boolean;
dontShowWarningAgain: boolean; dontShowWarningAgain: boolean;
@@ -102,7 +102,7 @@ const styles = (theme: Theme) =>
selectEmpty: { selectEmpty: {
marginTop: theme.spacing(2), marginTop: theme.spacing(2),
}, },
inputLabel: { inputLabel: {
backgroundColor: theme.palette.background.paper, backgroundColor: theme.palette.background.paper,
paddingLeft: 4, paddingLeft: 4,
paddingRight: 4 paddingRight: 4
@@ -276,15 +276,15 @@ function getBestBuffers(
function isOkEnabled(jackServerSettings: JackServerSettings, alsaDevices?: AlsaDeviceInfo[]) function isOkEnabled(jackServerSettings: JackServerSettings, alsaDevices?: AlsaDeviceInfo[])
{ {
if (!alsaDevices) return false; if (!alsaDevices) return false;
if (!jackServerSettings.alsaInputDevice || !jackServerSettings.alsaOutputDevice) return false; if (!jackServerSettings.alsaInputDevice || !jackServerSettings.alsaOutputDevice) return false;
const inDevice = alsaDevices.find(d => d.id === jackServerSettings.alsaInputDevice && d.supportsCapture); const inDevice = alsaDevices.find(d => d.id === jackServerSettings.alsaInputDevice && d.supportsCapture);
const outDevice = alsaDevices.find(d => d.id === jackServerSettings.alsaOutputDevice && d.supportsPlayback); const outDevice = alsaDevices.find(d => d.id === jackServerSettings.alsaOutputDevice && d.supportsPlayback);
if (!inDevice || !outDevice) return false; if (!inDevice || !outDevice) return false;
const sampleRates = intersectArrays(inDevice.sampleRates, outDevice.sampleRates); const sampleRates = intersectArrays(inDevice.sampleRates, outDevice.sampleRates);
if (sampleRates.indexOf(jackServerSettings.sampleRate) === -1) return false; if (sampleRates.indexOf(jackServerSettings.sampleRate) === -1) return false;
const deviceBufferSize = jackServerSettings.bufferSize * jackServerSettings.numberOfBuffers; const deviceBufferSize = jackServerSettings.bufferSize * jackServerSettings.numberOfBuffers;
const minSize = Math.max(inDevice.minBufferSize, outDevice.minBufferSize); const minSize = Math.max(inDevice.minBufferSize, outDevice.minBufferSize);
const maxSize = Math.min(inDevice.maxBufferSize, outDevice.maxBufferSize); const maxSize = Math.min(inDevice.maxBufferSize, outDevice.maxBufferSize);
@@ -324,8 +324,8 @@ const JackServerSettingsDialog = withStyles(
statusTimer?: number = undefined; statusTimer?: number = undefined;
suppressDeviceWarning: boolean; suppressDeviceWarning: boolean;
getFullScreen() { getFullScreen() {
return document.documentElement.clientWidth < 420 || return document.documentElement.clientWidth < 420 ||
document.documentElement.clientHeight < 700; document.documentElement.clientHeight < 700;
} }
@@ -414,11 +414,11 @@ const JackServerSettingsDialog = withStyles(
if (!inDevice || !outDevice) { if (!inDevice || !outDevice) {
result.valid = false; result.valid = false;
if (!inDevice) result.alsaInputDevice = INVALID_DEVICE_ID; if (!inDevice) result.alsaInputDevice = INVALID_DEVICE_ID;
if (!outDevice) result.alsaOutputDevice = INVALID_DEVICE_ID; if (!outDevice) result.alsaOutputDevice = INVALID_DEVICE_ID;
return result; return result;
} }
let sampleRates = intersectArrays(inDevice.sampleRates, outDevice.sampleRates); let sampleRates = intersectArrays(inDevice.sampleRates, outDevice.sampleRates);
if (sampleRates.length !== 0 && sampleRates.indexOf(result.sampleRate) === -1) { if (sampleRates.length !== 0 && sampleRates.indexOf(result.sampleRate) === -1) {
let bestSr = sampleRates[0]; let bestSr = sampleRates[0];
@@ -437,11 +437,11 @@ const JackServerSettingsDialog = withStyles(
} }
componentDidMount() { componentDidMount() {
super.componentDidMount(); super.componentDidMount();
this.mounted = true; this.mounted = true;
if (this.props.open) { if (this.props.open) {
this.requestAlsaInfo(); this.requestAlsaInfo();
this.startStatusTimer(); this.startStatusTimer();
} }
} }
@@ -456,16 +456,16 @@ const JackServerSettingsDialog = withStyles(
if (!this.state.alsaDevices) { if (!this.state.alsaDevices) {
this.requestAlsaInfo(); this.requestAlsaInfo();
} }
this.startStatusTimer(); this.startStatusTimer();
} else if (!this.props.open && oldProps.open) { } else if (!this.props.open && oldProps.open) {
this.stopStatusTimer(); this.stopStatusTimer();
} }
} }
componentWillUnmount() { componentWillUnmount() {
super.componentWillUnmount(); super.componentWillUnmount();
this.mounted = false; this.mounted = false;
this.stopStatusTimer(); this.stopStatusTimer();
} }
getSelectedDevice(deviceId: string): AlsaDeviceInfo | undefined { getSelectedDevice(deviceId: string): AlsaDeviceInfo | undefined {
@@ -486,7 +486,7 @@ const JackServerSettingsDialog = withStyles(
if (!inDev && !outDev) return; if (!inDev && !outDev) return;
let settings = this.state.jackServerSettings.clone(); let settings = this.state.jackServerSettings.clone();
settings.sampleRate = rate; settings.sampleRate = rate;
settings.valid = false; settings.valid = false;
this.setState({ this.setState({
jackServerSettings: settings, jackServerSettings: settings,
@@ -521,7 +521,7 @@ const JackServerSettingsDialog = withStyles(
if (!inDev && !outDev) return; if (!inDev && !outDev) return;
let settings = this.state.jackServerSettings.clone(); let settings = this.state.jackServerSettings.clone();
settings.numberOfBuffers = bufferCount; settings.numberOfBuffers = bufferCount;
settings.valid = false; settings.valid = false;
this.setState({ this.setState({
jackServerSettings: settings, jackServerSettings: settings,
@@ -538,42 +538,42 @@ const JackServerSettingsDialog = withStyles(
this.model.setJackServerSettings(s); this.model.setJackServerSettings(s);
} }
}; };
handleOk() { handleOk() {
if (!this.state.okEnabled) return; if (!this.state.okEnabled) return;
if (this.state.jackServerSettings.alsaInputDevice !== this.state.jackServerSettings.alsaOutputDevice if (this.state.jackServerSettings.alsaInputDevice !== this.state.jackServerSettings.alsaOutputDevice
&& !this.suppressDeviceWarning) { && !this.suppressDeviceWarning) {
this.setState({ showDeviceWarning: true }); this.setState({ showDeviceWarning: true });
return; return;
} }
let s = this.state.jackServerSettings.clone(); let s = this.state.jackServerSettings.clone();
s.valid = true; s.valid = true;
this.props.onApply(s); this.props.onApply(s);
}; };
handleWarningProceed() { handleWarningProceed() {
if (this.state.dontShowWarningAgain) { if (this.state.dontShowWarningAgain) {
localStorage.setItem("suppressSeparateDeviceWarning", "1"); localStorage.setItem("suppressSeparateDeviceWarning", "1");
this.suppressDeviceWarning = true; this.suppressDeviceWarning = true;
} }
this.setState({ showDeviceWarning: false, dontShowWarningAgain: false }, () => { this.setState({ showDeviceWarning: false, dontShowWarningAgain: false }, () => {
let s = this.state.jackServerSettings.clone(); let s = this.state.jackServerSettings.clone();
s.valid = true; s.valid = true;
this.props.onApply(s); this.props.onApply(s);
}); });
} }
handleWarningCancel() { handleWarningCancel() {
this.setState({ showDeviceWarning: false, dontShowWarningAgain: false }); this.setState({ showDeviceWarning: false, dontShowWarningAgain: false });
} }
handleWarningCheck(e: any, checked: boolean) { handleWarningCheck(e: any, checked: boolean) {
this.setState({ dontShowWarningAgain: checked }); this.setState({ dontShowWarningAgain: checked });
} }
handleInputDeviceChanged(e: any) { handleInputDeviceChanged(e: any) {
const d = e.target.value as string; const d = e.target.value as string;
let s = this.state.jackServerSettings.clone(); let s = this.state.jackServerSettings.clone();
s.alsaInputDevice = d; s.alsaInputDevice = d;
s.valid = false; s.valid = false;
let settings = this.applyAlsaDevices(s, this.state.alsaDevices); let settings = this.applyAlsaDevices(s, this.state.alsaDevices);
this.setState({ this.setState({
jackServerSettings: settings, jackServerSettings: settings,
latencyText: getLatencyText(settings), latencyText: getLatencyText(settings),
@@ -585,7 +585,7 @@ const JackServerSettingsDialog = withStyles(
const d = e.target.value as string; const d = e.target.value as string;
let s = this.state.jackServerSettings.clone(); let s = this.state.jackServerSettings.clone();
s.alsaOutputDevice = d; s.alsaOutputDevice = d;
s.valid = false; s.valid = false;
let settings = this.applyAlsaDevices(s, this.state.alsaDevices); let settings = this.applyAlsaDevices(s, this.state.alsaDevices);
this.setState({ this.setState({
jackServerSettings: settings, jackServerSettings: settings,
@@ -607,9 +607,9 @@ const JackServerSettingsDialog = withStyles(
let selectedInputDevice = this.getSelectedDevice(this.state.jackServerSettings.alsaInputDevice); let selectedInputDevice = this.getSelectedDevice(this.state.jackServerSettings.alsaInputDevice);
let selectedOutputDevice = this.getSelectedDevice(this.state.jackServerSettings.alsaOutputDevice); let selectedOutputDevice = this.getSelectedDevice(this.state.jackServerSettings.alsaOutputDevice);
const devicesSelected = (selectedInputDevice && selectedOutputDevice); const devicesSelected = (selectedInputDevice && selectedOutputDevice);
let bufferSizes: number[] = devicesSelected ? let bufferSizes: number[] = devicesSelected ?
getValidBufferSizesMultiple(selectedInputDevice, selectedOutputDevice) : []; getValidBufferSizesMultiple(selectedInputDevice, selectedOutputDevice) : [];
let bufferCounts = devicesSelected ? let bufferCounts = devicesSelected ?
@@ -622,19 +622,19 @@ const JackServerSettingsDialog = withStyles(
let sampleRateOptions = sampleRates.length === 0 && this.state.jackServerSettings.sampleRate ? [this.state.jackServerSettings.sampleRate] : sampleRates; let sampleRateOptions = sampleRates.length === 0 && this.state.jackServerSettings.sampleRate ? [this.state.jackServerSettings.sampleRate] : sampleRates;
return ( return (
<> <>
<DialogEx tag="jack" onClose={handleClose} aria-labelledby="select-channels-title" open={open} <DialogEx tag="jack" onClose={handleClose} aria-labelledby="select-channels-title" open={open}
onEnterKey={() => { onEnterKey={() => {
this.handleOk(); this.handleOk();
}} }}
fullScreen={this.state.fullScreen} fullScreen={this.state.fullScreen}
> >
<DialogContent> <DialogContent>
<div style={{ display: "flex", flexDirection: "column", gap: 8 }}> <div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
<div style={{ display: "flex", flexDirection: "row", alignItems: "center", gap: 8 }}> <div style={{ display: "flex", flexDirection: "row", alignItems: "center", gap: 8 }}>
<div style={{ display: "flex", flexDirection: this.state.compactWidth ? "column" : "row", gap: 8 }}> <div style={{ display: "flex", flexDirection: this.state.compactWidth ? "column" : "row", gap: 8 }}>
{/* Audio Input Device */} {/* Audio Input Device */}
<FormControl variant="standard" className={classes.formControl}> <FormControl variant="standard" className={classes.formControl}>
<InputLabel shrink className={classes.inputLabel} htmlFor="jsd_inputDevice">Input Device</InputLabel> <InputLabel shrink className={classes.inputLabel} htmlFor="jsd_inputDevice">Input Device</InputLabel>
<Select variant="standard" <Select variant="standard"
@@ -660,10 +660,10 @@ const JackServerSettingsDialog = withStyles(
disabled={!this.state.alsaDevices || this.state.alsaDevices.length === 0} disabled={!this.state.alsaDevices || this.state.alsaDevices.length === 0}
style={{ width: 220 }} style={{ width: 220 }}
> >
{sortedDevices.filter(d => d.supportsPlayback).map(d => ( {sortedDevices.filter(d => d.supportsPlayback).map(d => (
<MenuItem key={d.id} value={d.id}>{d.name}</MenuItem> <MenuItem key={d.id} value={d.id}>{d.name}</MenuItem>
)) || <MenuItem value="" disabled>Loading...</MenuItem>} )) || <MenuItem value="" disabled>Loading...</MenuItem>}
</Select> </Select>
</FormControl> </FormControl>
</div> </div>
<IconButtonEx tooltip="Refresh devices" onClick={() => this.requestAlsaInfo()} aria-label="refresh-audio-devices"> <IconButtonEx tooltip="Refresh devices" onClick={() => this.requestAlsaInfo()} aria-label="refresh-audio-devices">
@@ -737,7 +737,7 @@ const JackServerSettingsDialog = withStyles(
color="textSecondary"> color="textSecondary">
Latency: {this.state.latencyText} Latency: {this.state.latencyText}
</Typography> </Typography>
<div className={classes.cpuStatusColor} style={{ paddingLeft: 24 }}> <div className={classes.cpuStatusColor} style={{ paddingLeft: 24 }}>
{JackHostStatus.getDisplayView("", this.state.jackStatus)} {JackHostStatus.getDisplayView("", this.state.jackStatus)}
</div> </div>
{!this.state.okEnabled && ( {!this.state.okEnabled && (
@@ -759,7 +759,7 @@ const JackServerSettingsDialog = withStyles(
</DialogActions> </DialogActions>
</DialogEx> </DialogEx>
{this.state.showDeviceWarning && ( {this.state.showDeviceWarning && (
<DialogEx open={this.state.showDeviceWarning} tag="ioWarning" <DialogEx open={this.state.showDeviceWarning} tag="ioWarning"
onEnterKey={() => this.handleWarningProceed()} onEnterKey={() => this.handleWarningProceed()}
onClose={() => this.handleWarningCancel()} onClose={() => this.handleWarningCancel()}