This commit is contained in:
Robin Davies
2022-04-30 09:06:40 -04:00
parent 179ff9c276
commit f0f075ae4e
16 changed files with 209 additions and 77 deletions
+2 -2
View File
@@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 3.16.0) cmake_minimum_required(VERSION 3.16.0)
project(pipedal project(pipedal
VERSION 0.1.8 VERSION 0.1.9
DESCRIPTION "PiPedal Guitar Effect Pedal For Raspberry Pi" DESCRIPTION "PiPedal Guitar Effect Pedal For Raspberry Pi"
HOMEPAGE_URL "https://rerdavies.github.io/pipedal" HOMEPAGE_URL "https://rerdavies.github.io/pipedal"
) )
set (DISPLAY_VERSION "v0.1.8-beta-4") set (DISPLAY_VERSION "v0.1.9-beta-5")
set (CMAKE_INSTALL_PREFIX "/usr/") set (CMAKE_INSTALL_PREFIX "/usr/")
+1 -1
View File
@@ -1,7 +1,7 @@
<img src='docs/GithubBanner.png' width="100%" /> <img src='docs/GithubBanner.png' width="100%" />
Download: <a href='docs/download.md'>v0.1.8-beta-4</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Website: [https://rerdavies.github.io/pipedal](https://rerdavies.github.io/pipedal). Download: <a href='docs/download.md'>v0.1.9-beta-5</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Website: [https://rerdavies.github.io/pipedal](https://rerdavies.github.io/pipedal).
Use your Raspberry Pi as a guitar effects pedal. Configure and control PiPedal with your phone or tablet. Use your Raspberry Pi as a guitar effects pedal. Configure and control PiPedal with your phone or tablet.
+2 -2
View File
@@ -4,14 +4,14 @@
Download the most recent Debian (.deb) package for your platform: Download the most recent Debian (.deb) package for your platform:
- [Raspberry Pi OS (64-bit) v0.1.8-beta-4](https://github.com/rerdavies/pipedal/releases/download/v0.1.8-beta-4/pipedal_0.1.8_arm64.deb) - [Raspberry Pi OS (64-bit) v0.1.9-beta-5](https://github.com/rerdavies/pipedal/releases/download/v0.1.9-beta-5/pipedal_0.1.9_arm64.deb)
Install the package by running Install the package by running
``` ```
sudo apt update sudo apt update
cd ~/Downloads cd ~/Downloads
sudo apt-get install ./pipedal_0.1.8_arm64.deb sudo apt-get install ./pipedal_0.1.9_arm64.deb
``` ```
After installing, follow the instructions in [Configuring PiPedal after Installation](Configuring.md). After installing, follow the instructions in [Configuring PiPedal after Installation](Configuring.md).
+2 -2
View File
@@ -4,14 +4,14 @@
Download the most recent Debian (.deb) package for your platform: Download the most recent Debian (.deb) package for your platform:
- [Ubuntu or Raspberry Pi OS (64-bit)](https://github.com/rerdavies/pipedal/releases/download/v0.1.8-beta-4/pipedal_0.1.8_arm64.deb) v0.1.8-beta-4 - [Ubuntu or Raspberry Pi OS (64-bit)](https://github.com/rerdavies/pipedal/releases/download/v0.1.9-beta-5/pipedal_0.1.9_arm64.deb) v0.1.9-beta-5
Install the package by running Install the package by running
``` ```
sudo apt update sudo apt update
cd ~/Downloads cd ~/Downloads
sudo apt-get install ./pipedal_0.1.8_arm64.deb sudo apt-get install ./pipedal_0.1.9_arm64.deb
``` ```
Follow the instructions in [_Configuring PiPedal After Installation_](https://rerdavies.github.io/pipedal/Configuring.html) to complete the installation. Follow the instructions in [_Configuring PiPedal After Installation_](https://rerdavies.github.io/pipedal/Configuring.html) to complete the installation.
+1 -1
View File
@@ -1,7 +1,7 @@
<img src="GithubBanner.png" width="100%"/> <img src="GithubBanner.png" width="100%"/>
<a href="Installing.html"><i>v0.1.8-beta-4</i></a> <a href="Installing.html"><i>v0.1.9-beta-5</i></a>
Use your Raspberry Pi as a guitar effects pedal. Configure and control PiPedal with your phone or tablet. Use your Raspberry Pi as a guitar effects pedal. Configure and control PiPedal with your phone or tablet.
+1 -1
View File
@@ -31,7 +31,7 @@
--> -->
<title>PiPedal</title> <title>PiPedal</title>
</head> </head>
<body> <body style="background: #D0D0D0">
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div> <div id="root"></div>
<!-- <!--
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"socket_server_port": 80, "socket_server_port": 8080,
"socket_server_address": "*", "socket_server_address": "*",
"debug": true, "debug": true,
"max_upload_size": 1048576, "max_upload_size": 1048576,
+14 -3
View File
@@ -264,6 +264,7 @@ type AppState = {
presetChanged: boolean; presetChanged: boolean;
banks: BankIndex; banks: BankIndex;
bankDisplayItems: number; bankDisplayItems: number;
showStatusMonitor: boolean;
}; };
interface AppProps extends WithStyles<typeof appStyles> { interface AppProps extends WithStyles<typeof appStyles> {
} }
@@ -309,7 +310,8 @@ const AppThemed = withStyles(appStyles)(class extends ResizeResponsiveComponent<
bankDialogOpen: false, bankDialogOpen: false,
editBankDialogOpen: false, editBankDialogOpen: false,
zoomedControlOpen: false, zoomedControlOpen: false,
bankDisplayItems: 5 bankDisplayItems: 5,
showStatusMonitor: this.model_.showStatusMonitor.get()
}; };
@@ -319,6 +321,7 @@ const AppThemed = withStyles(appStyles)(class extends ResizeResponsiveComponent<
this.alertMessageChangedHandler = this.alertMessageChangedHandler.bind(this); this.alertMessageChangedHandler = this.alertMessageChangedHandler.bind(this);
this.handleCloseAlert = this.handleCloseAlert.bind(this); this.handleCloseAlert = this.handleCloseAlert.bind(this);
this.banksChangedHandler = this.banksChangedHandler.bind(this); this.banksChangedHandler = this.banksChangedHandler.bind(this);
this.showStatusMonitorHandler = this.showStatusMonitorHandler.bind(this);
} }
@@ -450,6 +453,11 @@ const AppThemed = withStyles(appStyles)(class extends ResizeResponsiveComponent<
handleCloseAlert(e?: any, reason?: any) { handleCloseAlert(e?: any, reason?: any) {
this.model_.alertMessage.set(""); this.model_.alertMessage.set("");
} }
showStatusMonitorHandler() {
this.setState({
showStatusMonitor: this.model_.showStatusMonitor.get()
});
}
banksChangedHandler() { banksChangedHandler() {
this.setState({ this.setState({
banks: this.model_.banks.get() banks: this.model_.banks.get()
@@ -484,6 +492,7 @@ const AppThemed = withStyles(appStyles)(class extends ResizeResponsiveComponent<
this.model_.pedalBoard.addOnChangedHandler(this.presetChangedHandler); this.model_.pedalBoard.addOnChangedHandler(this.presetChangedHandler);
this.model_.alertMessage.addOnChangedHandler(this.alertMessageChangedHandler); this.model_.alertMessage.addOnChangedHandler(this.alertMessageChangedHandler);
this.model_.banks.addOnChangedHandler(this.banksChangedHandler); this.model_.banks.addOnChangedHandler(this.banksChangedHandler);
this.model_.showStatusMonitor.addOnChangedHandler(this.showStatusMonitorHandler);
this.alertMessageChangedHandler(); this.alertMessageChangedHandler();
} }
@@ -508,7 +517,8 @@ const AppThemed = withStyles(appStyles)(class extends ResizeResponsiveComponent<
this.model_.errorMessage.removeOnChangedHandler(this.errorChangeHandler_); this.model_.errorMessage.removeOnChangedHandler(this.errorChangeHandler_);
this.model_.state.removeOnChangedHandler(this.stateChangeHandler_); this.model_.state.removeOnChangedHandler(this.stateChangeHandler_);
this.model_.pedalBoard.removeOnChangedHandler(this.presetChangedHandler); this.model_.pedalBoard.removeOnChangedHandler(this.presetChangedHandler);
this.model_.banks.addOnChangedHandler(this.banksChangedHandler); this.model_.banks.removeOnChangedHandler(this.banksChangedHandler);
this.model_.banks.removeOnChangedHandler(this.showStatusMonitorHandler);
} }
@@ -814,7 +824,8 @@ const AppThemed = withStyles(appStyles)(class extends ResizeResponsiveComponent<
</Button> </Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
<JackStatusView /> { this.state.showStatusMonitor && (<JackStatusView />) }
<div className={classes.errorContent} style={{ <div className={classes.errorContent} style={{
display: (this.state.displayState === State.Reconnecting || this.state.displayState === State.ApplyingChanges) display: (this.state.displayState === State.Reconnecting || this.state.displayState === State.ApplyingChanges)
? "block" : "none" ? "block" : "none"
+38 -23
View File
@@ -314,7 +314,8 @@ export interface PiPedalModel {
serverVersion?: PiPedalVersion; serverVersion?: PiPedalVersion;
errorMessage: ObservableProperty<string>; errorMessage: ObservableProperty<string>;
alertMessage: ObservableProperty<string>; alertMessage: ObservableProperty<string>;
showStatusMonitor: ObservableProperty<boolean>;
setShowStatusMonitor(show: boolean): void;
state: ObservableProperty<State>; state: ObservableProperty<State>;
visibilityState: ObservableProperty<VisibilityState>; visibilityState: ObservableProperty<VisibilityState>;
@@ -458,6 +459,9 @@ class PiPedalModelImpl implements PiPedalModel {
errorMessage: ObservableProperty<string> = new ObservableProperty<string>(""); errorMessage: ObservableProperty<string> = new ObservableProperty<string>("");
alertMessage: ObservableProperty<string> = new ObservableProperty<string>(""); alertMessage: ObservableProperty<string> = new ObservableProperty<string>("");
showStatusMonitor: ObservableProperty<boolean> = new ObservableProperty<boolean>(true);
pedalBoard: ObservableProperty<PedalBoard> = new ObservableProperty<PedalBoard>(new PedalBoard()); pedalBoard: ObservableProperty<PedalBoard> = new ObservableProperty<PedalBoard>(new PedalBoard());
plugin_classes: ObservableProperty<PluginClass> = new ObservableProperty<PluginClass>(new PluginClass()); plugin_classes: ObservableProperty<PluginClass> = new ObservableProperty<PluginClass>(new PluginClass());
jackConfiguration: ObservableProperty<JackConfiguration> = new ObservableProperty<JackConfiguration>(new JackConfiguration()); jackConfiguration: ObservableProperty<JackConfiguration> = new ObservableProperty<JackConfiguration>(new JackConfiguration());
@@ -512,8 +516,7 @@ class PiPedalModelImpl implements PiPedalModel {
onSocketReconnecting(retry: number, maxRetries: number): void { onSocketReconnecting(retry: number, maxRetries: number): void {
if (this.visibilityState.get() === VisibilityState.Hidden) return; if (this.visibilityState.get() === VisibilityState.Hidden) return;
//if (retry !== 0) { //if (retry !== 0) {
if (this.restartExpected) if (this.restartExpected) {
{
this.setState(State.ApplyingChanges); this.setState(State.ApplyingChanges);
} else { } else {
this.setState(State.Reconnecting); this.setState(State.Reconnecting);
@@ -563,6 +566,9 @@ class PiPedalModelImpl implements PiPedalModel {
if (!this.compareFavorites(favorites, this.favorites.get())) { if (!this.compareFavorites(favorites, this.favorites.get())) {
this.favorites.set(favorites); this.favorites.set(favorites);
} }
} else if (message === "onShowStatusMonitorChanged") {
let value = body as boolean;
this.showStatusMonitor.set(value);
} else if (message === "onChannelSelectionChanged") { } else if (message === "onChannelSelectionChanged") {
let channelSelectionBody = body as ChannelSelectionChangedBody; let channelSelectionBody = body as ChannelSelectionChangedBody;
let channelSelection = new JackChannelSelection().deserialize(channelSelectionBody.jackChannelSelection); let channelSelection = new JackChannelSelection().deserialize(channelSelectionBody.jackChannelSelection);
@@ -655,7 +661,7 @@ class PiPedalModelImpl implements PiPedalModel {
} }
} else { } else {
throw new PiPedalStateError("Unrecognized message received from server."); throw new PiPedalStateError("Unrecognized message received from server: " + message);
} }
} }
setError(message: string): void { setError(message: string): void {
@@ -708,15 +714,13 @@ class PiPedalModelImpl implements PiPedalModel {
} }
onSocketConnectionLost() { onSocketConnectionLost() {
if (this.isAndroidHosted()) if (this.isAndroidHosted()) {
{
this.androidHost?.setDisconnected(true); this.androidHost?.setDisconnected(true);
} }
} }
onSocketReconnected() { onSocketReconnected() {
if (this.isAndroidHosted()) if (this.isAndroidHosted()) {
{
this.androidHost?.setDisconnected(false); this.androidHost?.setDisconnected(false);
} }
@@ -732,6 +736,11 @@ class PiPedalModelImpl implements PiPedalModel {
.then(data => { .then(data => {
this.pedalBoard.set(new PedalBoard().deserialize(data)); this.pedalBoard.set(new PedalBoard().deserialize(data));
return this.getWebSocket().request<boolean>("getShowStatusMonitor");
})
.then(data => {
this.showStatusMonitor.set(data);
return this.getWebSocket().request<any>("getWifiConfigSettings"); return this.getWebSocket().request<any>("getWifiConfigSettings");
}) })
.then(data => { .then(data => {
@@ -833,13 +842,13 @@ class PiPedalModelImpl implements PiPedalModel {
this.webSocket = new PiPedalSocket( this.webSocket = new PiPedalSocket(
this.socketServerUrl, this.socketServerUrl,
{ {
onMessageReceived : this.onSocketMessage, onMessageReceived: this.onSocketMessage,
onError: this.onSocketError, onError: this.onSocketError,
onConnectionLost: this.onSocketConnectionLost, onConnectionLost: this.onSocketConnectionLost,
onReconnect: this.onSocketReconnected, onReconnect: this.onSocketReconnected,
onReconnecting: this.onSocketReconnecting onReconnecting: this.onSocketReconnecting
} }
); );
return this.webSocket.connect(); return this.webSocket.connect();
}) })
.then(() => { .then(() => {
@@ -856,6 +865,7 @@ class PiPedalModelImpl implements PiPedalModel {
}) })
.then((clientId) => { .then((clientId) => {
this.clientId = clientId; this.clientId = clientId;
return this.getWebSocket().request<string>("imageList"); return this.getWebSocket().request<string>("imageList");
}) })
.then((data) => { .then((data) => {
@@ -907,7 +917,11 @@ class PiPedalModelImpl implements PiPedalModel {
.then(data => { .then(data => {
this.governorSettings.set(new GovernorSettings().deserialize(data)); this.governorSettings.set(new GovernorSettings().deserialize(data));
return this.getWebSocket().request<boolean>("getShowStatusMonitor");
})
.then(data => {
this.showStatusMonitor.set(data);
return this.getWebSocket().request<any>("getJackServerSettings"); return this.getWebSocket().request<any>("getJackServerSettings");
}) })
.then(data => { .then(data => {
@@ -976,11 +990,10 @@ class PiPedalModelImpl implements PiPedalModel {
} }
backgroundStateTimeout?: NodeJS.Timeout = undefined; backgroundStateTimeout?: NodeJS.Timeout = undefined;
exitBackgroundState() { exitBackgroundState() {
if (this.backgroundStateTimeout) if (this.backgroundStateTimeout) {
{
clearTimeout(this.backgroundStateTimeout); clearTimeout(this.backgroundStateTimeout);
this.backgroundStateTimeout = undefined; this.backgroundStateTimeout = undefined;
return; return;
@@ -996,10 +1009,8 @@ class PiPedalModelImpl implements PiPedalModel {
// on Android, delay entering background state by 3 seconds, // on Android, delay entering background state by 3 seconds,
// so that screen-flips don't trigger disconnects. // so that screen-flips don't trigger disconnects.
if (this.isAndroidHosted()) if (this.isAndroidHosted()) {
{ if (this.backgroundStateTimeout) {
if (this.backgroundStateTimeout)
{
clearTimeout(this.backgroundStateTimeout); clearTimeout(this.backgroundStateTimeout);
} }
this.backgroundStateTimeout = setTimeout(() => { this.backgroundStateTimeout = setTimeout(() => {
@@ -1009,7 +1020,7 @@ class PiPedalModelImpl implements PiPedalModel {
} else { } else {
this.enterBackgroundState_(); this.enterBackgroundState_();
} }
} }
enterBackgroundState_() { enterBackgroundState_() {
if (this.state.get() !== State.Background) { if (this.state.get() !== State.Background) {
console.log("Entering background state."); console.log("Entering background state.");
@@ -1181,6 +1192,7 @@ class PiPedalModelImpl implements PiPedalModel {
} }
} }
setPedalBoardControlValue(instanceId: number, key: string, value: number): void { setPedalBoardControlValue(instanceId: number, key: string, value: number): void {
this._setPedalBoardControlValue(instanceId, key, value, true); this._setPedalBoardControlValue(instanceId, key, value, true);
} }
@@ -1219,6 +1231,10 @@ class PiPedalModelImpl implements PiPedalModel {
} }
setShowStatusMonitor(show: boolean): void {
this.webSocket?.send("setShowStatusMonitor", show);
}
loadPedalBoardPlugin(itemId: number, selectedUri: string): number { loadPedalBoardPlugin(itemId: number, selectedUri: string): number {
let pedalBoard = this.pedalBoard.get(); let pedalBoard = this.pedalBoard.get();
if (pedalBoard === undefined) throw new PiPedalArgumentError("Can't clone an undefined object."); if (pedalBoard === undefined) throw new PiPedalArgumentError("Can't clone an undefined object.");
@@ -1497,7 +1513,7 @@ class PiPedalModelImpl implements PiPedalModel {
expectRestart() { expectRestart() {
this.restartExpected = true; this.restartExpected = true;
} }
setJackSettings(jackSettings: JackChannelSelection): void { setJackSettings(jackSettings: JackChannelSelection): void {
@@ -2108,8 +2124,7 @@ class PiPedalModelImpl implements PiPedalModel {
isAndroidHosted(): boolean { return this.androidHost !== undefined; } isAndroidHosted(): boolean { return this.androidHost !== undefined; }
showAndroidDonationActivity(): void { showAndroidDonationActivity(): void {
if (this.androidHost) if (this.androidHost) {
{
this.androidHost.showSponsorship(); this.androidHost.showSponsorship();
} }
} }
+46 -20
View File
@@ -18,6 +18,7 @@
// 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 React, { SyntheticEvent, Component } from 'react'; import React, { SyntheticEvent, Component } from 'react';
import Switch from "@mui/material/Switch";
import OkCancelDialog from './OkCancelDialog'; import OkCancelDialog from './OkCancelDialog';
import ListSelectDialog from './ListSelectDialog'; import ListSelectDialog from './ListSelectDialog';
import IconButton from '@mui/material/IconButton'; import IconButton from '@mui/material/IconButton';
@@ -56,6 +57,8 @@ interface SettingsDialogProps extends WithStyles<typeof styles> {
}; };
interface SettingsDialogState { interface SettingsDialogState {
showStatusMonitor: boolean;
showStatusMonitorDialog: boolean;
jackConfiguration: JackConfiguration; jackConfiguration: JackConfiguration;
jackSettings: JackChannelSelection; jackSettings: JackChannelSelection;
jackServerSettings: JackServerSettings; jackServerSettings: JackServerSettings;
@@ -153,6 +156,9 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
this.handleDialogClose = this.handleDialogClose.bind(this); this.handleDialogClose = this.handleDialogClose.bind(this);
this.state = { this.state = {
showStatusMonitor: this.model.showStatusMonitor.get(),
showStatusMonitorDialog: false,
jackServerSettings: this.model.jackServerSettings.get(), jackServerSettings: this.model.jackServerSettings.get(),
jackConfiguration: this.model.jackConfiguration.get(), jackConfiguration: this.model.jackConfiguration.get(),
jackStatus: undefined, jackStatus: undefined,
@@ -183,10 +189,15 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
this.handleWifiDirectConfigSettingsChanged = this.handleWifiDirectConfigSettingsChanged.bind(this); this.handleWifiDirectConfigSettingsChanged = this.handleWifiDirectConfigSettingsChanged.bind(this);
this.handleGovernorSettingsChanged = this.handleGovernorSettingsChanged.bind(this); this.handleGovernorSettingsChanged = this.handleGovernorSettingsChanged.bind(this);
this.handleConnectionStateChanged = this.handleConnectionStateChanged.bind(this); this.handleConnectionStateChanged = this.handleConnectionStateChanged.bind(this);
this.handleShowStatusMonitorChanged = this.handleShowStatusMonitorChanged.bind(this);
} }
handleShowStatusMonitorChanged(): void {
this.setState({ showStatusMonitor: this.model.showStatusMonitor.get() });
}
handleConnectionStateChanged(): void { handleConnectionStateChanged(): void {
if (this.model.state.get() === State.Ready) { if (this.model.state.get() === State.Ready) {
this.setState({ isAndroidHosted: this.model.isAndroidHosted() }); this.setState({ isAndroidHosted: this.model.isAndroidHosted() });
@@ -290,6 +301,7 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
this.active = active; this.active = active;
if (active) { if (active) {
this.model.state.addOnChangedHandler(this.handleConnectionStateChanged); this.model.state.addOnChangedHandler(this.handleConnectionStateChanged);
this.model.showStatusMonitor.addOnChangedHandler(this.handleShowStatusMonitorChanged);
this.model.jackSettings.addOnChangedHandler(this.handleJackSettingsChanged); this.model.jackSettings.addOnChangedHandler(this.handleJackSettingsChanged);
this.model.jackConfiguration.addOnChangedHandler(this.handleJackConfigurationChanged); this.model.jackConfiguration.addOnChangedHandler(this.handleJackConfigurationChanged);
this.model.jackServerSettings.addOnChangedHandler(this.handleJackServerSettingsChanged); this.model.jackServerSettings.addOnChangedHandler(this.handleJackServerSettingsChanged);
@@ -312,6 +324,7 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
this.handleConnectionStateChanged(); this.handleConnectionStateChanged();
this.handleJackConfigurationChanged(); this.handleJackConfigurationChanged();
this.handleJackSettingsChanged(); this.handleJackSettingsChanged();
this.handleShowStatusMonitorChanged();
this.handleJackServerSettingsChanged(); this.handleJackServerSettingsChanged();
this.handleWifiConfigSettingsChanged(); this.handleWifiConfigSettingsChanged();
this.handleWifiDirectConfigSettingsChanged(); this.handleWifiDirectConfigSettingsChanged();
@@ -321,6 +334,8 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
clearInterval(this.timerHandle); clearInterval(this.timerHandle);
} }
this.model.state.removeOnChangedHandler(this.handleConnectionStateChanged); this.model.state.removeOnChangedHandler(this.handleConnectionStateChanged);
this.model.showStatusMonitor.removeOnChangedHandler(this.handleShowStatusMonitorChanged);
this.model.jackConfiguration.removeOnChangedHandler(this.handleJackConfigurationChanged); this.model.jackConfiguration.removeOnChangedHandler(this.handleJackConfigurationChanged);
this.model.jackSettings.removeOnChangedHandler(this.handleJackSettingsChanged); this.model.jackSettings.removeOnChangedHandler(this.handleJackSettingsChanged);
this.model.jackServerSettings.removeOnChangedHandler(this.handleJackServerSettingsChanged); this.model.jackServerSettings.removeOnChangedHandler(this.handleJackServerSettingsChanged);
@@ -436,7 +451,7 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
}); });
} }
handleRestart() { handleRestart() {
this.setState({showRestartOkDialog: true}); this.setState({ showRestartOkDialog: true });
} }
handleRestartOk() { handleRestartOk() {
this.setState({ restarting: true }); this.setState({ restarting: true });
@@ -452,7 +467,7 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
} }
handleShutdown() { handleShutdown() {
this.setState({ showShutdownOkDialog: true}); this.setState({ showShutdownOkDialog: true });
} }
handleShutdownOk() { handleShutdownOk() {
this.setState({ shuttingDown: true }); this.setState({ shuttingDown: true });
@@ -525,7 +540,7 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
) )
} }
<Divider/> <Divider />
<Typography className={classes.sectionHead} display="block" variant="caption" color="secondary"> <Typography className={classes.sectionHead} display="block" variant="caption" color="secondary">
AUDIO AUDIO
</Typography> </Typography>
@@ -592,7 +607,7 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
this.state.isAndroidHosted && this.state.isAndroidHosted &&
( (
<ButtonBase className={classes.setting} disabled={!this.state.wifiConfigSettings.valid} <ButtonBase className={classes.setting} disabled={!this.state.wifiConfigSettings.valid}
onClick={() => this.model.chooseNewDevice() } > onClick={() => this.model.chooseNewDevice()} >
<SelectHoverBackground selected={false} showHover={true} /> <SelectHoverBackground selected={false} showHover={true} />
<div style={{ width: "100%" }}> <div style={{ width: "100%" }}>
<Typography className={classes.primaryItem} display="block" variant="body2" color="textPrimary" noWrap> <Typography className={classes.primaryItem} display="block" variant="body2" color="textPrimary" noWrap>
@@ -606,7 +621,7 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
) )
} }
<ButtonBase <ButtonBase
className={classes.setting} disabled={!this.state.wifiConfigSettings.valid} className={classes.setting} disabled={!this.state.wifiConfigSettings.valid}
onClick={() => this.handleShowWifiDirectConfigDialog()} > onClick={() => this.handleShowWifiDirectConfigDialog()} >
<SelectHoverBackground selected={false} showHover={true} /> <SelectHoverBackground selected={false} showHover={true} />
@@ -654,16 +669,28 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
</ButtonBase> </ButtonBase>
<ButtonBase <ButtonBase
className={classes.setting} disabled={!this.state.wifiConfigSettings.valid} className={classes.setting}
onClick={() => { } } > onClick={() => { this.setState({ showStatusMonitorDialog: true }); }} >
<SelectHoverBackground selected={false} showHover={true} /> <SelectHoverBackground selected={false} showHover={true} />
<div style={{ width: "100%" }}> <div style={{ width: "100%" }}>
<Typography className={classes.primaryItem} display="block" variant="body2" color="textPrimary" noWrap> <div style={{
Show status monitor on main screen.</Typography> width: "100%", display: "flex", flexDirection: "row", flexWrap: "nowrap",
<Typography display="block" variant="caption" noWrap color="textSecondary"> alignItems: "center", maxWidth: 400
Enabled }}>
</Typography> <div style={{ flex: "1 1 auto" }}>
<Typography className={classes.primaryItem} display="block" variant="body2" color="textPrimary" noWrap>
Show status monitor on main screen.</Typography>
</div>
<div style={{ flex: "0 0 auto" }}>
<Switch
checked={this.state.showStatusMonitor}
onChange={
(e) => { this.model.setShowStatusMonitor(e.target.checked); }
}
/>
</div>
</div>
</div> </div>
</ButtonBase> </ButtonBase>
@@ -735,7 +762,6 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
> >
</ListSelectDialog> </ListSelectDialog>
) )
} }
{ {
(this.state.showMidiSelectDialog) && (this.state.showMidiSelectDialog) &&
@@ -756,15 +782,15 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
onClose={() => this.setState({ showWifiDirectConfigDialog: false })} onClose={() => this.setState({ showWifiDirectConfigDialog: false })}
onOk={(wifiDirectConfigSettings: WifiDirectConfigSettings) => this.handleApplyWifiDirectConfig(wifiDirectConfigSettings)} onOk={(wifiDirectConfigSettings: WifiDirectConfigSettings) => this.handleApplyWifiDirectConfig(wifiDirectConfigSettings)}
/> />
<OkCancelDialog text="Are you sure you want to reboot?" okButtonText='Reboot' <OkCancelDialog text="Are you sure you want to reboot?" okButtonText='Reboot'
open={this.state.showRestartOkDialog} open={this.state.showRestartOkDialog}
onOk={()=> { this.setState({showRestartOkDialog: false}); this.handleRestartOk();}} onOk={() => { this.setState({ showRestartOkDialog: false }); this.handleRestartOk(); }}
onClose={()=> { this.setState({showRestartOkDialog: false}); } } onClose={() => { this.setState({ showRestartOkDialog: false }); }}
/> />
<OkCancelDialog text="Are you sure you want to shut down?" okButtonText='Shut down' <OkCancelDialog text="Are you sure you want to shut down?" okButtonText='Shut down'
open={this.state.showShutdownOkDialog} open={this.state.showShutdownOkDialog}
onOk={()=> { this.setState({showShutdownOkDialog: false}); this.handleShutdownOk();}} onOk={() => { this.setState({ showShutdownOkDialog: false }); this.handleShutdownOk(); }}
onClose={()=> { this.setState({showShutdownOkDialog: false}); } } onClose={() => { this.setState({ showShutdownOkDialog: false }); }}
/> />
</DialogEx > </DialogEx >
+4 -6
View File
@@ -29,6 +29,8 @@
using namespace pipedal; using namespace pipedal;
using namespace std; using namespace std;
const bool ENABLE_KEEP_ALIVE = false;
using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp> using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
const size_t MAX_READ_SIZE = 1 * 1024 * 204; const size_t MAX_READ_SIZE = 1 * 1024 * 204;
@@ -164,8 +166,7 @@ namespace pipedal
virtual const std::string &get(const std::string &key) const { return m_request.get_header(key); } virtual const std::string &get(const std::string &key) const { return m_request.get_header(key); }
virtual bool keepAlive() const virtual bool keepAlive() const
{ {
m_request.get_version() != "1.0" || m_request.get_header("Connection") == "keep-alive"; return ENABLE_KEEP_ALIVE && (m_request.get_version() != "1.0" || m_request.get_header("Connection") == "keep-alive");
return true;
} }
}; };
class HttpResponseImpl : public HttpResponse class HttpResponseImpl : public HttpResponse
@@ -187,7 +188,7 @@ namespace pipedal
virtual void setBody(const std::string &body) { request.set_body(body); } virtual void setBody(const std::string &body) { request.set_body(body); }
virtual void keepAlive(bool value) virtual void keepAlive(bool value)
{ {
if (!value) if ((!value) || (!ENABLE_KEEP_ALIVE))
{ {
set("Connection", "close"); set("Connection", "close");
} }
@@ -418,9 +419,6 @@ namespace pipedal
if (requestHandler->wants(req.method(), requestUri)) if (requestHandler->wants(req.method(), requestUri))
{ {
try try
{ {
+30
View File
@@ -735,6 +735,36 @@ WifiDirectConfigSettings PiPedalModel::GetWifiDirectConfigSettings()
return this->storage.GetWifiDirectConfigSettings(); return this->storage.GetWifiDirectConfigSettings();
} }
void PiPedalModel::SetShowStatusMonitor(bool show)
{
IPiPedalModelSubscriber **t;
size_t n;
{
std::lock_guard<std::recursive_mutex> guard(mutex); // copy atomically.
t = new IPiPedalModelSubscriber *[this->subscribers.size()];
n = this->subscribers.size();
storage.SetShowStatusMonitor(show);
// Notify clients.
IPiPedalModelSubscriber **t = new IPiPedalModelSubscriber *[this->subscribers.size()];
for (size_t i = 0; i < subscribers.size(); ++i)
{
t[i] = this->subscribers[i];
}
for (size_t i = 0; i < n; ++i)
{
t[i]->OnShowStatusMonitorChanged(show);
}
delete[] t;
}
}
bool PiPedalModel::GetShowStatusMonitor()
{
std::lock_guard<std::recursive_mutex> guard(mutex); // copy atomically.
return storage.GetShowStatusMonitor();
}
JackConfiguration PiPedalModel::GetJackConfiguration() JackConfiguration PiPedalModel::GetJackConfiguration()
{ {
std::lock_guard<std::recursive_mutex> guard(mutex); // copy atomically. std::lock_guard<std::recursive_mutex> guard(mutex); // copy atomically.
+4
View File
@@ -67,6 +67,7 @@ public:
virtual void OnWifiDirectConfigSettingsChanged(const WifiDirectConfigSettings&wifiDirectConfigSettings) = 0; virtual void OnWifiDirectConfigSettingsChanged(const WifiDirectConfigSettings&wifiDirectConfigSettings) = 0;
virtual void OnGovernorSettingsChanged(const std::string &governor) = 0; virtual void OnGovernorSettingsChanged(const std::string &governor) = 0;
virtual void OnFavoritesChanged(const std::map<std::string,bool> &favorites) = 0; virtual void OnFavoritesChanged(const std::map<std::string,bool> &favorites) = 0;
virtual void OnShowStatusMonitorChanged(bool show) = 0;
virtual void Close() = 0; virtual void Close() = 0;
}; };
@@ -214,6 +215,9 @@ public:
void SetJackChannelSelection(int64_t clientId,const JackChannelSelection &channelSelection); void SetJackChannelSelection(int64_t clientId,const JackChannelSelection &channelSelection);
JackChannelSelection GetJackChannelSelection(); JackChannelSelection GetJackChannelSelection();
void SetShowStatusMonitor(bool show);
bool GetShowStatusMonitor();
void SetWifiConfigSettings(const WifiConfigSettings&wifiConfigSettings); void SetWifiConfigSettings(const WifiConfigSettings&wifiConfigSettings);
WifiConfigSettings GetWifiConfigSettings(); WifiConfigSettings GetWifiConfigSettings();
+15
View File
@@ -924,6 +924,16 @@ public:
pReader->read(&jackSettings); pReader->read(&jackSettings);
this->model.SetJackChannelSelection(this->clientId, jackSettings); this->model.SetJackChannelSelection(this->clientId, jackSettings);
} }
else if (message == "setShowStatusMonitor")
{
bool showStatusMonitor;
pReader->read(&showStatusMonitor);
this->model.SetShowStatusMonitor(showStatusMonitor);
}
else if (message == "getShowStatusMonitor")
{
Reply(replyTo,"getShowStatusMonitor",this->model.GetShowStatusMonitor());
}
else if (message == "version") else if (message == "version")
{ {
PiPedalVersion version(this->model); PiPedalVersion version(this->model);
@@ -1255,6 +1265,11 @@ public:
{ {
Send("onFavoritesChanged",favorites); Send("onFavoritesChanged",favorites);
} }
virtual void OnShowStatusMonitorChanged(bool show) {
Send("onShowStatusMonitorChanged",show);
}
virtual void OnChannelSelectionChanged(int64_t clientId, const JackChannelSelection &channelSelection) virtual void OnChannelSelectionChanged(int64_t clientId, const JackChannelSelection &channelSelection)
{ {
ChannelSelectionChangedBody body; ChannelSelectionChangedBody body;
+32 -13
View File
@@ -33,7 +33,9 @@ const char *BANK_EXTENSION = ".bank";
const char *BANKS_FILENAME = "index.banks"; const char *BANKS_FILENAME = "index.banks";
#define WIFI_CONFIG_SETTINGS_FILENAME "wifiConfigSettings.json"; #define WIFI_CONFIG_SETTINGS_FILENAME "wifiConfigSettings.json";
#define GOVERNOR_SETTINGS_FILENAME "governorSettings.json"; #define USER_SETTINGS_FILENAME "userSettings.json";
Storage::Storage() Storage::Storage()
{ {
@@ -228,7 +230,7 @@ void Storage::Initialize()
} }
LoadWifiConfigSettings(); LoadWifiConfigSettings();
LoadWifiDirectConfigSettings(); LoadWifiDirectConfigSettings();
LoadGovernorSettings(); LoadUserSettings();
} }
@@ -854,9 +856,14 @@ int64_t Storage::UploadBank(BankFile&bankFile,int64_t uploadAfter)
return lastBank; return lastBank;
} }
void Storage::SetGovernorSettings(const std::string & governor) void Storage::SetGovernorSettings(const std::string & governor)
{ {
std::filesystem::path path = this->dataRoot / GOVERNOR_SETTINGS_FILENAME; userSettings.governor_ = governor;
SaveUserSettings();
}
void Storage::SaveUserSettings() {
std::filesystem::path path = this->dataRoot / USER_SETTINGS_FILENAME;
{ {
std::ofstream f(path); std::ofstream f(path);
if (!f.is_open()) if (!f.is_open())
@@ -864,13 +871,22 @@ void Storage::SetGovernorSettings(const std::string & governor)
throw PiPedalException("Unable to write to " + ((std::string)path)); throw PiPedalException("Unable to write to " + ((std::string)path));
} }
json_writer writer(f); json_writer writer(f);
writer.write(governor); writer.write(userSettings);
this->governorSettings = governor;
} }
} }
void Storage::SetShowStatusMonitor(bool show)
{
this->userSettings.showStatusMonitor_ = show;
SaveUserSettings();
}
bool Storage::GetShowStatusMonitor() const
{
return this->userSettings.showStatusMonitor_;
}
std::string Storage::GetGovernorSettings() const std::string Storage::GetGovernorSettings() const
{ {
return this->governorSettings; return this->userSettings.governor_;
} }
@@ -925,9 +941,9 @@ void Storage::SetWifiDirectConfigSettings(const WifiDirectConfigSettings & wifiD
this->wifiDirectConfigSettings = copyToStore; this->wifiDirectConfigSettings = copyToStore;
} }
void Storage::LoadGovernorSettings() void Storage::LoadUserSettings()
{ {
std::filesystem::path path = this->dataRoot / GOVERNOR_SETTINGS_FILENAME; std::filesystem::path path = this->dataRoot / USER_SETTINGS_FILENAME;
try { try {
if (std::filesystem::is_regular_file(path)) if (std::filesystem::is_regular_file(path))
@@ -935,16 +951,13 @@ void Storage::LoadGovernorSettings()
std::ifstream f(path); std::ifstream f(path);
if (!f.is_open()) if (!f.is_open())
{ {
throw PiPedalException("Unable to write to " + ((std::string)path)); throw PiPedalException("Unable to read from " + ((std::string)path));
} }
json_reader reader(f); json_reader reader(f);
std::string governorSettings; reader.read(&userSettings);
reader.read(&governorSettings);
this->governorSettings = governorSettings;
} }
} catch (const std::exception&) } catch (const std::exception&)
{ {
this->governorSettings = "performance";
} }
this->wifiConfigSettings.valid_ = true; this->wifiConfigSettings.valid_ = true;
@@ -1293,6 +1306,12 @@ void Storage::SetFavorites(const std::map<std::string,bool>&favorites) {
} }
JSON_MAP_BEGIN(UserSettings)
JSON_MAP_REFERENCE(UserSettings,governor)
JSON_MAP_REFERENCE(UserSettings,showStatusMonitor)
JSON_MAP_END()
JSON_MAP_BEGIN(CurrentPreset) JSON_MAP_BEGIN(CurrentPreset)
JSON_MAP_REFERENCE(CurrentPreset,modified) JSON_MAP_REFERENCE(CurrentPreset,modified)
JSON_MAP_REFERENCE(CurrentPreset,preset) JSON_MAP_REFERENCE(CurrentPreset,preset)
+16 -2
View File
@@ -41,6 +41,15 @@ public:
DECLARE_JSON_MAP(CurrentPreset); DECLARE_JSON_MAP(CurrentPreset);
}; };
class UserSettings {
public:
std::string governor_ = "performance";
bool showStatusMonitor_ = true;
DECLARE_JSON_MAP(UserSettings);
};
// controls user-defined storage. Implmentation hidden to allow to later migration to a database (perhaps) // controls user-defined storage. Implmentation hidden to allow to later migration to a database (perhaps)
class Storage { class Storage {
@@ -77,7 +86,8 @@ private:
JackChannelSelection jackChannelSelection; JackChannelSelection jackChannelSelection;
WifiConfigSettings wifiConfigSettings; WifiConfigSettings wifiConfigSettings;
WifiDirectConfigSettings wifiDirectConfigSettings; WifiDirectConfigSettings wifiDirectConfigSettings;
std::string governorSettings = "performance";
UserSettings userSettings;
public: public:
Storage(); Storage();
void Initialize(); void Initialize();
@@ -93,7 +103,8 @@ public:
void LoadWifiConfigSettings(); void LoadWifiConfigSettings();
void LoadWifiDirectConfigSettings(); void LoadWifiDirectConfigSettings();
void LoadGovernorSettings(); void LoadUserSettings();
void SaveUserSettings();
void LoadBank(int64_t instanceId); void LoadBank(int64_t instanceId);
const PedalBoard& GetCurrentPreset(); const PedalBoard& GetCurrentPreset();
void SaveCurrentPreset(const PedalBoard&pedalBoard); void SaveCurrentPreset(const PedalBoard&pedalBoard);
@@ -154,6 +165,9 @@ public:
std::map<std::string,bool> GetFavorites() const; std::map<std::string,bool> GetFavorites() const;
void SetFavorites(const std::map<std::string,bool>&favorites); void SetFavorites(const std::map<std::string,bool>&favorites);
void SetShowStatusMonitor(bool show);
bool GetShowStatusMonitor() const;
}; };