@vessel-dsp/core 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editor/commands.d.ts +48 -0
- package/dist/editor/commands.d.ts.map +1 -0
- package/{src/editor/commands.ts → dist/editor/commands.js} +44 -91
- package/dist/editor/commands.js.map +1 -0
- package/dist/editor/factory.d.ts +10 -0
- package/dist/editor/factory.d.ts.map +1 -0
- package/{src/editor/factory.ts → dist/editor/factory.js} +11 -27
- package/dist/editor/factory.js.map +1 -0
- package/dist/editor/history.d.ts +29 -0
- package/dist/editor/history.d.ts.map +1 -0
- package/{src/editor/history.ts → dist/editor/history.js} +12 -42
- package/dist/editor/history.js.map +1 -0
- package/{src/editor/index.ts → dist/editor/index.d.ts} +1 -3
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +5 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/layout.d.ts +8 -0
- package/dist/editor/layout.d.ts.map +1 -0
- package/{src/editor/layout.ts → dist/editor/layout.js} +36 -90
- package/dist/editor/layout.js.map +1 -0
- package/dist/formats/circuit-json/serializer.d.ts +101 -0
- package/dist/formats/circuit-json/serializer.d.ts.map +1 -0
- package/{src/formats/circuit-json/serializer.ts → dist/formats/circuit-json/serializer.js} +352 -418
- package/dist/formats/circuit-json/serializer.js.map +1 -0
- package/dist/formats/document.d.ts +64 -0
- package/dist/formats/document.d.ts.map +1 -0
- package/{src/formats/document.ts → dist/formats/document.js} +43 -159
- package/dist/formats/document.js.map +1 -0
- package/dist/formats/interchange/parser.d.ts +3 -0
- package/dist/formats/interchange/parser.d.ts.map +1 -0
- package/{src/formats/interchange/parser.ts → dist/formats/interchange/parser.js} +157 -463
- package/dist/formats/interchange/parser.js.map +1 -0
- package/dist/formats/interchange/serializer.d.ts +9 -0
- package/dist/formats/interchange/serializer.d.ts.map +1 -0
- package/{src/formats/interchange/serializer.ts → dist/formats/interchange/serializer.js} +84 -186
- package/dist/formats/interchange/serializer.js.map +1 -0
- package/dist/formats/ltspice/catalog.d.ts +19 -0
- package/dist/formats/ltspice/catalog.d.ts.map +1 -0
- package/{src/formats/ltspice/catalog.ts → dist/formats/ltspice/catalog.js} +18 -52
- package/dist/formats/ltspice/catalog.js.map +1 -0
- package/dist/formats/ltspice/encoding.d.ts +2 -0
- package/dist/formats/ltspice/encoding.d.ts.map +1 -0
- package/{src/formats/ltspice/encoding.ts → dist/formats/ltspice/encoding.js} +17 -41
- package/dist/formats/ltspice/encoding.js.map +1 -0
- package/dist/formats/ltspice/parser.d.ts +3 -0
- package/dist/formats/ltspice/parser.d.ts.map +1 -0
- package/{src/formats/ltspice/parser.ts → dist/formats/ltspice/parser.js} +39 -141
- package/dist/formats/ltspice/parser.js.map +1 -0
- package/dist/formats/ltspice/serializer.d.ts +7 -0
- package/dist/formats/ltspice/serializer.d.ts.map +1 -0
- package/{src/formats/ltspice/serializer.ts → dist/formats/ltspice/serializer.js} +18 -45
- package/dist/formats/ltspice/serializer.js.map +1 -0
- package/dist/formats/schx/catalog.d.ts +19 -0
- package/dist/formats/schx/catalog.d.ts.map +1 -0
- package/{src/formats/schx/catalog.ts → dist/formats/schx/catalog.js} +48 -101
- package/dist/formats/schx/catalog.js.map +1 -0
- package/dist/formats/schx/parser.d.ts +3 -0
- package/dist/formats/schx/parser.d.ts.map +1 -0
- package/{src/formats/schx/parser.ts → dist/formats/schx/parser.js} +31 -86
- package/dist/formats/schx/parser.js.map +1 -0
- package/dist/formats/schx/runtime-descriptors.d.ts +3 -0
- package/dist/formats/schx/runtime-descriptors.d.ts.map +1 -0
- package/{src/formats/schx/runtime-descriptors.ts → dist/formats/schx/runtime-descriptors.js} +36 -123
- package/dist/formats/schx/runtime-descriptors.js.map +1 -0
- package/dist/formats/schx/serializer.d.ts +5 -0
- package/dist/formats/schx/serializer.d.ts.map +1 -0
- package/{src/formats/schx/serializer.ts → dist/formats/schx/serializer.js} +17 -42
- package/dist/formats/schx/serializer.js.map +1 -0
- package/dist/formats/schx/transforms.d.ts +4 -0
- package/dist/formats/schx/transforms.d.ts.map +1 -0
- package/{src/formats/schx/transforms.ts → dist/formats/schx/transforms.js} +6 -10
- package/dist/formats/schx/transforms.js.map +1 -0
- package/dist/formats/spice/parser.d.ts +3 -0
- package/dist/formats/spice/parser.d.ts.map +1 -0
- package/{src/formats/spice/parser.ts → dist/formats/spice/parser.js} +50 -96
- package/dist/formats/spice/parser.js.map +1 -0
- package/dist/formats/spice/serializer.d.ts +3 -0
- package/dist/formats/spice/serializer.d.ts.map +1 -0
- package/{src/formats/spice/serializer.ts → dist/formats/spice/serializer.js} +20 -16
- package/dist/formats/spice/serializer.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/model/connectivity.d.ts +16 -0
- package/dist/model/connectivity.d.ts.map +1 -0
- package/{src/model/connectivity.ts → dist/model/connectivity.js} +28 -63
- package/dist/model/connectivity.js.map +1 -0
- package/dist/model/netlist.d.ts +24 -0
- package/dist/model/netlist.d.ts.map +1 -0
- package/{src/model/netlist.ts → dist/model/netlist.js} +42 -110
- package/dist/model/netlist.js.map +1 -0
- package/dist/model/properties.d.ts +9 -0
- package/dist/model/properties.d.ts.map +1 -0
- package/{src/model/properties.ts → dist/model/properties.js} +10 -18
- package/dist/model/properties.js.map +1 -0
- package/dist/model/quantity.d.ts +3 -0
- package/dist/model/quantity.d.ts.map +1 -0
- package/{src/model/quantity.ts → dist/model/quantity.js} +7 -30
- package/dist/model/quantity.js.map +1 -0
- package/{src/model/types.ts → dist/model/types.d.ts} +17 -196
- package/dist/model/types.d.ts.map +1 -0
- package/dist/model/types.js +10 -0
- package/dist/model/types.js.map +1 -0
- package/dist/model/validation.d.ts +32 -0
- package/dist/model/validation.d.ts.map +1 -0
- package/{src/model/validation.ts → dist/model/validation.js} +172 -653
- package/dist/model/validation.js.map +1 -0
- package/dist/model/wires.d.ts +3 -0
- package/dist/model/wires.d.ts.map +1 -0
- package/{src/model/wires.ts → dist/model/wires.js} +10 -16
- package/dist/model/wires.js.map +1 -0
- package/dist/panel/extract.d.ts +5 -0
- package/dist/panel/extract.d.ts.map +1 -0
- package/{src/panel/extract.ts → dist/panel/extract.js} +146 -235
- package/dist/panel/extract.js.map +1 -0
- package/dist/panel/index.d.ts +6 -0
- package/dist/panel/index.d.ts.map +1 -0
- package/dist/panel/index.js +5 -0
- package/dist/panel/index.js.map +1 -0
- package/dist/panel/knobs.d.ts +7 -0
- package/dist/panel/knobs.d.ts.map +1 -0
- package/{src/panel/knobs.ts → dist/panel/knobs.js} +7 -18
- package/dist/panel/knobs.js.map +1 -0
- package/dist/panel/protocol.d.ts +9 -0
- package/dist/panel/protocol.d.ts.map +1 -0
- package/{src/panel/protocol.ts → dist/panel/protocol.js} +10 -26
- package/dist/panel/protocol.js.map +1 -0
- package/{src/panel/types.ts → dist/panel/types.d.ts} +50 -89
- package/dist/panel/types.d.ts.map +1 -0
- package/dist/panel/types.js +2 -0
- package/dist/panel/types.js.map +1 -0
- package/dist/preview/bounds.d.ts +12 -0
- package/dist/preview/bounds.d.ts.map +1 -0
- package/{src/preview/bounds.ts → dist/preview/bounds.js} +15 -29
- package/dist/preview/bounds.js.map +1 -0
- package/dist/preview/box-layout.d.ts +4 -0
- package/dist/preview/box-layout.d.ts.map +1 -0
- package/{src/preview/box-layout.ts → dist/preview/box-layout.js} +2 -6
- package/dist/preview/box-layout.js.map +1 -0
- package/dist/preview/colors.d.ts +3 -0
- package/dist/preview/colors.d.ts.map +1 -0
- package/{src/preview/colors.ts → dist/preview/colors.js} +3 -5
- package/dist/preview/colors.js.map +1 -0
- package/dist/preview/hanging.d.ts +8 -0
- package/dist/preview/hanging.d.ts.map +1 -0
- package/{src/preview/hanging.ts → dist/preview/hanging.js} +9 -28
- package/dist/preview/hanging.js.map +1 -0
- package/dist/preview/junctions.d.ts +3 -0
- package/dist/preview/junctions.d.ts.map +1 -0
- package/{src/preview/junctions.ts → dist/preview/junctions.js} +9 -24
- package/dist/preview/junctions.js.map +1 -0
- package/dist/preview/label-layout.d.ts +12 -0
- package/dist/preview/label-layout.d.ts.map +1 -0
- package/{src/preview/label-layout.ts → dist/preview/label-layout.js} +15 -36
- package/dist/preview/label-layout.js.map +1 -0
- package/dist/preview/ports.d.ts +17 -0
- package/dist/preview/ports.d.ts.map +1 -0
- package/{src/preview/ports.ts → dist/preview/ports.js} +10 -37
- package/dist/preview/ports.js.map +1 -0
- package/dist/preview/renderable-wires.d.ts +3 -0
- package/dist/preview/renderable-wires.d.ts.map +1 -0
- package/{src/preview/renderable-wires.ts → dist/preview/renderable-wires.js} +12 -29
- package/dist/preview/renderable-wires.js.map +1 -0
- package/dist/preview/routing.d.ts +4 -0
- package/dist/preview/routing.d.ts.map +1 -0
- package/dist/preview/routing.js +13 -0
- package/dist/preview/routing.js.map +1 -0
- package/dist/preview/snap.d.ts +9 -0
- package/dist/preview/snap.d.ts.map +1 -0
- package/{src/preview/snap.ts → dist/preview/snap.js} +9 -31
- package/dist/preview/snap.js.map +1 -0
- package/dist/preview/symbols/svg-content.d.ts +7 -0
- package/dist/preview/symbols/svg-content.d.ts.map +1 -0
- package/{src/preview/symbols/svg-content.ts → dist/preview/symbols/svg-content.js} +3 -6
- package/dist/preview/symbols/svg-content.js.map +1 -0
- package/dist/preview/symbols.d.ts +7 -0
- package/dist/preview/symbols.d.ts.map +1 -0
- package/{src/preview/symbols.ts → dist/preview/symbols.js} +18 -43
- package/dist/preview/symbols.js.map +1 -0
- package/dist/preview/wire-chains.d.ts +4 -0
- package/dist/preview/wire-chains.d.ts.map +1 -0
- package/{src/preview/wire-chains.ts → dist/preview/wire-chains.js} +37 -37
- package/dist/preview/wire-chains.js.map +1 -0
- package/package.json +3 -3
- package/src/index.ts +0 -255
- package/src/panel/index.ts +0 -39
- package/src/preview/routing.ts +0 -15
- package/src/preview/symbols/analog-switch.svg +0 -17
- package/src/preview/symbols/battery.svg +0 -16
- package/src/preview/symbols/bbd.svg +0 -21
- package/src/preview/symbols/bjt-npn.svg +0 -16
- package/src/preview/symbols/bjt-pnp.svg +0 -17
- package/src/preview/symbols/capacitor-electrolytic.svg +0 -13
- package/src/preview/symbols/capacitor.svg +0 -12
- package/src/preview/symbols/current-source.svg +0 -14
- package/src/preview/symbols/delay-ic.svg +0 -22
- package/src/preview/symbols/diode-schottky.svg +0 -12
- package/src/preview/symbols/diode-zener.svg +0 -12
- package/src/preview/symbols/diode.svg +0 -13
- package/src/preview/symbols/flipflop.svg +0 -20
- package/src/preview/symbols/ground.svg +0 -12
- package/src/preview/symbols/ic-block.svg +0 -20
- package/src/preview/symbols/ic.svg +0 -19
- package/src/preview/symbols/inductor.svg +0 -11
- package/src/preview/symbols/jack-input.svg +0 -16
- package/src/preview/symbols/jack-output.svg +0 -16
- package/src/preview/symbols/jfet-junction-n.svg +0 -17
- package/src/preview/symbols/jfet-n.svg +0 -17
- package/src/preview/symbols/jfet-p.svg +0 -17
- package/src/preview/symbols/label.svg +0 -8
- package/src/preview/symbols/led.svg +0 -18
- package/src/preview/symbols/mosfet-n.svg +0 -21
- package/src/preview/symbols/mosfet-p.svg +0 -21
- package/src/preview/symbols/named-wire.svg +0 -11
- package/src/preview/symbols/opamp.svg +0 -21
- package/src/preview/symbols/optocoupler.svg +0 -30
- package/src/preview/symbols/ota.svg +0 -20
- package/src/preview/symbols/pentode.svg +0 -25
- package/src/preview/symbols/photoresistor.svg +0 -19
- package/src/preview/symbols/port.svg +0 -8
- package/src/preview/symbols/potentiometer.svg +0 -15
- package/src/preview/symbols/power-amp.svg +0 -20
- package/src/preview/symbols/rail.svg +0 -11
- package/src/preview/symbols/regulator.svg +0 -13
- package/src/preview/symbols/relay.svg +0 -20
- package/src/preview/symbols/resistor.svg +0 -11
- package/src/preview/symbols/switch-3pdt.svg +0 -32
- package/src/preview/symbols/switch-rotary.svg +0 -23
- package/src/preview/symbols/switch-spdt.svg +0 -16
- package/src/preview/symbols/switch-spst.svg +0 -14
- package/src/preview/symbols/switch-toggle.svg +0 -14
- package/src/preview/symbols/transformer.svg +0 -17
- package/src/preview/symbols/triode.svg +0 -17
- package/src/preview/symbols/tube-diode.svg +0 -13
- package/src/preview/symbols/unsupported.svg +0 -8
- package/src/preview/symbols/variable-resistor.svg +0 -13
- package/src/preview/symbols/voltage-source.svg +0 -15
|
@@ -1,44 +1,6 @@
|
|
|
1
|
-
import { isParsedQuantity, propertyNumericValue, propertyStringValue } from '../model/properties';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
Component,
|
|
5
|
-
ControlInterface,
|
|
6
|
-
DeviceInterfaceBinding,
|
|
7
|
-
DeviceInterfaceControl,
|
|
8
|
-
DeviceInterfaceControlKind,
|
|
9
|
-
ParsedQuantity,
|
|
10
|
-
PropertyValue,
|
|
11
|
-
Warning,
|
|
12
|
-
} from '../model/types';
|
|
13
|
-
import type {
|
|
14
|
-
DeviceInterfaceProvenance,
|
|
15
|
-
ExtractedDeviceInterface,
|
|
16
|
-
ExtractedDeviceInterfaceControl,
|
|
17
|
-
ExternalControlAssignmentHint,
|
|
18
|
-
JackAudioRole,
|
|
19
|
-
JackPort,
|
|
20
|
-
JackRole,
|
|
21
|
-
Knob,
|
|
22
|
-
KnobStep,
|
|
23
|
-
KnobTaper,
|
|
24
|
-
LedIndicator,
|
|
25
|
-
Panel,
|
|
26
|
-
SliderControl,
|
|
27
|
-
SliderOrientation,
|
|
28
|
-
SliderRange,
|
|
29
|
-
SwitchControl,
|
|
30
|
-
SwitchKind,
|
|
31
|
-
} from './types';
|
|
32
|
-
import { buildKnobSteps, snapKnobPosition } from './knobs';
|
|
33
|
-
|
|
34
|
-
type RuntimeContinuousControlSpec = Readonly<{
|
|
35
|
-
key: string;
|
|
36
|
-
controlProperty: string;
|
|
37
|
-
wipeProperty: string;
|
|
38
|
-
sweepProperty: string;
|
|
39
|
-
}>;
|
|
40
|
-
|
|
41
|
-
const RUNTIME_CONTINUOUS_CONTROL_SPECS: readonly RuntimeContinuousControlSpec[] = [
|
|
1
|
+
import { isParsedQuantity, propertyNumericValue, propertyStringValue } from '../model/properties.js';
|
|
2
|
+
import { buildKnobSteps, snapKnobPosition } from './knobs.js';
|
|
3
|
+
const RUNTIME_CONTINUOUS_CONTROL_SPECS = [
|
|
42
4
|
{ key: 'time', controlProperty: 'TimeControl', wipeProperty: 'TimeControlWipe', sweepProperty: 'TimeControlSweep' },
|
|
43
5
|
{ key: 'feedback', controlProperty: 'FeedbackControl', wipeProperty: 'FeedbackControlWipe', sweepProperty: 'FeedbackControlSweep' },
|
|
44
6
|
{ key: 'mix', controlProperty: 'MixControl', wipeProperty: 'MixControlWipe', sweepProperty: 'MixControlSweep' },
|
|
@@ -47,23 +9,22 @@ const RUNTIME_CONTINUOUS_CONTROL_SPECS: readonly RuntimeContinuousControlSpec[]
|
|
|
47
9
|
{ key: 'mod-rate', controlProperty: 'ModRateControl', wipeProperty: 'ModRateControlWipe', sweepProperty: 'ModRateControlSweep' },
|
|
48
10
|
{ key: 'mod-depth', controlProperty: 'ModDepthControl', wipeProperty: 'ModDepthControlWipe', sweepProperty: 'ModDepthControlSweep' },
|
|
49
11
|
];
|
|
50
|
-
|
|
51
12
|
// extractPanel inspects a CircuitDocument and emits the typed Panel descriptor
|
|
52
13
|
// that drives the runtime control surface. It's a pure read over the existing
|
|
53
14
|
// schematic model — no parsing of the source format, no UI knowledge.
|
|
54
|
-
export function extractPanel(doc
|
|
55
|
-
const knobs
|
|
56
|
-
const sliders
|
|
57
|
-
const switches
|
|
58
|
-
const leds
|
|
59
|
-
const jacks
|
|
60
|
-
|
|
15
|
+
export function extractPanel(doc) {
|
|
16
|
+
const knobs = [];
|
|
17
|
+
const sliders = [];
|
|
18
|
+
const switches = [];
|
|
19
|
+
const leds = [];
|
|
20
|
+
const jacks = [];
|
|
61
21
|
for (const component of doc.components) {
|
|
62
22
|
switch (component.kind) {
|
|
63
23
|
case 'potentiometer': {
|
|
64
24
|
if (isSliderControl(component)) {
|
|
65
25
|
sliders.push(toSlider(component));
|
|
66
|
-
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
67
28
|
knobs.push(toKnob(component));
|
|
68
29
|
}
|
|
69
30
|
break;
|
|
@@ -96,7 +57,6 @@ export function extractPanel(doc: CircuitDocument): Panel {
|
|
|
96
57
|
}
|
|
97
58
|
}
|
|
98
59
|
applyControlInterfaces(doc.controlInterfaces, jacks);
|
|
99
|
-
|
|
100
60
|
return {
|
|
101
61
|
...(doc.panel === undefined ? {} : { placement: doc.panel }),
|
|
102
62
|
knobs,
|
|
@@ -106,27 +66,23 @@ export function extractPanel(doc: CircuitDocument): Panel {
|
|
|
106
66
|
jacks,
|
|
107
67
|
};
|
|
108
68
|
}
|
|
109
|
-
|
|
110
|
-
export function extractDeviceInterface(doc: CircuitDocument): ExtractedDeviceInterface {
|
|
69
|
+
export function extractDeviceInterface(doc) {
|
|
111
70
|
const panel = extractPanel(doc);
|
|
112
71
|
const inferredControls = inferDeviceInterfaceControls(doc, panel);
|
|
113
|
-
const diagnostics
|
|
114
|
-
const controls = new Map
|
|
115
|
-
|
|
72
|
+
const diagnostics = [];
|
|
73
|
+
const controls = new Map();
|
|
116
74
|
for (const control of doc.deviceInterface?.controls ?? []) {
|
|
117
75
|
controls.set(control.id, {
|
|
118
76
|
...control,
|
|
119
77
|
provenance: 'vdsp-declared',
|
|
120
78
|
});
|
|
121
79
|
}
|
|
122
|
-
|
|
123
80
|
for (const inferred of inferredControls) {
|
|
124
81
|
const declared = controls.get(inferred.id);
|
|
125
82
|
if (declared === undefined) {
|
|
126
83
|
controls.set(inferred.id, inferred);
|
|
127
84
|
continue;
|
|
128
85
|
}
|
|
129
|
-
|
|
130
86
|
if (declared.binding === undefined && inferred.binding !== undefined) {
|
|
131
87
|
controls.set(declared.id, {
|
|
132
88
|
...declared,
|
|
@@ -134,12 +90,9 @@ export function extractDeviceInterface(doc: CircuitDocument): ExtractedDeviceInt
|
|
|
134
90
|
});
|
|
135
91
|
continue;
|
|
136
92
|
}
|
|
137
|
-
|
|
138
|
-
if (
|
|
139
|
-
declared.binding !== undefined
|
|
93
|
+
if (declared.binding !== undefined
|
|
140
94
|
&& inferred.binding !== undefined
|
|
141
|
-
&& bindingSignature(declared.binding) !== bindingSignature(inferred.binding)
|
|
142
|
-
) {
|
|
95
|
+
&& bindingSignature(declared.binding) !== bindingSignature(inferred.binding)) {
|
|
143
96
|
diagnostics.push({
|
|
144
97
|
code: 'device-interface-inferred-binding-conflict',
|
|
145
98
|
message: `Declared device interface control "${declared.id}" conflicts with inferred binding`,
|
|
@@ -147,7 +100,6 @@ export function extractDeviceInterface(doc: CircuitDocument): ExtractedDeviceInt
|
|
|
147
100
|
});
|
|
148
101
|
}
|
|
149
102
|
}
|
|
150
|
-
|
|
151
103
|
return {
|
|
152
104
|
groups: doc.controlGroups ?? [],
|
|
153
105
|
contexts: doc.controlContexts ?? [],
|
|
@@ -156,20 +108,15 @@ export function extractDeviceInterface(doc: CircuitDocument): ExtractedDeviceInt
|
|
|
156
108
|
diagnostics,
|
|
157
109
|
};
|
|
158
110
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
panel: Panel,
|
|
163
|
-
): readonly ExtractedDeviceInterfaceControl[] {
|
|
164
|
-
const controls: ExtractedDeviceInterfaceControl[] = [];
|
|
165
|
-
const controlInterfaceIds = new Set<string>();
|
|
111
|
+
function inferDeviceInterfaceControls(doc, panel) {
|
|
112
|
+
const controls = [];
|
|
113
|
+
const controlInterfaceIds = new Set();
|
|
166
114
|
for (const controlInterface of doc.controlInterfaces ?? []) {
|
|
167
115
|
controlInterfaceIds.add(controlInterface.id);
|
|
168
116
|
if (controlInterface.componentId !== undefined) {
|
|
169
117
|
controlInterfaceIds.add(controlInterface.componentId);
|
|
170
118
|
}
|
|
171
119
|
}
|
|
172
|
-
|
|
173
120
|
for (const knob of panel.knobs) {
|
|
174
121
|
const componentId = componentIdFromControlId(knob.id);
|
|
175
122
|
const property = runtimeControlProperty(knob.id);
|
|
@@ -187,7 +134,6 @@ function inferDeviceInterfaceControls(
|
|
|
187
134
|
provenance: provenanceForComponentControl(doc, componentId),
|
|
188
135
|
});
|
|
189
136
|
}
|
|
190
|
-
|
|
191
137
|
for (const slider of panel.sliders ?? []) {
|
|
192
138
|
controls.push({
|
|
193
139
|
id: slider.id,
|
|
@@ -202,7 +148,6 @@ function inferDeviceInterfaceControls(
|
|
|
202
148
|
provenance: 'source-inferred',
|
|
203
149
|
});
|
|
204
150
|
}
|
|
205
|
-
|
|
206
151
|
for (const switchControl of panel.switches) {
|
|
207
152
|
controls.push({
|
|
208
153
|
id: switchControl.id,
|
|
@@ -217,7 +162,6 @@ function inferDeviceInterfaceControls(
|
|
|
217
162
|
provenance: provenanceForComponentControl(doc, componentIdFromControlId(switchControl.id)),
|
|
218
163
|
});
|
|
219
164
|
}
|
|
220
|
-
|
|
221
165
|
for (const led of panel.leds) {
|
|
222
166
|
controls.push({
|
|
223
167
|
id: led.id,
|
|
@@ -232,7 +176,6 @@ function inferDeviceInterfaceControls(
|
|
|
232
176
|
provenance: 'source-inferred',
|
|
233
177
|
});
|
|
234
178
|
}
|
|
235
|
-
|
|
236
179
|
for (const jack of panel.jacks) {
|
|
237
180
|
const componentId = jack.sourceComponentId ?? componentIdFromControlId(jack.id);
|
|
238
181
|
const binding = deviceBindingForJack(jack, componentId);
|
|
@@ -247,11 +190,9 @@ function inferDeviceInterfaceControls(
|
|
|
247
190
|
: provenanceForComponentControl(doc, componentId),
|
|
248
191
|
});
|
|
249
192
|
}
|
|
250
|
-
|
|
251
193
|
return controls;
|
|
252
194
|
}
|
|
253
|
-
|
|
254
|
-
function deviceBindingForJack(jack: JackPort, componentId: string): DeviceInterfaceBinding | undefined {
|
|
195
|
+
function deviceBindingForJack(jack, componentId) {
|
|
255
196
|
if (jack.binding !== undefined) {
|
|
256
197
|
return deviceBindingFromControlInterfaceBinding(jack.binding, componentId);
|
|
257
198
|
}
|
|
@@ -272,11 +213,7 @@ function deviceBindingForJack(jack: JackPort, componentId: string): DeviceInterf
|
|
|
272
213
|
}
|
|
273
214
|
return undefined;
|
|
274
215
|
}
|
|
275
|
-
|
|
276
|
-
function deviceBindingFromControlInterfaceBinding(
|
|
277
|
-
binding: ControlInterface['binding'],
|
|
278
|
-
fallbackComponentId: string,
|
|
279
|
-
): DeviceInterfaceBinding | undefined {
|
|
216
|
+
function deviceBindingFromControlInterfaceBinding(binding, fallbackComponentId) {
|
|
280
217
|
if (binding === undefined) {
|
|
281
218
|
return undefined;
|
|
282
219
|
}
|
|
@@ -288,26 +225,22 @@ function deviceBindingFromControlInterfaceBinding(
|
|
|
288
225
|
...(binding.property === undefined ? {} : { property: binding.property }),
|
|
289
226
|
};
|
|
290
227
|
}
|
|
291
|
-
|
|
292
|
-
function provenanceForComponentControl(doc: CircuitDocument, componentId: string): DeviceInterfaceProvenance {
|
|
228
|
+
function provenanceForComponentControl(doc, componentId) {
|
|
293
229
|
const component = doc.components.find((candidate) => candidate.id === componentId);
|
|
294
230
|
return component !== undefined && isRuntimeDescriptor(component)
|
|
295
231
|
? 'runtime-descriptor-inferred'
|
|
296
232
|
: 'source-inferred';
|
|
297
233
|
}
|
|
298
|
-
|
|
299
|
-
function componentIdFromControlId(id: string): string {
|
|
234
|
+
function componentIdFromControlId(id) {
|
|
300
235
|
const separator = id.indexOf(':');
|
|
301
236
|
return separator <= 0 ? id : id.slice(0, separator);
|
|
302
237
|
}
|
|
303
|
-
|
|
304
|
-
function roleFromControlId(id: string): string {
|
|
238
|
+
function roleFromControlId(id) {
|
|
305
239
|
const separator = id.indexOf(':');
|
|
306
240
|
const raw = separator >= 0 ? id.slice(separator + 1) : id;
|
|
307
241
|
return normalizeToken(raw);
|
|
308
242
|
}
|
|
309
|
-
|
|
310
|
-
function runtimeControlProperty(id: string): string | undefined {
|
|
243
|
+
function runtimeControlProperty(id) {
|
|
311
244
|
const key = roleFromControlId(id);
|
|
312
245
|
for (const spec of RUNTIME_CONTINUOUS_CONTROL_SPECS) {
|
|
313
246
|
if (spec.key === key) {
|
|
@@ -325,8 +258,7 @@ function runtimeControlProperty(id: string): string | undefined {
|
|
|
325
258
|
}
|
|
326
259
|
return undefined;
|
|
327
260
|
}
|
|
328
|
-
|
|
329
|
-
function bindingSignature(binding: DeviceInterfaceBinding): string {
|
|
261
|
+
function bindingSignature(binding) {
|
|
330
262
|
return [
|
|
331
263
|
binding.componentId,
|
|
332
264
|
binding.controlId ?? '',
|
|
@@ -335,11 +267,7 @@ function bindingSignature(binding: DeviceInterfaceBinding): string {
|
|
|
335
267
|
binding.externalInterfaceId ?? '',
|
|
336
268
|
].join(':');
|
|
337
269
|
}
|
|
338
|
-
|
|
339
|
-
function applyControlInterfaces(
|
|
340
|
-
controlInterfaces: readonly ControlInterface[] | undefined,
|
|
341
|
-
jacks: JackPort[],
|
|
342
|
-
): void {
|
|
270
|
+
function applyControlInterfaces(controlInterfaces, jacks) {
|
|
343
271
|
for (const controlInterface of controlInterfaces ?? []) {
|
|
344
272
|
const port = toControlInterfaceJack(controlInterface);
|
|
345
273
|
const existingIndex = controlInterface.componentId === undefined
|
|
@@ -350,13 +278,13 @@ function applyControlInterfaces(
|
|
|
350
278
|
if (existing !== undefined) {
|
|
351
279
|
jacks[existingIndex] = { ...existing, ...port };
|
|
352
280
|
}
|
|
353
|
-
}
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
354
283
|
jacks.push(port);
|
|
355
284
|
}
|
|
356
285
|
}
|
|
357
286
|
}
|
|
358
|
-
|
|
359
|
-
function toControlInterfaceJack(controlInterface: ControlInterface): JackPort {
|
|
287
|
+
function toControlInterfaceJack(controlInterface) {
|
|
360
288
|
const sourceComponentId = controlInterface.binding?.sourceComponentId;
|
|
361
289
|
const controlRole = controlInterface.controlRole ?? defaultControlRole(controlInterface);
|
|
362
290
|
const interfaceName = controlInterface.interface ?? defaultInterfaceName(controlInterface);
|
|
@@ -374,8 +302,7 @@ function toControlInterfaceJack(controlInterface: ControlInterface): JackPort {
|
|
|
374
302
|
...(controlInterface.description === undefined ? {} : { description: controlInterface.description }),
|
|
375
303
|
};
|
|
376
304
|
}
|
|
377
|
-
|
|
378
|
-
function jackRoleForControlInterface(controlInterface: ControlInterface): JackRole {
|
|
305
|
+
function jackRoleForControlInterface(controlInterface) {
|
|
379
306
|
switch (controlInterface.role) {
|
|
380
307
|
case 'tempo-tap':
|
|
381
308
|
return 'tempo-tap';
|
|
@@ -390,14 +317,12 @@ function jackRoleForControlInterface(controlInterface: ControlInterface): JackRo
|
|
|
390
317
|
return 'unknown';
|
|
391
318
|
}
|
|
392
319
|
}
|
|
393
|
-
|
|
394
|
-
function defaultControlRole(controlInterface: ControlInterface): string | undefined {
|
|
320
|
+
function defaultControlRole(controlInterface) {
|
|
395
321
|
return controlInterface.role === 'unknown' || controlInterface.role === 'external-control'
|
|
396
322
|
? undefined
|
|
397
323
|
: controlInterface.role;
|
|
398
324
|
}
|
|
399
|
-
|
|
400
|
-
function defaultInterfaceName(controlInterface: ControlInterface): string | undefined {
|
|
325
|
+
function defaultInterfaceName(controlInterface) {
|
|
401
326
|
if (controlInterface.role === 'tempo-tap') {
|
|
402
327
|
return 'tap-tempo';
|
|
403
328
|
}
|
|
@@ -406,8 +331,7 @@ function defaultInterfaceName(controlInterface: ControlInterface): string | unde
|
|
|
406
331
|
}
|
|
407
332
|
return 'external-control-input';
|
|
408
333
|
}
|
|
409
|
-
|
|
410
|
-
function toKnob(component: Component): Knob {
|
|
334
|
+
function toKnob(component) {
|
|
411
335
|
const taper = resolveTaper(propertyString(component, 'Sweep') ?? propertyString(component, 'Taper'));
|
|
412
336
|
const stepLabels = parseStepLabels(propertyStringAny(component, ['StepLabels', 'Steps']));
|
|
413
337
|
const explicitStepCount = parseStepCount(propertyStringAny(component, ['StepCount', 'Detents', 'Positions', 'Steps']));
|
|
@@ -429,8 +353,7 @@ function toKnob(component: Component): Knob {
|
|
|
429
353
|
...(description !== undefined && description.length > 0 ? { description } : {}),
|
|
430
354
|
};
|
|
431
355
|
}
|
|
432
|
-
|
|
433
|
-
function toSlider(component: Component): SliderControl {
|
|
356
|
+
function toSlider(component) {
|
|
434
357
|
const defaultPosition = clamp01(parseNumeric(component.properties.Wipe) ?? 0.5);
|
|
435
358
|
const orientation = resolveSliderOrientation(propertyStringAny(component, ['Orientation', 'SliderOrientation']));
|
|
436
359
|
const range = sliderRange(component);
|
|
@@ -446,8 +369,7 @@ function toSlider(component: Component): SliderControl {
|
|
|
446
369
|
...(description !== undefined && description.length > 0 ? { description } : {}),
|
|
447
370
|
};
|
|
448
371
|
}
|
|
449
|
-
|
|
450
|
-
function toSwitch(component: Component): SwitchControl {
|
|
372
|
+
function toSwitch(component) {
|
|
451
373
|
const switchKind = resolveSwitchKind(component);
|
|
452
374
|
const { poles, positions } = switchGeometry(switchKind);
|
|
453
375
|
const defaultPosition = clampInt(parseNumeric(component.properties.Position) ?? 0, 0, positions - 1);
|
|
@@ -466,8 +388,7 @@ function toSwitch(component: Component): SwitchControl {
|
|
|
466
388
|
...(description !== undefined && description.length > 0 ? { description } : {}),
|
|
467
389
|
};
|
|
468
390
|
}
|
|
469
|
-
|
|
470
|
-
function toLed(component: Component): LedIndicator {
|
|
391
|
+
function toLed(component) {
|
|
471
392
|
const color = propertyString(component, 'Color') ?? inferLedColor(component);
|
|
472
393
|
const partNumber = propertyString(component, 'PartNumber') ?? undefined;
|
|
473
394
|
const description = propertyString(component, 'Description') ?? undefined;
|
|
@@ -479,11 +400,10 @@ function toLed(component: Component): LedIndicator {
|
|
|
479
400
|
...(description !== undefined && description.length > 0 ? { description } : {}),
|
|
480
401
|
};
|
|
481
402
|
}
|
|
482
|
-
|
|
483
|
-
function toJack(component: Component): JackPort {
|
|
403
|
+
function toJack(component) {
|
|
484
404
|
const role = resolveJackRole(component);
|
|
485
405
|
const name = nonEmptyString(propertyStringAny(component, ['JackLabel', 'Label'])) ?? component.name;
|
|
486
|
-
const audioRole = nonEmptyString(propertyString(component, 'AudioRole'))
|
|
406
|
+
const audioRole = nonEmptyString(propertyString(component, 'AudioRole'));
|
|
487
407
|
const impedance = quantityProperty(component, 'Impedance');
|
|
488
408
|
const controlRole = nonEmptyString(propertyString(component, 'ControlRole'));
|
|
489
409
|
const interfaceName = nonEmptyString(propertyString(component, 'Interface'));
|
|
@@ -501,16 +421,13 @@ function toJack(component: Component): JackPort {
|
|
|
501
421
|
...(description !== undefined && description.length > 0 ? { description } : {}),
|
|
502
422
|
};
|
|
503
423
|
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
const knobs: Knob[] = [];
|
|
507
|
-
|
|
424
|
+
function runtimeDescriptorKnobs(component) {
|
|
425
|
+
const knobs = [];
|
|
508
426
|
for (const spec of RUNTIME_CONTINUOUS_CONTROL_SPECS) {
|
|
509
427
|
const name = nonEmptyString(propertyString(component, spec.controlProperty));
|
|
510
428
|
if (name === undefined) {
|
|
511
429
|
continue;
|
|
512
430
|
}
|
|
513
|
-
|
|
514
431
|
knobs.push({
|
|
515
432
|
id: `${component.id}:${spec.key}`,
|
|
516
433
|
name,
|
|
@@ -519,16 +436,13 @@ function runtimeDescriptorKnobs(component: Component): readonly Knob[] {
|
|
|
519
436
|
defaultPosition: clamp01(parseNumeric(component.properties[spec.wipeProperty]) ?? 0.5),
|
|
520
437
|
});
|
|
521
438
|
}
|
|
522
|
-
|
|
523
439
|
const mode = runtimeDescriptorMode(component);
|
|
524
440
|
if (mode !== undefined) {
|
|
525
441
|
knobs.push(mode);
|
|
526
442
|
}
|
|
527
|
-
|
|
528
443
|
return knobs;
|
|
529
444
|
}
|
|
530
|
-
|
|
531
|
-
function runtimeDescriptorMode(component: Component): Knob | undefined {
|
|
445
|
+
function runtimeDescriptorMode(component) {
|
|
532
446
|
const name = nonEmptyString(propertyString(component, 'ModeControl'));
|
|
533
447
|
const labels = parseStepLabels(propertyStringAny(component, ['ModeLabels', 'ModeOptions']));
|
|
534
448
|
const explicitStepCount = parseStepCount(propertyStringAny(component, ['ModeStepCount', 'ModeSteps', 'ModeCount']));
|
|
@@ -536,28 +450,22 @@ function runtimeDescriptorMode(component: Component): Knob | undefined {
|
|
|
536
450
|
if (name === undefined || steps === undefined) {
|
|
537
451
|
return undefined;
|
|
538
452
|
}
|
|
539
|
-
|
|
540
453
|
return {
|
|
541
454
|
id: `${component.id}:mode`,
|
|
542
455
|
name,
|
|
543
456
|
taper: 'unknown',
|
|
544
457
|
controlMode: 'stepped',
|
|
545
|
-
defaultPosition: runtimeModeDefaultPosition(
|
|
546
|
-
steps,
|
|
547
|
-
parseNumericAny(component, ['ModeControlWipe', 'ModeDefaultIndex', 'ModeIndex']),
|
|
548
|
-
),
|
|
458
|
+
defaultPosition: runtimeModeDefaultPosition(steps, parseNumericAny(component, ['ModeControlWipe', 'ModeDefaultIndex', 'ModeIndex'])),
|
|
549
459
|
steps,
|
|
550
460
|
};
|
|
551
461
|
}
|
|
552
|
-
|
|
553
|
-
function runtimeDescriptorTempoTap(component: Component): JackPort | undefined {
|
|
462
|
+
function runtimeDescriptorTempoTap(component) {
|
|
554
463
|
const name = nonEmptyString(propertyStringAny(component, ['TempoTapControl', 'TapTempoControl', 'TempoControl']));
|
|
555
464
|
if (name === undefined) {
|
|
556
465
|
return undefined;
|
|
557
466
|
}
|
|
558
|
-
|
|
559
467
|
const sourceTypeName = component.sourceTypeName ?? undefined;
|
|
560
|
-
const assignmentHint
|
|
468
|
+
const assignmentHint = 'momentary';
|
|
561
469
|
return {
|
|
562
470
|
id: `${component.id}:tempo-tap`,
|
|
563
471
|
name,
|
|
@@ -569,8 +477,7 @@ function runtimeDescriptorTempoTap(component: Component): JackPort | undefined {
|
|
|
569
477
|
...(sourceTypeName !== undefined ? { sourceTypeName } : {}),
|
|
570
478
|
};
|
|
571
479
|
}
|
|
572
|
-
|
|
573
|
-
function runtimeDescriptorDirectOut(component: Component): JackPort | undefined {
|
|
480
|
+
function runtimeDescriptorDirectOut(component) {
|
|
574
481
|
const name = nonEmptyString(propertyStringAny(component, [
|
|
575
482
|
'DirectOutputJack',
|
|
576
483
|
'DirectOutJack',
|
|
@@ -580,7 +487,6 @@ function runtimeDescriptorDirectOut(component: Component): JackPort | undefined
|
|
|
580
487
|
if (name === undefined) {
|
|
581
488
|
return undefined;
|
|
582
489
|
}
|
|
583
|
-
|
|
584
490
|
const sourceTypeName = component.sourceTypeName ?? undefined;
|
|
585
491
|
const description = nonEmptyString(propertyStringAny(component, [
|
|
586
492
|
'DirectOutputRuntimeBoundary',
|
|
@@ -605,8 +511,7 @@ function runtimeDescriptorDirectOut(component: Component): JackPort | undefined
|
|
|
605
511
|
...(description === undefined ? {} : { description }),
|
|
606
512
|
};
|
|
607
513
|
}
|
|
608
|
-
|
|
609
|
-
function isSliderControl(component: Component): boolean {
|
|
514
|
+
function isSliderControl(component) {
|
|
610
515
|
const style = propertyStringAny(component, ['ControlStyle', 'ControlType', 'PanelControl', 'UiControl', 'Style']);
|
|
611
516
|
if (style === null) {
|
|
612
517
|
return false;
|
|
@@ -614,15 +519,13 @@ function isSliderControl(component: Component): boolean {
|
|
|
614
519
|
const lower = style.toLowerCase();
|
|
615
520
|
return lower.includes('slider') || lower.includes('fader');
|
|
616
521
|
}
|
|
617
|
-
|
|
618
|
-
function resolveSliderOrientation(value: string | null): SliderOrientation {
|
|
522
|
+
function resolveSliderOrientation(value) {
|
|
619
523
|
if (value?.toLowerCase().includes('horizontal')) {
|
|
620
524
|
return 'horizontal';
|
|
621
525
|
}
|
|
622
526
|
return 'vertical';
|
|
623
527
|
}
|
|
624
|
-
|
|
625
|
-
function sliderRange(component: Component): SliderRange | undefined {
|
|
528
|
+
function sliderRange(component) {
|
|
626
529
|
const min = parseNumericAny(component, ['RangeMin', 'Min', 'Minimum']);
|
|
627
530
|
const max = parseNumericAny(component, ['RangeMax', 'Max', 'Maximum']);
|
|
628
531
|
if (min === undefined || max === undefined || min >= max) {
|
|
@@ -637,8 +540,7 @@ function sliderRange(component: Component): SliderRange | undefined {
|
|
|
637
540
|
...(center !== undefined ? { center } : {}),
|
|
638
541
|
};
|
|
639
542
|
}
|
|
640
|
-
|
|
641
|
-
function resolveTaper(value: string | null | undefined): KnobTaper {
|
|
543
|
+
function resolveTaper(value) {
|
|
642
544
|
if (value === null || value === undefined) {
|
|
643
545
|
return 'unknown';
|
|
644
546
|
}
|
|
@@ -654,31 +556,38 @@ function resolveTaper(value: string | null | undefined): KnobTaper {
|
|
|
654
556
|
}
|
|
655
557
|
return 'unknown';
|
|
656
558
|
}
|
|
657
|
-
|
|
658
|
-
function resolveSwitchKind(component: Component): SwitchKind {
|
|
559
|
+
function resolveSwitchKind(component) {
|
|
659
560
|
const short = shortType(component.sourceTypeName);
|
|
660
561
|
if (short === null) {
|
|
661
562
|
return inferFromTerminals(component.terminals.length);
|
|
662
563
|
}
|
|
663
564
|
const upper = short.toUpperCase();
|
|
664
|
-
if (upper === 'SPDT')
|
|
665
|
-
|
|
666
|
-
if (upper === '
|
|
667
|
-
|
|
668
|
-
if (upper === '
|
|
669
|
-
|
|
670
|
-
if (upper === '
|
|
565
|
+
if (upper === 'SPDT')
|
|
566
|
+
return 'spdt';
|
|
567
|
+
if (upper === 'SP3T')
|
|
568
|
+
return 'sp3t';
|
|
569
|
+
if (upper === 'SP4T')
|
|
570
|
+
return 'sp4t';
|
|
571
|
+
if (upper === '3PDT')
|
|
572
|
+
return '3pdt';
|
|
573
|
+
if (upper === 'TOGGLE')
|
|
574
|
+
return 'toggle';
|
|
575
|
+
if (upper === 'ROTARY')
|
|
576
|
+
return 'rotary';
|
|
577
|
+
if (upper === 'SWITCH')
|
|
578
|
+
return 'spst';
|
|
671
579
|
return inferFromTerminals(component.terminals.length);
|
|
672
580
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
if (count === 3)
|
|
677
|
-
|
|
581
|
+
function inferFromTerminals(count) {
|
|
582
|
+
if (count <= 2)
|
|
583
|
+
return 'spst';
|
|
584
|
+
if (count === 3)
|
|
585
|
+
return 'spdt';
|
|
586
|
+
if (count === 9)
|
|
587
|
+
return '3pdt';
|
|
678
588
|
return 'unknown';
|
|
679
589
|
}
|
|
680
|
-
|
|
681
|
-
function switchGeometry(kind: SwitchKind): { poles: number; positions: number } {
|
|
590
|
+
function switchGeometry(kind) {
|
|
682
591
|
switch (kind) {
|
|
683
592
|
case 'spst':
|
|
684
593
|
case 'toggle':
|
|
@@ -697,28 +606,30 @@ function switchGeometry(kind: SwitchKind): { poles: number; positions: number }
|
|
|
697
606
|
return { poles: 1, positions: 2 };
|
|
698
607
|
}
|
|
699
608
|
}
|
|
700
|
-
|
|
701
|
-
function resolveJackRole(component: Component): JackRole {
|
|
609
|
+
function resolveJackRole(component) {
|
|
702
610
|
const semanticRole = resolveSemanticJackRole(component);
|
|
703
611
|
if (semanticRole !== null) {
|
|
704
612
|
return semanticRole;
|
|
705
613
|
}
|
|
706
|
-
|
|
707
614
|
const short = shortType(component.sourceTypeName);
|
|
708
615
|
if (short === null) {
|
|
709
616
|
return 'unknown';
|
|
710
617
|
}
|
|
711
618
|
const upper = short.toUpperCase();
|
|
712
|
-
if (upper === 'INPUT' || upper === 'INPUTJACK')
|
|
713
|
-
|
|
714
|
-
if (upper === '
|
|
715
|
-
|
|
716
|
-
if (upper === '
|
|
619
|
+
if (upper === 'INPUT' || upper === 'INPUTJACK')
|
|
620
|
+
return 'input';
|
|
621
|
+
if (upper === 'SPEAKER' || upper === 'OUTPUTJACK')
|
|
622
|
+
return 'output';
|
|
623
|
+
if (upper === 'SEND')
|
|
624
|
+
return 'send';
|
|
625
|
+
if (upper === 'RETURN')
|
|
626
|
+
return 'return';
|
|
627
|
+
if (upper === 'EXPRESSION' || upper === 'EXP')
|
|
628
|
+
return 'expression';
|
|
717
629
|
return 'unknown';
|
|
718
630
|
}
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
const semanticProperties = ['Role', 'ControlRole', 'Interface'] as const;
|
|
631
|
+
function resolveSemanticJackRole(component) {
|
|
632
|
+
const semanticProperties = ['Role', 'ControlRole', 'Interface'];
|
|
722
633
|
for (const name of semanticProperties) {
|
|
723
634
|
const value = propertyString(component, name);
|
|
724
635
|
if (value === null) {
|
|
@@ -731,45 +642,53 @@ function resolveSemanticJackRole(component: Component): JackRole | null {
|
|
|
731
642
|
}
|
|
732
643
|
return null;
|
|
733
644
|
}
|
|
734
|
-
|
|
735
|
-
function normalizeJackRole(value: string): JackRole | null {
|
|
645
|
+
function normalizeJackRole(value) {
|
|
736
646
|
const normalized = normalizeToken(value);
|
|
737
|
-
if (['input', 'audio-input', 'in'].includes(normalized))
|
|
738
|
-
|
|
739
|
-
if (['output', '
|
|
740
|
-
|
|
741
|
-
if (
|
|
742
|
-
|
|
743
|
-
if (
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
647
|
+
if (['input', 'audio-input', 'in'].includes(normalized))
|
|
648
|
+
return 'input';
|
|
649
|
+
if (['direct-output', 'direct-out', 'dry-output', 'dry-out'].includes(normalized))
|
|
650
|
+
return 'direct-output';
|
|
651
|
+
if (['output', 'audio-output', 'out'].includes(normalized))
|
|
652
|
+
return 'output';
|
|
653
|
+
if (normalized === 'send')
|
|
654
|
+
return 'send';
|
|
655
|
+
if (normalized === 'return')
|
|
656
|
+
return 'return';
|
|
657
|
+
if (['expression', 'exp', 'expression-pedal'].includes(normalized))
|
|
658
|
+
return 'expression';
|
|
659
|
+
if (['tempo-tap', 'tap-tempo', 'tempo-in', 'tap', 'tempo'].includes(normalized))
|
|
660
|
+
return 'tempo-tap';
|
|
661
|
+
if ([
|
|
662
|
+
'external-control',
|
|
663
|
+
'external-control-input',
|
|
664
|
+
'control-input',
|
|
665
|
+
'remote',
|
|
666
|
+
'footswitch',
|
|
667
|
+
'trigger',
|
|
668
|
+
'reset',
|
|
669
|
+
].includes(normalized)) {
|
|
755
670
|
return 'external-control';
|
|
756
671
|
}
|
|
757
672
|
return null;
|
|
758
673
|
}
|
|
759
|
-
|
|
760
|
-
function inferLedColor(component: Component): string | undefined {
|
|
674
|
+
function inferLedColor(component) {
|
|
761
675
|
// Common pedal LED colors are usually red / amber / green. Try the part number.
|
|
762
676
|
const part = propertyString(component, 'PartNumber')?.toLowerCase() ?? '';
|
|
763
|
-
if (part.includes('red'))
|
|
764
|
-
|
|
765
|
-
if (part.includes('
|
|
766
|
-
|
|
767
|
-
if (part.includes('
|
|
768
|
-
|
|
677
|
+
if (part.includes('red'))
|
|
678
|
+
return 'red';
|
|
679
|
+
if (part.includes('green'))
|
|
680
|
+
return 'green';
|
|
681
|
+
if (part.includes('amber'))
|
|
682
|
+
return 'amber';
|
|
683
|
+
if (part.includes('blue'))
|
|
684
|
+
return 'blue';
|
|
685
|
+
if (part.includes('yellow'))
|
|
686
|
+
return 'yellow';
|
|
687
|
+
if (part.includes('white'))
|
|
688
|
+
return 'white';
|
|
769
689
|
return undefined;
|
|
770
690
|
}
|
|
771
|
-
|
|
772
|
-
function shortType(sourceTypeName: string | null): string | null {
|
|
691
|
+
function shortType(sourceTypeName) {
|
|
773
692
|
if (sourceTypeName === null) {
|
|
774
693
|
return null;
|
|
775
694
|
}
|
|
@@ -780,17 +699,14 @@ function shortType(sourceTypeName: string | null): string | null {
|
|
|
780
699
|
const ltspice = sourceTypeName.match(/^ltspice:([A-Za-z0-9_]+)/);
|
|
781
700
|
return ltspice?.[1] ?? null;
|
|
782
701
|
}
|
|
783
|
-
|
|
784
|
-
function propertyString(component: Component, name: string): string | null {
|
|
702
|
+
function propertyString(component, name) {
|
|
785
703
|
return propertyStringValue(component.properties[name]);
|
|
786
704
|
}
|
|
787
|
-
|
|
788
|
-
function nonEmptyString(value: string | null): string | undefined {
|
|
705
|
+
function nonEmptyString(value) {
|
|
789
706
|
const trimmed = value?.trim();
|
|
790
707
|
return trimmed === undefined || trimmed.length === 0 ? undefined : trimmed;
|
|
791
708
|
}
|
|
792
|
-
|
|
793
|
-
function propertyStringAny(component: Component, names: readonly string[]): string | null {
|
|
709
|
+
function propertyStringAny(component, names) {
|
|
794
710
|
for (const name of names) {
|
|
795
711
|
const value = propertyString(component, name);
|
|
796
712
|
if (value !== null) {
|
|
@@ -799,17 +715,14 @@ function propertyStringAny(component: Component, names: readonly string[]): stri
|
|
|
799
715
|
}
|
|
800
716
|
return null;
|
|
801
717
|
}
|
|
802
|
-
|
|
803
|
-
function quantityProperty(component: Component, name: string): ParsedQuantity | undefined {
|
|
718
|
+
function quantityProperty(component, name) {
|
|
804
719
|
const value = component.properties[name];
|
|
805
720
|
return isParsedQuantity(value) ? value : undefined;
|
|
806
721
|
}
|
|
807
|
-
|
|
808
|
-
function parseNumeric(value: PropertyValue | undefined): number | undefined {
|
|
722
|
+
function parseNumeric(value) {
|
|
809
723
|
return propertyNumericValue(value);
|
|
810
724
|
}
|
|
811
|
-
|
|
812
|
-
function parseNumericAny(component: Component, names: readonly string[]): number | undefined {
|
|
725
|
+
function parseNumericAny(component, names) {
|
|
813
726
|
for (const name of names) {
|
|
814
727
|
const value = parseNumeric(component.properties[name]);
|
|
815
728
|
if (value !== undefined) {
|
|
@@ -818,8 +731,7 @@ function parseNumericAny(component: Component, names: readonly string[]): number
|
|
|
818
731
|
}
|
|
819
732
|
return undefined;
|
|
820
733
|
}
|
|
821
|
-
|
|
822
|
-
function parseStepLabels(value: string | null): readonly string[] {
|
|
734
|
+
function parseStepLabels(value) {
|
|
823
735
|
if (value === null) {
|
|
824
736
|
return [];
|
|
825
737
|
}
|
|
@@ -829,8 +741,7 @@ function parseStepLabels(value: string | null): readonly string[] {
|
|
|
829
741
|
.filter((part) => part.length > 0);
|
|
830
742
|
return parts.length >= 2 ? parts : [];
|
|
831
743
|
}
|
|
832
|
-
|
|
833
|
-
function parseStepCount(value: string | null): number | undefined {
|
|
744
|
+
function parseStepCount(value) {
|
|
834
745
|
if (value === null) {
|
|
835
746
|
return undefined;
|
|
836
747
|
}
|
|
@@ -841,8 +752,7 @@ function parseStepCount(value: string | null): number | undefined {
|
|
|
841
752
|
const count = Number(trimmed);
|
|
842
753
|
return Number.isInteger(count) && count >= 2 ? count : undefined;
|
|
843
754
|
}
|
|
844
|
-
|
|
845
|
-
function runtimeModeDefaultPosition(steps: readonly KnobStep[], rawValue: number | undefined): number {
|
|
755
|
+
function runtimeModeDefaultPosition(steps, rawValue) {
|
|
846
756
|
if (steps.length === 0) {
|
|
847
757
|
return 0;
|
|
848
758
|
}
|
|
@@ -855,24 +765,25 @@ function runtimeModeDefaultPosition(steps: readonly KnobStep[], rawValue: number
|
|
|
855
765
|
}
|
|
856
766
|
return snapKnobPosition({ steps }, clamp01(rawValue));
|
|
857
767
|
}
|
|
858
|
-
|
|
859
|
-
function isRuntimeDescriptor(component: Component): boolean {
|
|
768
|
+
function isRuntimeDescriptor(component) {
|
|
860
769
|
return component.kind === 'ic' && component.properties.RuntimeDescriptor === 'true';
|
|
861
770
|
}
|
|
862
|
-
|
|
863
|
-
function normalizeToken(value: string): string {
|
|
771
|
+
function normalizeToken(value) {
|
|
864
772
|
return value.trim().toLowerCase().replace(/[\s_]+/g, '-');
|
|
865
773
|
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
if (v > 1)
|
|
774
|
+
function clamp01(v) {
|
|
775
|
+
if (v < 0)
|
|
776
|
+
return 0;
|
|
777
|
+
if (v > 1)
|
|
778
|
+
return 1;
|
|
870
779
|
return v;
|
|
871
780
|
}
|
|
872
|
-
|
|
873
|
-
function clampInt(v: number, lo: number, hi: number): number {
|
|
781
|
+
function clampInt(v, lo, hi) {
|
|
874
782
|
const n = Math.trunc(v);
|
|
875
|
-
if (n < lo)
|
|
876
|
-
|
|
783
|
+
if (n < lo)
|
|
784
|
+
return lo;
|
|
785
|
+
if (n > hi)
|
|
786
|
+
return hi;
|
|
877
787
|
return n;
|
|
878
788
|
}
|
|
789
|
+
//# sourceMappingURL=extract.js.map
|