Audio stability, snapshots
This commit is contained in:
@@ -61,3 +61,10 @@ export class FakeAndroidHost implements AndroidHostInterface
|
||||
return this.theme;
|
||||
}
|
||||
}
|
||||
export function isAndroidHosted(): boolean {
|
||||
return ((window as any).AndroidHost as AndroidHostInterface) !== undefined;
|
||||
}
|
||||
|
||||
export function getAndroidHost(): AndroidHostInterface | undefined {
|
||||
return ((window as any).AndroidHost as AndroidHostInterface);
|
||||
}
|
||||
@@ -624,7 +624,7 @@ export class PiPedalModel //implements PiPedalModel
|
||||
let atomJson = body.atomJson as any;
|
||||
this.handleNotifyPathPatchPropertyChanged(instanceId, propertyUri, atomJson);
|
||||
if (header.replyTo) {
|
||||
this.webSocket?.reply(header.replyTo, "onNotifyPatchProperty", true);
|
||||
this.webSocket?.reply(header.replyTo, "onNotifyPathPatchPropertyChanged", true);
|
||||
}
|
||||
} else if (message === "onNotifyPatchProperty") {
|
||||
let clientHandle = body.clientHandle as number;
|
||||
|
||||
@@ -51,6 +51,7 @@ import SelectThemeDialog from './SelectThemeDialog';
|
||||
import Slide, { SlideProps } from '@mui/material/Slide';
|
||||
import { createStyles, Theme } from '@mui/material/styles';
|
||||
import { WithStyles, withStyles } from '@mui/styles';
|
||||
import { canScaleWindow, getWindowScaleText } from './WindowScale';
|
||||
|
||||
|
||||
|
||||
@@ -466,8 +467,15 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
|
||||
midiSummary(): string {
|
||||
let ports = this.state.jackSettings.inputMidiDevices;
|
||||
if (ports.length === 0) return "Disabled";
|
||||
if (ports.length === 1) return ports[0].description;
|
||||
return ports.length + " channels";
|
||||
|
||||
let result = "";
|
||||
for (let port of ports) {
|
||||
if (result.length !== 0) {
|
||||
result += ", ";
|
||||
}
|
||||
result += port.description;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
handleShowWifiConfigDialog() {
|
||||
this.setState({
|
||||
@@ -571,7 +579,7 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
|
||||
(
|
||||
<div>
|
||||
<Typography display="block" variant="body1" color="textSecondary" style={{ paddingLeft: 24, paddingBottom: 8 }}>
|
||||
Select and configure an audio device. You may optionally configure MIDI inputs, and configure up a Wi-Fi Auto-Hotspot as well.
|
||||
Select and configure an audio device. You may optionally configure MIDI inputs, and configure a Wi-Fi Auto-Hotspot as well.
|
||||
The Auto-Hotspot feature allows you to connect to Pipedal even if you don't have access to a Wi-Fi router.
|
||||
</Typography>
|
||||
<Typography display="block" variant="body1" color="textSecondary" style={{ paddingLeft: 24, paddingBottom: 8 }}>
|
||||
@@ -678,6 +686,79 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<Divider />
|
||||
{(!this.props.onboarding) &&
|
||||
(
|
||||
<div>
|
||||
<Typography className={classes.sectionHead} display="block" variant="caption" color="secondary">
|
||||
DISPLAY
|
||||
</Typography>
|
||||
<ButtonBase
|
||||
className={classes.setting}
|
||||
onClick={() => { this.handleThemeSelection(); }} >
|
||||
<SelectHoverBackground selected={false} showHover={true} />
|
||||
<div style={{ width: "100%" }}>
|
||||
<Typography className={classes.primaryItem} display="block" variant="body2" color="textPrimary" noWrap>
|
||||
Color theme</Typography>
|
||||
<Typography className={classes.secondaryItem} display="block" variant="caption" color="textSecondary" noWrap>
|
||||
{this.model.getTheme() === ColorTheme.Dark ? "Dark" :
|
||||
(this.model.getTheme() === ColorTheme.Light ? "Light" : "System")}
|
||||
</Typography>
|
||||
</div>
|
||||
</ButtonBase>
|
||||
|
||||
{(canScaleWindow()) &&
|
||||
(
|
||||
<ButtonBase
|
||||
className={classes.setting}
|
||||
onClick={() => { this.handleThemeSelection(); }} >
|
||||
<SelectHoverBackground selected={false} showHover={true} />
|
||||
<div style={{ width: "100%" }}>
|
||||
<Typography className={classes.primaryItem} display="block" variant="body2" color="textPrimary" noWrap>
|
||||
Scale</Typography>
|
||||
<Typography className={classes.secondaryItem} display="block" variant="caption" color="textSecondary" noWrap>
|
||||
{getWindowScaleText()}
|
||||
</Typography>
|
||||
</div>
|
||||
</ButtonBase>
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
<ButtonBase
|
||||
className={classes.setting}
|
||||
onClick={() => {
|
||||
this.model.setShowStatusMonitor(!this.state.showStatusMonitor)
|
||||
}} >
|
||||
<SelectHoverBackground selected={false} showHover={true} />
|
||||
<div style={{ width: "100%" }}>
|
||||
<div style={{
|
||||
width: "100%", display: "flex", flexDirection: "row", flexWrap: "nowrap",
|
||||
alignItems: "center", maxWidth: 400
|
||||
}}>
|
||||
<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>
|
||||
</ButtonBase>
|
||||
</div>
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
<Divider />
|
||||
<div >
|
||||
<Typography className={classes.sectionHead} display="block" variant="caption" color="secondary">CONNECTION</Typography>
|
||||
@@ -720,65 +801,6 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
|
||||
<Divider />
|
||||
<Typography className={classes.sectionHead} display="block" variant="caption" color="secondary">SYSTEM</Typography>
|
||||
|
||||
<ButtonBase
|
||||
style={{ display: "none" }}
|
||||
className={classes.setting} disabled={!this.state.wifiConfigSettings.valid}
|
||||
onClick={() => this.handleShowGovernorSettingsDialogDialog()} >
|
||||
<SelectHoverBackground selected={false} showHover={true} />
|
||||
<div style={{ width: "100%" }}>
|
||||
<Typography className={classes.primaryItem} display="block" variant="body2" color="textPrimary" noWrap>
|
||||
CPU Governor</Typography>
|
||||
<Typography display="block" variant="caption" noWrap color="textSecondary">
|
||||
{this.state.governorSettings.governor}
|
||||
</Typography>
|
||||
|
||||
</div>
|
||||
</ButtonBase>
|
||||
|
||||
<ButtonBase
|
||||
className={classes.setting}
|
||||
onClick={() => { this.handleThemeSelection(); }} >
|
||||
<SelectHoverBackground selected={false} showHover={true} />
|
||||
<div style={{ width: "100%" }}>
|
||||
<Typography className={classes.primaryItem} display="block" variant="body2" color="textPrimary" noWrap>
|
||||
Color theme</Typography>
|
||||
<Typography className={classes.secondaryItem} display="block" variant="caption" color="textSecondary" noWrap>
|
||||
{this.model.getTheme() === ColorTheme.Dark ? "Dark" :
|
||||
(this.model.getTheme() === ColorTheme.Light ? "Light" : "System")}
|
||||
</Typography>
|
||||
</div>
|
||||
</ButtonBase>
|
||||
|
||||
|
||||
<ButtonBase
|
||||
className={classes.setting}
|
||||
onClick={() => {
|
||||
this.model.setShowStatusMonitor(!this.state.showStatusMonitor)
|
||||
}} >
|
||||
<SelectHoverBackground selected={false} showHover={true} />
|
||||
<div style={{ width: "100%" }}>
|
||||
<div style={{
|
||||
width: "100%", display: "flex", flexDirection: "row", flexWrap: "nowrap",
|
||||
alignItems: "center", maxWidth: 400
|
||||
}}>
|
||||
<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>
|
||||
</ButtonBase>
|
||||
|
||||
{
|
||||
this.model.enableAutoUpdate && (
|
||||
<ButtonBase
|
||||
|
||||
@@ -133,7 +133,6 @@ export default class SnapshotPanel extends ResizeResponsiveComponent<SnapshotPan
|
||||
} else {
|
||||
return window.innerWidth < 800;
|
||||
}
|
||||
return window.innerWidth < 500;
|
||||
}
|
||||
getPortraitOrientation() {
|
||||
return window.innerWidth * 2 < window.innerHeight * 3;
|
||||
|
||||
@@ -50,7 +50,7 @@ const styles = (theme: Theme) => createStyles({
|
||||
flex: "1 1 auto",
|
||||
},
|
||||
pluginTable: {
|
||||
border: "collapse",
|
||||
borderCollapse: "collapse",
|
||||
width: "100%",
|
||||
|
||||
},
|
||||
@@ -66,6 +66,13 @@ const styles = (theme: Theme) => createStyles({
|
||||
verticalAlign: "top",
|
||||
paddingTop: 12
|
||||
},
|
||||
plainRow: {
|
||||
borderWidth: "1px 0px 0px 0px", borderStyle: "solid", borderColor: "transparent"
|
||||
},
|
||||
dividerRow: {
|
||||
borderWidth: "1px 0px 0px 0px", borderStyle: "solid", borderColor: theme.palette.divider
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -118,40 +125,53 @@ export const SystemMidiBindingDialog =
|
||||
|
||||
createBindings(): BindingEntry[] {
|
||||
let result: BindingEntry[] = [];
|
||||
for (var item of this.model.systemMidiBindings.get())
|
||||
{
|
||||
let displayName = "";
|
||||
let instanceId = -1;
|
||||
|
||||
if (item.symbol === "prevProgram")
|
||||
{
|
||||
displayName = "Previous Preset";
|
||||
instanceId = 1;
|
||||
} else if (item.symbol === "nextProgram")
|
||||
{
|
||||
displayName = "Next Preset";
|
||||
instanceId = 2;
|
||||
} else if (item.symbol === "startHotspot")
|
||||
{
|
||||
displayName = "Enable Hotspot";
|
||||
instanceId = 3;
|
||||
} else if (item.symbol === "stopHotspot")
|
||||
{
|
||||
displayName = "Disable Hotspot";
|
||||
instanceId = 4;
|
||||
} else if (item.symbol === "shutdown")
|
||||
{
|
||||
displayName = "Shutdown";
|
||||
instanceId = 5;
|
||||
} else if (item.symbol === "reboot")
|
||||
{
|
||||
displayName = "Reboot";
|
||||
instanceId = 6;
|
||||
let listenInstanceId = 0;
|
||||
for (var item of this.model.systemMidiBindings.get()) {
|
||||
let displayName = "";
|
||||
let found = true;
|
||||
if (item.symbol === "nextBank") {
|
||||
displayName = "Next Bank";
|
||||
}
|
||||
|
||||
if (instanceId !== -1)
|
||||
{
|
||||
result.push(new BindingEntry(displayName,instanceId,item));
|
||||
else if (item.symbol === "prevBank") {
|
||||
displayName = "Previous Bank";
|
||||
}
|
||||
else if (item.symbol === "nextProgram") {
|
||||
displayName = "Next Preset";
|
||||
}else if (item.symbol === "prevProgram") {
|
||||
displayName = "Previous Preset";
|
||||
}
|
||||
else if (item.symbol === "snapshot1") {
|
||||
displayName = "Snapshot 1";
|
||||
}
|
||||
else if (item.symbol === "snapshot2") {
|
||||
displayName = "Snapshot 2";
|
||||
}
|
||||
else if (item.symbol === "snapshot3") {
|
||||
displayName = "Snapshot 3";
|
||||
}
|
||||
else if (item.symbol === "snapshot4") {
|
||||
displayName = "Snapshot 4";
|
||||
}
|
||||
else if (item.symbol === "snapshot5") {
|
||||
displayName = "Snapshot 5";
|
||||
}
|
||||
else if (item.symbol === "snapshot6") {
|
||||
displayName = "Snapshot 6";
|
||||
} else if (item.symbol === "startHotspot") {
|
||||
displayName = "Enable Hotspot";
|
||||
} else if (item.symbol === "stopHotspot") {
|
||||
displayName = "Disable Hotspot";
|
||||
} else if (item.symbol === "shutdown") {
|
||||
displayName = "Shutdown";
|
||||
} else if (item.symbol === "reboot") {
|
||||
displayName = "Reboot";
|
||||
} else {
|
||||
found = false;
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
result.push(new BindingEntry(displayName, listenInstanceId, item));
|
||||
++listenInstanceId;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -174,8 +194,7 @@ export const SystemMidiBindingDialog =
|
||||
clearTimeout(this.listenTimeoutHandle);
|
||||
this.listenTimeoutHandle = undefined;
|
||||
}
|
||||
if (this.listenHandle)
|
||||
{
|
||||
if (this.listenHandle) {
|
||||
this.model.cancelListenForMidiEvent(this.listenHandle)
|
||||
this.listenHandle = undefined;
|
||||
}
|
||||
@@ -184,14 +203,11 @@ export const SystemMidiBindingDialog =
|
||||
|
||||
}
|
||||
|
||||
handleListenSucceeded(instanceId: number, symbol: string, isNote: boolean, noteOrControl: number)
|
||||
{
|
||||
handleListenSucceeded(instanceId: number, symbol: string, isNote: boolean, noteOrControl: number) {
|
||||
this.cancelListenForControl();
|
||||
|
||||
for (var binding of this.state.systemMidiBindings)
|
||||
{
|
||||
if (binding.instanceId === instanceId)
|
||||
{
|
||||
for (var binding of this.state.systemMidiBindings) {
|
||||
if (binding.instanceId === instanceId) {
|
||||
let newBinding = binding.midiBinding.clone();
|
||||
|
||||
if (isNote) {
|
||||
@@ -201,8 +217,8 @@ export const SystemMidiBindingDialog =
|
||||
newBinding.bindingType = MidiBinding.BINDING_TYPE_CONTROL;
|
||||
newBinding.control = noteOrControl;
|
||||
}
|
||||
|
||||
this.model.setSystemMidiBinding(instanceId,newBinding);
|
||||
|
||||
this.model.setSystemMidiBinding(instanceId, newBinding);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -218,9 +234,9 @@ export const SystemMidiBindingDialog =
|
||||
|
||||
this.listenHandle = this.model.listenForMidiEvent(listenForControl,
|
||||
(isNote: boolean, noteOrControl: number) => {
|
||||
this.handleListenSucceeded(instanceId,symbol,isNote, noteOrControl);
|
||||
this.handleListenSucceeded(instanceId, symbol, isNote, noteOrControl);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -229,7 +245,7 @@ export const SystemMidiBindingDialog =
|
||||
}
|
||||
|
||||
onMidiBindingsChanged() {
|
||||
this.setState({systemMidiBindings: this.createBindings()});
|
||||
this.setState({ systemMidiBindings: this.createBindings() });
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@@ -256,10 +272,20 @@ export const SystemMidiBindingDialog =
|
||||
let result: React.ReactNode[] = [];
|
||||
|
||||
let items = this.state.systemMidiBindings;
|
||||
|
||||
|
||||
for (var item of items) {
|
||||
let symbol = item.midiBinding.symbol;
|
||||
let hasDivider = symbol === "snapshot1" || symbol === "stopHotspot" || symbol === "shotdown";
|
||||
if (hasDivider)
|
||||
{
|
||||
result.push(
|
||||
<tr>
|
||||
<td colSpan={2} className={classes.dividerRow}><div style={{height: 1}} /></td>
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
result.push(
|
||||
<tr key={item.instanceId}>
|
||||
<tr key={item.instanceId} >
|
||||
<td className={classes.nameTd}>
|
||||
<Typography noWrap style={{ verticalAlign: "center", height: 48 }}>
|
||||
{item.displayName}
|
||||
@@ -268,8 +294,7 @@ export const SystemMidiBindingDialog =
|
||||
<td className={classes.bindingTd}>
|
||||
<SystemMidiBindingView instanceId={item.instanceId} midiBinding={item.midiBinding}
|
||||
onListen={(instanceId: number, symbol: string, listenForControl: boolean) => {
|
||||
if (instanceId === -2)
|
||||
{
|
||||
if (instanceId === -2) {
|
||||
this.cancelListenForControl();
|
||||
} else {
|
||||
this.handleListenForControl(instanceId, symbol, listenForControl);
|
||||
@@ -300,52 +325,52 @@ export const SystemMidiBindingDialog =
|
||||
}
|
||||
|
||||
return (
|
||||
<DialogEx tag="systemMidiBindings" open={open} fullWidth onClose={this.handleClose} aria-labelledby="Rename-dialog-title"
|
||||
fullScreen={true}
|
||||
style={{userSelect: "none"}}
|
||||
<DialogEx tag="systemMidiBindings" open={open} fullWidth onClose={this.handleClose} aria-labelledby="Rename-dialog-title"
|
||||
fullScreen={true}
|
||||
style={{ userSelect: "none" }}
|
||||
>
|
||||
<div style={{ display: "flex", flexDirection: "column", flexWrap: "nowrap", width: "100%", height: "100%", overflow: "hidden" }}>
|
||||
<div style={{ flex: "0 0 auto" }}>
|
||||
<AppBar className={classes.dialogAppBar} >
|
||||
<Toolbar>
|
||||
<IconButton
|
||||
edge="start"
|
||||
color="inherit"
|
||||
onClick={this.handleClose}
|
||||
aria-label="back"
|
||||
size="large">
|
||||
<ArrowBackIcon />
|
||||
</IconButton>
|
||||
<Typography variant="h6" className={classes.dialogTitle}>
|
||||
System MIDI Bindings
|
||||
</Typography>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
</div>
|
||||
<div style={{ overflow: "auto", flex: "1 1 auto", width: "100%" }}>
|
||||
<table className={classes.pluginTable} >
|
||||
<colgroup>
|
||||
<col style={{ width: "auto" }} />
|
||||
<col style={{ width: "100%" }} />
|
||||
</colgroup>
|
||||
|
||||
<tbody>
|
||||
{this.generateTable()}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div style={{ display: "flex", flexDirection: "column", flexWrap: "nowrap", width: "100%", height: "100%", overflow: "hidden" }}>
|
||||
<div style={{ flex: "0 0 auto" }}>
|
||||
<AppBar className={classes.dialogAppBar} >
|
||||
<Toolbar>
|
||||
<IconButton
|
||||
edge="start"
|
||||
color="inherit"
|
||||
onClick={this.handleClose}
|
||||
aria-label="back"
|
||||
size="large">
|
||||
<ArrowBackIcon />
|
||||
</IconButton>
|
||||
<Typography variant="h6" className={classes.dialogTitle}>
|
||||
System MIDI Bindings
|
||||
</Typography>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
</div>
|
||||
<Snackbar
|
||||
anchorOrigin={{
|
||||
vertical: 'bottom',
|
||||
horizontal: 'left',
|
||||
}}
|
||||
open={this.state.listenSnackbarOpen}
|
||||
autoHideDuration={1500}
|
||||
onClose={() => this.setState({ listenSnackbarOpen: false })}
|
||||
message="Listening for MIDI input"
|
||||
/>
|
||||
<div style={{ overflow: "auto", flex: "1 1 auto", width: "100%" }}>
|
||||
<table className={classes.pluginTable} >
|
||||
<colgroup>
|
||||
<col style={{ width: "auto" }} />
|
||||
<col style={{ width: "100%" }} />
|
||||
</colgroup>
|
||||
|
||||
<tbody>
|
||||
{this.generateTable()}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<Snackbar
|
||||
anchorOrigin={{
|
||||
vertical: 'bottom',
|
||||
horizontal: 'left',
|
||||
}}
|
||||
open={this.state.listenSnackbarOpen}
|
||||
autoHideDuration={1500}
|
||||
onClose={() => this.setState({ listenSnackbarOpen: false })}
|
||||
message="Listening for MIDI input"
|
||||
/>
|
||||
</DialogEx >
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
// converts android handling of the virtual keyboard to use pan instead of zoom.
|
||||
|
||||
import { isAndroidHosted } from './AndroidHost';
|
||||
import Rectangle from './Rectangle';
|
||||
|
||||
|
||||
@@ -45,7 +46,7 @@ export default class VirtualKeyboardHandler
|
||||
}
|
||||
}
|
||||
|
||||
if ('visualViewport' in window) {
|
||||
if ('visualViewport' in window && isAndroidHosted()) {
|
||||
window.visualViewport?.addEventListener('resize', this.handleVisualViewportResize.bind(this));
|
||||
} else {
|
||||
enabled = false;
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import {isAndroidHosted} from './AndroidHost';
|
||||
|
||||
|
||||
var validScales = [1.0,1.10,1.25,1.35,1.50,1.75,2.0,2.5];
|
||||
|
||||
export function canScaleWindow(): boolean {
|
||||
return getValidWindowScales().length > 1;
|
||||
}
|
||||
|
||||
export function getValidWindowScales(): number[]
|
||||
{
|
||||
if (isAndroidHosted())
|
||||
{
|
||||
return [1.0];
|
||||
}
|
||||
let result: number[] = [];
|
||||
let minDimension = Math.min(window.innerHeight,window.innerWidth);
|
||||
|
||||
for (let validScale of validScales)
|
||||
{
|
||||
if (minDimension/validScale > 400)
|
||||
{
|
||||
result.push(validScale);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function setWindowScale(scale: number): void {
|
||||
localStorage.setItem("pipedalWindowScale", scale.toString());
|
||||
}
|
||||
export function getWindowScale(): number {
|
||||
const strvalue = localStorage.getItem("pipedalWindowScale");
|
||||
return strvalue ? parseFloat(strvalue) : 1.0;
|
||||
}
|
||||
|
||||
export function getWindowScaleText(scale?: number)
|
||||
{
|
||||
let value: number;
|
||||
if (scale)
|
||||
{
|
||||
value = scale;
|
||||
} else {
|
||||
value = getWindowScale();
|
||||
}
|
||||
let iValue = Math.round(value*100);
|
||||
return iValue.toString() + "%";
|
||||
}
|
||||
Reference in New Issue
Block a user