Control Zooming disabled.

This commit is contained in:
Robin E. R. Davies
2025-07-19 13:26:53 -04:00
parent 6d7f79c6af
commit 71fc534a78
14 changed files with 109 additions and 33 deletions
+1
View File
@@ -537,6 +537,7 @@ JSON_MAP_BEGIN(Pedalboard)
JSON_MAP_REFERENCE(Pedalboard,nextInstanceId)
JSON_MAP_REFERENCE(Pedalboard,snapshots)
JSON_MAP_REFERENCE(Pedalboard,selectedSnapshot)
JSON_MAP_REFERENCE(Pedalboard,selectedPlugin)
JSON_MAP_END()
JSON_MAP_BEGIN(SnapshotValue)
+3
View File
@@ -197,6 +197,8 @@ class Pedalboard {
std::vector<std::shared_ptr<Snapshot>> snapshots_;
int64_t selectedSnapshot_ = -1;
int64_t selectedPlugin_ = -1;
public:
// deep copy, breaking shared pointers.
Pedalboard DeepCopy();
@@ -224,6 +226,7 @@ public:
GETTER_SETTER(output_volume_db)
GETTER_SETTER_VEC(snapshots)
GETTER_SETTER(selectedSnapshot)
GETTER_SETTER(selectedPlugin)
DECLARE_JSON_MAP(Pedalboard);
+12
View File
@@ -2595,6 +2595,16 @@ std::shared_ptr<Lv2Pedalboard> PiPedalModel::GetLv2Pedalboard()
}
return lv2Pedalboard;
}
void PiPedalModel::SetSelectedPedalboardPlugin(uint64_t clientId, uint64_t pedalboardId)
{
// Thinking on this:
// 1) do NOT mark the pedalboard as changed. This shouldn't set a change flag.
// 2) do NOT broadcast the change. Whoever set it last controls what happens when the plugin is reloaded. Meh.
// 3) Clients must be able to save a non-changed pedalboard.
pedalboard.selectedPlugin(pedalboardId);
}
bool PiPedalModel::LoadCurrentPedalboard()
{
if (previousPedalboardLoaded && pedalboard.IsStructureIdentical(previousPedalboard))
@@ -3075,3 +3085,5 @@ bool PiPedalModel::HasTone3000Auth() const
return storage.GetTone3000Auth() != "";
}
+2
View File
@@ -489,6 +489,8 @@ namespace pipedal
void SetTone3000Auth(const std::string &apiKey);
bool HasTone3000Auth() const;
void SetSelectedPedalboardPlugin(uint64_t clientId, uint64_t pedalboardId);
};
} // namespace pipedal.
+21
View File
@@ -472,6 +472,21 @@ JSON_MAP_REFERENCE(SetSnapshotsBody, snapshots)
JSON_MAP_REFERENCE(SetSnapshotsBody, selectedSnapshot)
JSON_MAP_END()
class SetSelectedPedalboardPluginBody
{
public:
uint64_t clientId_;
uint64_t pluginInstanceId_;
DECLARE_JSON_MAP(SetSelectedPedalboardPluginBody);
};
JSON_MAP_BEGIN(SetSelectedPedalboardPluginBody)
JSON_MAP_REFERENCE(SetSelectedPedalboardPluginBody, clientId)
JSON_MAP_REFERENCE(SetSelectedPedalboardPluginBody, pluginInstanceId)
JSON_MAP_END()
class SnapshotModifiedBody
{
public:
@@ -1300,6 +1315,12 @@ public:
int64_t result = this->model.SaveCurrentPresetAs(this->clientId, body.name_, body.saveAfterInstanceId_);
Reply(replyTo, "saveCurrentPresetsAs", result);
}
else if (message == "setSelectedPedalboardPlugin")
{
SetSelectedPedalboardPluginBody body;
pReader->read(&body);
this->model.SetSelectedPedalboardPlugin(body.clientId_,body.pluginInstanceId_);
}
else if (message == "savePluginPresetAs")
{
SavePluginPresetAsBody body;
+2
View File
@@ -1,3 +1,5 @@
Crash-proofing: do not reload pedalboard if the previous run crashed before normal shutdown.
Persist and reconnect IP addresses in client.
Zeroconv crash assert. /var/pipedal/audio_uploads/ReverbImpulseFiles/
+31 -19
View File
@@ -82,7 +82,7 @@ const styles = ({ palette }: Theme) => {
}),
pedalboardScroll: css({
position: "relative", width: "100%",
flex: "0 0 auto", overflow: "auto", maxHeight: 220,
flex: "0 0 auto", overflow: "auto", maxHeight: 220,
}),
pedalboardScrollSmall: css({
position: "relative", width: "100%",
@@ -158,7 +158,10 @@ export const MainPage =
super(props);
this.model = PiPedalModelFactory.getInstance();
let pedalboard = this.model.pedalboard.get();
let selectedPedal = pedalboard.getFirstSelectableItem();
let selectedPedal = pedalboard.selectedPlugin;
if (selectedPedal === -1) {
selectedPedal = pedalboard.getFirstSelectableItem();
}
this.state = {
selectedPedal: selectedPedal,
@@ -243,12 +246,16 @@ export const MainPage =
this.model.loadPluginPreset(instanceId, presetInstanceId);
}
onPedalboardChanged(value: Pedalboard) {
let selectedItem = -1;
if (this.state.selectedPedal === Pedalboard.START_CONTROL || this.state.selectedPedal === Pedalboard.END_CONTROL) {
selectedItem = this.state.selectedPedal;
} else if (value.hasItem(this.state.selectedPedal)) {
selectedItem = this.state.selectedPedal;
} else {
// let selectedItem = -1;
// if (this.state.selectedPedal === Pedalboard.START_CONTROL || this.state.selectedPedal === Pedalboard.END_CONTROL) {
// selectedItem = this.state.selectedPedal;
// } else if (value.hasItem(this.state.selectedPedal)) {
// selectedItem = this.state.selectedPedal;
// } else {
// selectedItem = value.getFirstSelectableItem();
// }
let selectedItem = value.selectedPlugin;
if (selectedItem === -1 || !value.hasItem(selectedItem)) {
selectedItem = value.getFirstSelectableItem();
}
this.setState({
@@ -265,9 +272,10 @@ export const MainPage =
}
onDeletePedal(instanceId: number): void {
// ok.
let result = this.model.deletePedalboardPedal(instanceId);
if (result != null) {
this.setState({ selectedPedal: result });
if (result != null)
this.setSelection(result); {
}
}
@@ -284,9 +292,9 @@ export const MainPage =
componentDidUpdate(prevProps: MainProps, prevState: MainState) {
if (prevState.selectedPedal !== this.state.selectedPedal
|| prevState.pedalboard !== this.state.pedalboard
|| prevState.pedalboard !== this.state.pedalboard
) {
this.setState({showModUi: this.state.pedalboard.maybeGetItem(this.state.selectedPedal)?.useModUi??false});
this.setState({ showModUi: this.state.pedalboard.maybeGetItem(this.state.selectedPedal)?.useModUi ?? false });
}
}
updateResponsive() {
@@ -305,6 +313,10 @@ export const MainPage =
setSelection(selectedId_: number): void {
this.setState({ selectedPedal: selectedId_ });
if (this.state.pedalboard.selectedPlugin !== selectedId_) {
this.model.setPedalboardSelectedPlugin(selectedId_);
this.state.pedalboard.selectedPlugin = selectedId_;
}
}
onSelectionChanged(selectedId: number): void {
@@ -335,7 +347,7 @@ export const MainPage =
this.setState({ loadDialogOpen: false });
let itemId = this.state.selectedPedal;
let newSelectedItem = this.model.loadPedalboardPlugin(itemId, selectedUri);
this.setState({ selectedPedal: newSelectedItem });
this.setSelection(newSelectedItem);
}
onSnapshotDialogOk(): void {
this.setState({ snapshotDialogOpen: false });
@@ -621,12 +633,12 @@ export const MainPage =
<div className={classes.frame}>
<div id="pedalboardScroll" className={horizontalScrollLayout ? classes.pedalboardScrollSmall : classes.pedalboardScroll}
style={{ maxHeight: horizontalScrollLayout ? undefined : this.state.screenHeight / 2 }}>
<PedalboardView key={pluginUri} selectedId={this.state.selectedPedal}
enableStructureEditing={this.props.enableStructureEditing}
onSelectionChanged={this.onSelectionChanged}
onDoubleClick={this.onPedalDoubleClick}
hasTinyToolBar={this.props.hasTinyToolBar}
/>
<PedalboardView key={pluginUri} selectedId={this.state.selectedPedal}
enableStructureEditing={this.props.enableStructureEditing}
onSelectionChanged={this.onSelectionChanged}
onDoubleClick={this.onPedalDoubleClick}
hasTinyToolBar={this.props.hasTinyToolBar}
/>
</div>
<div className={classes.separator} />
<div className={classes.controlToolBar}>
+2
View File
@@ -372,6 +372,7 @@ export class Pedalboard implements Deserializable<Pedalboard> {
this.snapshots = input.snapshots ? Snapshot.deserializeArray(input.snapshots): [];
this.selectedSnapshot = input.selectedSnapshot;
this.pathProperties = input.pathProperties;
this.selectedPlugin = input.selectedPlugin??-1;
return this;
}
@@ -387,6 +388,7 @@ export class Pedalboard implements Deserializable<Pedalboard> {
snapshots: (Snapshot | null)[] = [];
selectedSnapshot: number = -1;
pathProperties: {[Name: string]: string} = {};
selectedPlugin: number = -1;
*itemsGenerator(): Generator<PedalboardItem, void, undefined> {
let it = itemGenerator_(this.items);
+3 -1
View File
@@ -540,7 +540,9 @@ withStyles(
}
onPedalboardChanged(value?: Pedalboard) {
this.setState({ pedalboard: value });
this.setState({
pedalboard: value,
});
}
componentDidMount() {
+15
View File
@@ -1820,6 +1820,7 @@ export class PiPedalModel //implements PiPedalModel
let result = newPedalboard.deleteItem(instanceId);
if (result !== null) {
newPedalboard.selectedPlugin = result;
this.setModelPedalboard(newPedalboard);
this.updateServerPedalboard();
}
@@ -3505,6 +3506,20 @@ export class PiPedalModel //implements PiPedalModel
this.androidHost?.setScreenOrientation(value as number);
}
}
setPedalboardSelectedPlugin(pluginId: number): void {
let pedalboard = this.pedalboard.get();
if (!pedalboard) {
throw new PiPedalStateError("Pedalboard not loaded.");
}
if (pedalboard.selectedPlugin === pluginId) {
return; // no change.
}
pedalboard.selectedPlugin = pluginId; // naughty, because it doesn't broadcast.
// notify the server.
this.webSocket?.send("setSelectedPedalboardPlugin", { clientId: this.clientId, pluginInstanceId: pluginId });
}
};
let instance: PiPedalModel | undefined = undefined;
+9 -9
View File
@@ -367,15 +367,15 @@ const PluginControl =
}
}
if (this.isTouchDevice()) {
if (this.props.uiControl
&& (this.props.uiControl.isDial() || this.props.uiControl.isGraphicEq())
) {
this.isTap = false;
this.showZoomedControl();
return;
}
}
// if (this.isTouchDevice()) {
// if (this.props.uiControl
// && (this.props.uiControl.isDial() || this.props.uiControl.isGraphicEq())
// ) {
// this.isTap = false;
// this.showZoomedControl();
// return;
// }
// }
++this.pointersDown;
+3 -2
View File
@@ -81,10 +81,11 @@ function makeIoPluginInfo(name: string, uri: string): UiPlugin {
return result;
}
let startPluginInfo: UiPlugin =
export const startPluginInfo: UiPlugin =
makeIoPluginInfo("Input", Pedalboard.START_PEDALBOARD_ITEM_URI);
let endPluginInfo: UiPlugin =
export const endPluginInfo: UiPlugin =
makeIoPluginInfo("Output", Pedalboard.END_PEDALBOARD_ITEM_URI);
+1 -1
View File
@@ -304,7 +304,7 @@ const PresetSelector =
}}>
<div style={{ flex: "0 0 auto" }}>
<IconButtonEx tooltip="Save current preset"
style={{ flex: "0 0 auto", opacity: this.state.presets.presetChanged ? 1.0 : 0.0, color: "#FFFFFF" }}
style={{ flex: "0 0 auto", color: "#FFFFFF" }}
onClick={(e) => { this.handleSave(); }}
size="large">
<SaveIconOutline style={{ opacity: 0.75 }} color="inherit" />
+4 -1
View File
@@ -96,7 +96,10 @@ const ZoomedUiControl = withTheme(withStyles(
} else {
let uiControl = this.props.controlInfo.uiControl;
let instanceId = this.props.controlInfo.instanceId;
if (instanceId === -1) return 0;
if (instanceId === -2 && uiControl.symbol === "volume_db") {
return this.model.pedalboard.get()?.input_volume_db??0;
}
let pedalboardItem = this.model.pedalboard.get()?.getItem(instanceId);
let value: number = pedalboardItem?.getControlValue(uiControl.symbol) ?? 0;
return value;