Checkpoint point, pre instantiation of supplementary LV2pedalboards.

This commit is contained in:
Robin E.R. Davies
2026-03-05 09:19:51 -05:00
parent 564ed914cc
commit 1f60e02ce0
39 changed files with 1502 additions and 694 deletions
+19 -8
View File
@@ -15,10 +15,24 @@ function isActiveChannel(channels: number[]): boolean {
return channels[1] !== -1 || channels[0] !== -1;
}
function chName(ch: number): string {
function chName(ch: number, maxChannels: number): string {
if (ch === -1) {
return "None";
}
if (ch === MAIN_OUT_LEFT_CHANNEL) {
return "Main Out L";
}
if (ch === MAIN_OUT_RIGHT_CHANNEL) {
return "Main Out R";
}
if (maxChannels <= 2) {
if (ch === 0) {
return "Left";
}
if (ch === 1) {
return "Right";
}
}
return "Ch" + (ch + 1);
}
function channelPairName(channels: number[], maxChannels: number, input: boolean): string {
@@ -39,17 +53,14 @@ function channelPairName(channels: number[], maxChannels: number, input: boolean
if (channels[0] === 0 && (channels[0] === channels[1] || channels[1] === -1)) {
return "Left";
}
if (channels[1] === 1 && (channels[0] === channels[1])) {
if (channels[1] === 1 && (channels[0] === channels[1] || channels[0] === -1)) {
return "Right";
}
if (channels[0] === 1 && channels[1] === 0) {
return "Right,Left";
}
}
if (channels[0] === channels[1]) {
return chName(channels[0]);
if (channels[0] === channels[1] || channels[1] === -1) {
return chName(channels[0],maxChannels);
}
return '[' + chName(channels[0]) + " " + chName(channels[1]) + "]";
return '[' + chName(channels[0],maxChannels) + " " + chName(channels[1],maxChannels) + "]";
}
@@ -19,6 +19,7 @@
import React from 'react';
import { useState } from 'react';
import VuMeter from './VuMeter';
import HelpOutlineIcon from '@mui/icons-material/HelpOutline';
import Divider from '@mui/material/Divider';
import MoreVertIcon from '@mui/icons-material/MoreVert';
@@ -45,8 +46,8 @@ import { PiPedalModel, PiPedalModelFactory } from './PiPedalModel';
import { JackConfiguration } from './Jack';
let debugInputChannels: number | null = 1;
let debugOutputChannels: number | null = 1;
let debugInputChannels: number | null = null;
let debugOutputChannels: number | null = null;
export interface ChannelRouterSettingsDialogProps {
@@ -539,11 +540,25 @@ function ChannelRouterSettingsDialog(props: ChannelRouterSettingsDialogProps) {
</Select>
)
}
let Vu = () => {
let Vu = (routeType: RouteType, input: boolean) => {
let instanceId: number;
switch (routeType) {
case RouteType.Main:
instanceId = input ? Pedalboard.START_CONTROL : Pedalboard.MAIN_INSERT_END_CONTROL_ID;
break;
case RouteType.Aux:
instanceId = input ? Pedalboard.AUX_INSERT_START_CONTROL_ID : Pedalboard.AUX_INSERT_END_CONTROL_ID;
break;
case RouteType.Send:
instanceId = input ? Pedalboard.SEND_RETURN_CONTROL : Pedalboard.SEND_OUTPUT_CONTROL;
}
return (
<div style={{}} >
<div style={{ width: 8, height: 48, background: "black" }}></div>
{/* <VuMeter instanceId={Pedalboard.CHANNEL_ROUTER_MAIN_INSERT_ID} display={"input"} /> */}
<VuMeter instanceId={instanceId}
display={input? "input": "output"}
height={48} />
</div>
);
}
@@ -603,7 +618,7 @@ function ChannelRouterSettingsDialog(props: ChannelRouterSettingsDialogProps) {
let PresetSelect = (width: number | string | undefined) => {
return (
<div style={{ display: "flex", flexDirection: "row", marginTop: 2, alignItems: "center" }}>
<div style={{ display: "flex", flexDirection: "row", alignItems: "center", width: width }}>
<div style={{ flex: "0 0 auto" }}>
<IconButtonEx tooltip="Save current preset"
style={{ flex: "0 0 auto", color: "#FFFFFF" }}
@@ -622,7 +637,7 @@ function ChannelRouterSettingsDialog(props: ChannelRouterSettingsDialogProps) {
{GeneratePresetMenuItems()}
</Select>
</div>
<IconButtonEx tooltip="Presets" aria-label="more-presets" style={{ marginRight: 24 }}>
<IconButtonEx tooltip="Presets" aria-label="more-presets" style={{ marginRight: 8 }}>
<MoreVertIcon style={{ opacity: 0.6 }} onClick={() => { }} />
</IconButtonEx>
</div>
@@ -658,14 +673,14 @@ function ChannelRouterSettingsDialog(props: ChannelRouterSettingsDialogProps) {
<td style={cellLeft}>
{ChannelSelect(RouteType.Main, 0, true)}
</td>
<td rowSpan={2} style={cellLeft}>{Vu()}</td>
<td rowSpan={2} style={cellLeft}>{Vu(RouteType.Main, true)}</td>
<td rowSpan={2} style={cellLeft}>
<Button variant="outlined" style={{ textTransform: "none", borderRadius: 24 }}>
Inserts
</Button>
</td>
<td rowSpan={2} style={cellLeft}>{Vu()}</td>
<td rowSpan={2} style={cellLeft}>{Vu(RouteType.Main, false)}</td>
<td style={cellLeft}>
{ChannelSelect(RouteType.Main, 0, false)}
</td>
@@ -691,18 +706,17 @@ function ChannelRouterSettingsDialog(props: ChannelRouterSettingsDialogProps) {
<td style={cellLeft}>
{(ChannelSelect(RouteType.Aux, 0, true))}
</td>
<td rowSpan={2} style={cellLeft}>{Vu()}</td>
<td rowSpan={2} style={cellLeft}>{Vu(RouteType.Aux, true)}</td>
<td rowSpan={2} style={cellLeft}>
<Button variant="outlined" style={{
textTransform: "none", borderRadius: 24,
}}
disabled={auxInsertDisabled}>
Inserts
</Button>
</td>
<td rowSpan={2} style={cellLeft}>{Vu()}</td>
<td rowSpan={2} style={cellLeft}>{Vu(RouteType.Aux, false)}</td>
<td style={cellLeft}>
{(ChannelSelect(RouteType.Aux, 0, false))}
</td>
@@ -728,11 +742,11 @@ function ChannelRouterSettingsDialog(props: ChannelRouterSettingsDialogProps) {
<td style={cellLeft}>
{(ChannelSelect(RouteType.Send, 0, false))}
</td>
<td rowSpan={2} style={cellLeft}>{Vu()}</td>
<td rowSpan={2} style={cellLeft}>{Vu(RouteType.Send,false)}</td>
<td rowSpan={2} style={cellLeft}>
{/* No button */}
</td>
<td rowSpan={2} style={cellLeft}>{Vu()}</td>
<td rowSpan={2} style={cellLeft}>{Vu(RouteType.Send,true)}</td>
<td style={cellLeft}>
{(ChannelSelect(RouteType.Send, 0, true))}
</td>
@@ -798,7 +812,7 @@ function ChannelRouterSettingsDialog(props: ChannelRouterSettingsDialogProps) {
<table>
<tbody>
<tr>
<td style={cellPortraitControlStrip}>{Vu()}</td>
<td style={cellPortraitControlStrip}>{Vu(RouteType.Main,true)}</td>
<td style={cellPortraitControlStrip}>
<div style={{ marginLeft: 8, marginRight: 8 }}>
<Button variant="outlined" style={{ textTransform: "none", borderRadius: 24 }}>
@@ -807,7 +821,7 @@ function ChannelRouterSettingsDialog(props: ChannelRouterSettingsDialogProps) {
</div>
</td>
<td style={cellPortraitControlStrip}>{Vu()}</td>
<td style={cellPortraitControlStrip}>{Vu(RouteType.Main,false)}</td>
</tr>
</tbody>
@@ -862,7 +876,7 @@ function ChannelRouterSettingsDialog(props: ChannelRouterSettingsDialogProps) {
<table>
<tbody>
<tr>
<td style={cellPortraitControlStrip}>{Vu()}</td>
<td style={cellPortraitControlStrip}>{Vu(RouteType.Aux, true)}</td>
<td style={cellPortraitControlStrip}>
<div style={{ marginLeft: 8, marginRight: 8 }}>
<Button variant="outlined" style={{
@@ -875,7 +889,7 @@ function ChannelRouterSettingsDialog(props: ChannelRouterSettingsDialogProps) {
</div>
</td>
<td style={cellPortraitControlStrip}>{Vu()}</td>
<td style={cellPortraitControlStrip}>{Vu(RouteType.Aux, false)}</td>
</tr>
</tbody>
@@ -929,7 +943,7 @@ function ChannelRouterSettingsDialog(props: ChannelRouterSettingsDialogProps) {
<table>
<tbody>
<tr>
<td style={cellPortraitControlStrip}>{Vu()}</td>
<td style={cellPortraitControlStrip}>{Vu(RouteType.Send, false)}</td>
<td style={cellPortraitControlStrip}>
<div style={{ marginLeft: 8, marginRight: 8, visibility: "hidden" }}>
<Button variant="outlined" style={{ textTransform: "none", borderRadius: 24 }}>
@@ -938,7 +952,7 @@ function ChannelRouterSettingsDialog(props: ChannelRouterSettingsDialogProps) {
</div>
</td>
<td style={cellPortraitControlStrip}>{Vu()}</td>
<td style={cellPortraitControlStrip}>{Vu(RouteType.Send, true)}</td>
</tr>
</tbody>
@@ -1000,11 +1014,11 @@ function ChannelRouterSettingsDialog(props: ChannelRouterSettingsDialogProps) {
{
landscape ? (
<>
<div style={{ flexGrow: 1 }}>&nbsp;</div>
<div style={{ flexShrink: 1, maxWidth: 440, display: "relative", marginLeft: 16, marginRight: 16 }}>
{PresetSelect(200)}
<div style={{ flexGrow: 1 }}></div>
<div style={{ flexShrink: 0, display: "relative", marginLeft: 8, marginRight: 8 }}>
{PresetSelect("325px")}
</div>
<div style={{ flexGrow: 1 }}>&nbsp;</div>
<div style={{ flexGrow: 1 }}></div>
</>
) : (
+2
View File
@@ -381,6 +381,8 @@ export class Pedalboard implements Deserializable<Pedalboard> {
static readonly START_CONTROL = -2; // synthetic PedalboardItem for input volume.
static readonly END_CONTROL = -3; // synthetic PedalboardItem for output volume.
static readonly SEND_OUTPUT_CONTROL = -4; // synthetic PedalboardItem for send output volume.
static readonly SEND_RETURN_CONTROL = -5; // synthetic PedalboardItem for send return volume.
static readonly MAIN_INSERT_START_CONTROL_ID = Pedalboard.MAIN_INSERT_INSTANCE_BASE + -2 + MAX_INSTANCE_ID;
static readonly MAIN_INSERT_END_CONTROL_ID = Pedalboard.MAIN_INSERT_INSTANCE_BASE + -3 + MAX_INSTANCE_ID;
static readonly AUX_INSERT_START_CONTROL_ID = Pedalboard.AUX_INSERT_INSTANCE_BASE + -2 + MAX_INSTANCE_ID
+4
View File
@@ -2517,6 +2517,7 @@ export class PiPedalModel //implements PiPedalModel
} else {
let newTarget = new VuSubscriptionTarget();
newTarget.subscribers.push(result);
this.vuSubscriptions[instanceId] = newTarget;
this.webSocket.request<number>("addVuSubscription", instanceId)
.then((subscriptionHandle) => {
@@ -2526,6 +2527,9 @@ export class PiPedalModel //implements PiPedalModel
} else {
newTarget.serverSubscriptionHandle = subscriptionHandle;
}
}).catch((error) => {
// failed to subscribe.
this.vuSubscriptions[instanceId] = undefined;
});
this.vuSubscriptions[instanceId] = newTarget;
+16 -1
View File
@@ -200,6 +200,7 @@ interface VuMeterProps extends WithStyles<typeof styles> {
instanceId: number;
display: "input" | "output";
theme: Theme;
height: number | undefined;
displayText?: boolean;
}
@@ -462,6 +463,20 @@ export const VuMeter =
render() {
let displayText = this.props.displayText??false;
const classes = withStyles.getClasses(this.props);
if (this.props.height !== undefined)
{
let height = this.props.height;
let scale = height / DISPLAY_HEIGHT;
return (
<div style={{ height: height, transform: `scale(1.0, ${scale})`, transformOrigin: "top left" }}>
<div className={this.state.isStereo? classes.stereoTextFrame: classes.monoTextFrame}>
{
this.renderVus()
}
</div>
</div>
);
}
if (displayText)
{
return (
@@ -526,7 +541,7 @@ export const VuMeter =
componentDidMount() {
this.model.state.addOnChangedHandler(this.onStateChanged);
this.addVuSubscription();
//this.addVuSubscription();
}
componentWillUnmount() {
this.removeVuSubscription();