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 upgrade
sudo apt install -y 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
After installing these packages, run the dependency checker to verify that
everything required is present:
```bash
cd ~/src/pipedal
./scripts/check_deps.sh
```
libpipewire-0.3-dev
### 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,
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
# 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.
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.
-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)
{
this->alsa_device_name = this->jackServerSettings.GetAlsaInputDevice();
this->alsa_device_name = this->jackServerSettings.GetAlsaInputDevice();
AlsaConfigureStream(
this->alsa_device_name,
"capture",
@@ -630,7 +630,7 @@ namespace pipedal
}
if (this->playbackHandle)
{
this->alsa_device_name = this->jackServerSettings.GetAlsaOutputDevice();
this->alsa_device_name = this->jackServerSettings.GetAlsaOutputDevice();
AlsaConfigureStream(
this->alsa_device_name,
"playback",
@@ -1226,7 +1226,7 @@ namespace pipedal
int err;
std::string inputName = jackServerSettings.GetAlsaInputDevice();
std::string outputName = jackServerSettings.GetAlsaOutputDevice();
std::string outputName = jackServerSettings.GetAlsaOutputDevice();
this->numberOfBuffers = jackServerSettings.GetNumberOfBuffers();
@@ -1237,7 +1237,7 @@ namespace pipedal
{
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)
{
switch (errno)
@@ -1271,8 +1271,8 @@ namespace pipedal
{
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);
if (err < 0)
+1 -1
View File
@@ -2120,7 +2120,7 @@ public:
if (this->audioDriver != nullptr)
{
result.cpuUsage_ = audioDriver->CpuUse();
if (!std::isfinite(result.cpuUsage_))
if (!std::isfinite(result.cpuUsage_))
{
result.cpuUsage_ = 0.0f;
}
+1 -1
View File
@@ -517,7 +517,7 @@ namespace pipedal
result.sampleRates_.push_back(48000);
result.minBufferSize_ = 16;
result.maxBufferSize_ = 1024;
result.supportsCapture_ = true;
result.supportsCapture_ = true;
result.supportsPlayback_ = true;
return result;
}
+1 -1
View File
@@ -148,7 +148,7 @@ void JackServerSettings::ReadJackDaemonConfiguration()
this->bufferSize_ = GetJackArg(argv, "-p", "--period");
this->numberOfBuffers_ = (uint32_t)GetJackArg(argv, "-n", "--nperiods");
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 playDev = GetJackStringArg(argv, "-P", "--playback");
std::string dev = "";
+4 -4
View File
@@ -31,9 +31,9 @@ namespace pipedal
bool isOnboarding_ = true;
bool isJackAudio_ = JACK_HOST ? true : false;
bool rebootRequired_ = false;
std::string alsaInputDevice_;
std::string alsaInputDevice_;
std::string alsaOutputDevice_;
std::string alsaDevice_; // legacy
std::string alsaDevice_; // legacy
uint64_t sampleRate_ = 0;
uint32_t bufferSize_ = 64;
uint32_t numberOfBuffers_ = 3;
@@ -61,7 +61,7 @@ namespace pipedal
uint64_t GetSampleRate() const { return sampleRate_; }
uint32_t GetBufferSize() const { return bufferSize_; }
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 &GetLegacyAlsaDevice() const { return alsaDevice_; } //legacy
void SetLegacyAlsaDevice(const std::string &d) { alsaDevice_ = d; }
@@ -89,7 +89,7 @@ namespace pipedal
// {
// this->valid_ = true;
// this->rebootRequired_ = true;
// this->alsaInputDevice_ = device;
// this->alsaInputDevice_ = device;
// this->alsaOutputDevice_ = device;
// this->sampleRate_ = sampleRate;
// this->bufferSize_ = bufferSize;
+7 -7
View File
@@ -107,7 +107,7 @@ std::vector<AlsaDeviceInfo> PiPedalAlsaDevices::GetAlsaDevices()
if (captureOk || playbackOk)
{
snd_pcm_t *hDevice = captureOk ? captureDevice : playbackDevice;
snd_pcm_t *hDevice = captureOk ? captureDevice : playbackDevice;
snd_pcm_hw_params_t *params = nullptr;
err = snd_pcm_hw_params_malloc(&params);
if (err == 0)
@@ -118,7 +118,7 @@ std::vector<AlsaDeviceInfo> PiPedalAlsaDevices::GetAlsaDevices()
unsigned int minRate = 0, maxRate = 0;
snd_pcm_uframes_t minBufferSize = 0, maxBufferSize = 0;
int dir;
err = snd_pcm_hw_params_get_rate_min(params, &minRate, &dir);
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_ << "'."));
}
@@ -143,9 +143,9 @@ std::vector<AlsaDeviceInfo> PiPedalAlsaDevices::GetAlsaDevices()
{
Lv2Log::warning(SS("Failed to get minimum sample rate for device '" << info.name_ << "'."));
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)
{
err = snd_pcm_hw_params_get_buffer_size_max(params, &maxBufferSize);
@@ -177,7 +177,7 @@ std::vector<AlsaDeviceInfo> PiPedalAlsaDevices::GetAlsaDevices()
{
result.push_back(info);
}
}
}
else
{
if (getCachedDevice(info.name_, &info))
+1 -1
View File
@@ -31,7 +31,7 @@ namespace pipedal {
std::string longName_;
std::vector<uint32_t> sampleRates_;
uint32_t minBufferSize_ = 0,maxBufferSize_ = 0;
bool supportsCapture_ = false;
bool supportsCapture_ = false;
bool supportsPlayback_ = false;
bool isDummyDevice() const {
+3 -3
View File
@@ -1284,7 +1284,7 @@ public:
{
JackServerSettings jackServerSettings;
pReader->read(&jackServerSettings);
CheckJackServerSettings(jackServerSettings);
CheckJackServerSettings(jackServerSettings);
this->model.SetJackServerSettings(jackServerSettings);
this->Reply(replyTo, "setJackserverSettings");
}
@@ -1304,7 +1304,7 @@ public:
{
WifiConfigSettings wifiConfigSettings;
pReader->read(&wifiConfigSettings);
CheckWifiConfigSettings(wifiConfigSettings);
CheckWifiConfigSettings(wifiConfigSettings);
if (!GetAdminClient().CanUseAdminClient())
{
throw PiPedalException("Can't change server settings when running interactively.");
@@ -1326,7 +1326,7 @@ public:
{
WifiDirectConfigSettings wifiDirectConfigSettings;
pReader->read(&wifiDirectConfigSettings);
CheckWifiDirectConfigSettings(wifiDirectConfigSettings);
CheckWifiDirectConfigSettings(wifiDirectConfigSettings);
if (!GetAdminClient().CanUseAdminClient())
{
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);
reader.read(&result);
if (!result.GetLegacyAlsaDevice().empty() &&
if (!result.GetLegacyAlsaDevice().empty() &&
result.GetAlsaInputDevice().empty() &&
result.GetAlsaOutputDevice().empty())
{
+1 -1
View File
@@ -457,7 +457,7 @@ std::string uri_builder::str() const {
s << '?';
for (size_t i = 0; i < queries_.size(); ++i)
{
if (i != 0) s << '&';
if (i != 0) s << '&';
s << queries_[i].key << "=";
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.minBufferSize = input.minBufferSize;
this.maxBufferSize = input.maxBufferSize;
this.supportsCapture = input.supportsCapture ? true : false;
this.supportsCapture = input.supportsCapture ? true : false;
this.supportsPlayback = input.supportsPlayback ? true : false;
return this;
}
+2 -2
View File
@@ -60,7 +60,7 @@ export class FakeAndroidHost implements AndroidHostInterface
launchExternalUrl(_url:string): boolean
{
return false;
}
private theme = 1;
@@ -72,7 +72,7 @@ export class FakeAndroidHost implements AndroidHostInterface
}
setServerVersion(_serverVersion: string): void {
// No-op for fake host
}
private keepScreenOn = false;
+3 -3
View File
@@ -49,8 +49,8 @@ export default class JackServerSettings {
isOnboarding: boolean = true;
rebootRequired = false;
isJackAudio = false;
alsaInputDevice: string = "";
alsaOutputDevice: string = "";
alsaInputDevice: string = "";
alsaOutputDevice: string = "";
sampleRate = 48000;
bufferSize = 64;
numberOfBuffers = 3;
@@ -69,7 +69,7 @@ export default class JackServerSettings {
if (inDev === outDev) {
return inDev;
} else {
return inDev+" → "+outDev;
}
+59 -59
View File
@@ -87,7 +87,7 @@ interface JackServerSettingsDialogState {
alsaDevices?: AlsaDeviceInfo[];
okEnabled: boolean;
fullScreen: boolean;
compactWidth: boolean;
compactWidth: boolean;
jackStatus?: JackHostStatus;
showDeviceWarning: boolean;
dontShowWarningAgain: boolean;
@@ -102,7 +102,7 @@ const styles = (theme: Theme) =>
selectEmpty: {
marginTop: theme.spacing(2),
},
inputLabel: {
inputLabel: {
backgroundColor: theme.palette.background.paper,
paddingLeft: 4,
paddingRight: 4
@@ -276,15 +276,15 @@ function getBestBuffers(
function isOkEnabled(jackServerSettings: JackServerSettings, alsaDevices?: AlsaDeviceInfo[])
{
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);
if (!inDevice || !outDevice) return false;
const sampleRates = intersectArrays(inDevice.sampleRates, outDevice.sampleRates);
if (sampleRates.indexOf(jackServerSettings.sampleRate) === -1) return false;
const deviceBufferSize = jackServerSettings.bufferSize * jackServerSettings.numberOfBuffers;
const minSize = Math.max(inDevice.minBufferSize, outDevice.minBufferSize);
const maxSize = Math.min(inDevice.maxBufferSize, outDevice.maxBufferSize);
@@ -324,8 +324,8 @@ const JackServerSettingsDialog = withStyles(
statusTimer?: number = undefined;
suppressDeviceWarning: boolean;
getFullScreen() {
getFullScreen() {
return document.documentElement.clientWidth < 420 ||
document.documentElement.clientHeight < 700;
}
@@ -414,11 +414,11 @@ const JackServerSettingsDialog = withStyles(
if (!inDevice || !outDevice) {
result.valid = false;
if (!inDevice) result.alsaInputDevice = INVALID_DEVICE_ID;
if (!inDevice) result.alsaInputDevice = INVALID_DEVICE_ID;
if (!outDevice) result.alsaOutputDevice = INVALID_DEVICE_ID;
return result;
}
let sampleRates = intersectArrays(inDevice.sampleRates, outDevice.sampleRates);
if (sampleRates.length !== 0 && sampleRates.indexOf(result.sampleRate) === -1) {
let bestSr = sampleRates[0];
@@ -437,11 +437,11 @@ const JackServerSettingsDialog = withStyles(
}
componentDidMount() {
super.componentDidMount();
super.componentDidMount();
this.mounted = true;
if (this.props.open) {
this.requestAlsaInfo();
this.startStatusTimer();
this.startStatusTimer();
}
}
@@ -456,16 +456,16 @@ const JackServerSettingsDialog = withStyles(
if (!this.state.alsaDevices) {
this.requestAlsaInfo();
}
this.startStatusTimer();
this.startStatusTimer();
} else if (!this.props.open && oldProps.open) {
this.stopStatusTimer();
}
}
componentWillUnmount() {
super.componentWillUnmount();
super.componentWillUnmount();
this.mounted = false;
this.stopStatusTimer();
this.stopStatusTimer();
}
getSelectedDevice(deviceId: string): AlsaDeviceInfo | undefined {
@@ -486,7 +486,7 @@ const JackServerSettingsDialog = withStyles(
if (!inDev && !outDev) return;
let settings = this.state.jackServerSettings.clone();
settings.sampleRate = rate;
settings.valid = false;
settings.valid = false;
this.setState({
jackServerSettings: settings,
@@ -521,7 +521,7 @@ const JackServerSettingsDialog = withStyles(
if (!inDev && !outDev) return;
let settings = this.state.jackServerSettings.clone();
settings.numberOfBuffers = bufferCount;
settings.valid = false;
settings.valid = false;
this.setState({
jackServerSettings: settings,
@@ -538,42 +538,42 @@ const JackServerSettingsDialog = withStyles(
this.model.setJackServerSettings(s);
}
};
handleOk() {
if (!this.state.okEnabled) return;
if (this.state.jackServerSettings.alsaInputDevice !== this.state.jackServerSettings.alsaOutputDevice
&& !this.suppressDeviceWarning) {
this.setState({ showDeviceWarning: true });
return;
}
let s = this.state.jackServerSettings.clone();
s.valid = true;
this.props.onApply(s);
};
handleOk() {
if (!this.state.okEnabled) return;
if (this.state.jackServerSettings.alsaInputDevice !== this.state.jackServerSettings.alsaOutputDevice
&& !this.suppressDeviceWarning) {
this.setState({ showDeviceWarning: true });
return;
}
let s = this.state.jackServerSettings.clone();
s.valid = true;
this.props.onApply(s);
};
handleWarningProceed() {
if (this.state.dontShowWarningAgain) {
localStorage.setItem("suppressSeparateDeviceWarning", "1");
this.suppressDeviceWarning = true;
}
this.setState({ showDeviceWarning: false, dontShowWarningAgain: false }, () => {
let s = this.state.jackServerSettings.clone();
s.valid = true;
this.props.onApply(s);
});
}
handleWarningCancel() {
this.setState({ showDeviceWarning: false, dontShowWarningAgain: false });
}
handleWarningProceed() {
if (this.state.dontShowWarningAgain) {
localStorage.setItem("suppressSeparateDeviceWarning", "1");
this.suppressDeviceWarning = true;
}
this.setState({ showDeviceWarning: false, dontShowWarningAgain: false }, () => {
let s = this.state.jackServerSettings.clone();
s.valid = true;
this.props.onApply(s);
});
}
handleWarningCancel() {
this.setState({ showDeviceWarning: false, dontShowWarningAgain: false });
}
handleWarningCheck(e: any, checked: boolean) {
this.setState({ dontShowWarningAgain: checked });
}
handleInputDeviceChanged(e: any) {
handleWarningCheck(e: any, checked: boolean) {
this.setState({ dontShowWarningAgain: checked });
}
handleInputDeviceChanged(e: any) {
const d = e.target.value as string;
let s = this.state.jackServerSettings.clone();
s.alsaInputDevice = d;
s.valid = false;
let settings = this.applyAlsaDevices(s, this.state.alsaDevices);
let settings = this.applyAlsaDevices(s, this.state.alsaDevices);
this.setState({
jackServerSettings: settings,
latencyText: getLatencyText(settings),
@@ -585,7 +585,7 @@ const JackServerSettingsDialog = withStyles(
const d = e.target.value as string;
let s = this.state.jackServerSettings.clone();
s.alsaOutputDevice = d;
s.valid = false;
s.valid = false;
let settings = this.applyAlsaDevices(s, this.state.alsaDevices);
this.setState({
jackServerSettings: settings,
@@ -607,9 +607,9 @@ const JackServerSettingsDialog = withStyles(
let selectedInputDevice = this.getSelectedDevice(this.state.jackServerSettings.alsaInputDevice);
let selectedOutputDevice = this.getSelectedDevice(this.state.jackServerSettings.alsaOutputDevice);
const devicesSelected = (selectedInputDevice && selectedOutputDevice);
const devicesSelected = (selectedInputDevice && selectedOutputDevice);
let bufferSizes: number[] = devicesSelected ?
getValidBufferSizesMultiple(selectedInputDevice, selectedOutputDevice) : [];
let bufferCounts = devicesSelected ?
@@ -622,19 +622,19 @@ const JackServerSettingsDialog = withStyles(
let sampleRateOptions = sampleRates.length === 0 && this.state.jackServerSettings.sampleRate ? [this.state.jackServerSettings.sampleRate] : sampleRates;
return (
<>
<>
<DialogEx tag="jack" onClose={handleClose} aria-labelledby="select-channels-title" open={open}
onEnterKey={() => {
this.handleOk();
}}
fullScreen={this.state.fullScreen}
fullScreen={this.state.fullScreen}
>
<DialogContent>
<div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
<div style={{ display: "flex", flexDirection: "row", alignItems: "center", 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}>
<InputLabel shrink className={classes.inputLabel} htmlFor="jsd_inputDevice">Input Device</InputLabel>
<Select variant="standard"
@@ -660,10 +660,10 @@ const JackServerSettingsDialog = withStyles(
disabled={!this.state.alsaDevices || this.state.alsaDevices.length === 0}
style={{ width: 220 }}
>
{sortedDevices.filter(d => d.supportsPlayback).map(d => (
<MenuItem key={d.id} value={d.id}>{d.name}</MenuItem>
)) || <MenuItem value="" disabled>Loading...</MenuItem>}
</Select>
{sortedDevices.filter(d => d.supportsPlayback).map(d => (
<MenuItem key={d.id} value={d.id}>{d.name}</MenuItem>
)) || <MenuItem value="" disabled>Loading...</MenuItem>}
</Select>
</FormControl>
</div>
<IconButtonEx tooltip="Refresh devices" onClick={() => this.requestAlsaInfo()} aria-label="refresh-audio-devices">
@@ -737,7 +737,7 @@ const JackServerSettingsDialog = withStyles(
color="textSecondary">
Latency: {this.state.latencyText}
</Typography>
<div className={classes.cpuStatusColor} style={{ paddingLeft: 24 }}>
<div className={classes.cpuStatusColor} style={{ paddingLeft: 24 }}>
{JackHostStatus.getDisplayView("", this.state.jackStatus)}
</div>
{!this.state.okEnabled && (
@@ -759,7 +759,7 @@ const JackServerSettingsDialog = withStyles(
</DialogActions>
</DialogEx>
{this.state.showDeviceWarning && (
{this.state.showDeviceWarning && (
<DialogEx open={this.state.showDeviceWarning} tag="ioWarning"
onEnterKey={() => this.handleWarningProceed()}
onClose={() => this.handleWarningCancel()}