@mthines/reaper-mcp 0.80.0-beta.100.1 → 0.80.0
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/README.md +45 -45
- package/bridge-ui/mcp_bridge.html +4 -4
- package/claude/skills/make-plugin/SKILL.md +4 -6
- package/claude/skills/make-plugin/examples/mutate-verb.jsfx +2 -3
- package/claude/skills/make-plugin/examples/tape-sat.jsfx +2 -3
- package/claude/skills/make-plugin/examples/width-bass-mono.jsfx +2 -3
- package/claude/skills/make-plugin/reference/dsp-perf.md +0 -1
- package/claude/skills/make-plugin/reference/toolkit.md +2 -28
- package/main.js +6 -137
- package/package.json +1 -1
- package/reaper/mcp_ui.jsfx-inc +54 -543
- package/claude/skills/make-plugin/examples/multiband-compressor.jsfx +0 -150
- package/claude/skills/make-plugin/examples/multiband-compressor.presets.json +0 -70
|
@@ -13,7 +13,7 @@ argument-hint: '[what the plugin should do | update <plugin>: <what to change>]'
|
|
|
13
13
|
license: MIT
|
|
14
14
|
metadata:
|
|
15
15
|
author: mthines
|
|
16
|
-
version: '1.
|
|
16
|
+
version: '1.2.0'
|
|
17
17
|
workflow_type: applied
|
|
18
18
|
tags: [plugins, jsfx, dsp, ui, reaper, live-verification]
|
|
19
19
|
---
|
|
@@ -78,9 +78,7 @@ In two or three lines, write down and show the user:
|
|
|
78
78
|
|
|
79
79
|
Cut before you add. If a control could be a sensible fixed value, make it one. Pick the closest
|
|
80
80
|
example in `examples/` (`mutate-verb.jsfx` random and granular plus reverb, `tape-sat.jsfx`
|
|
81
|
-
nonlinear plus tilt EQ, `width-bass-mono.jsfx` linear stereo plus meter
|
|
82
|
-
crossover handles in Hz, per-band gain reduction and a transfer curve via `ui_freqgraph`,
|
|
83
|
-
`ui_fhandle`, `ui_grmeter`, `ui_transfer`; `ui_keyboard` shows MIDI notes) and read it. Each has its
|
|
81
|
+
nonlinear plus tilt EQ, `width-bass-mono.jsfx` linear stereo plus meter) and read it. Each has its
|
|
84
82
|
suggested presets beside it (`<name>.presets.json`): the shape `write_jsfx` takes.
|
|
85
83
|
|
|
86
84
|
### Step 2: Write the source
|
|
@@ -90,7 +88,7 @@ example and change what the spec changes. The shape is always:
|
|
|
90
88
|
|
|
91
89
|
- header: `desc:Name`, **unnamed** sliders (`slider1:0.5<0,1,0.01>Label`), then `@init`,
|
|
92
90
|
`@slider`, `@block`, `@sample`, `@gfx W H`.
|
|
93
|
-
- `@init` ends with `ui_boot(animated)` (1 when the UI has a meter
|
|
91
|
+
- `@init` ends with `ui_boot(animated)` (1 when the UI has a meter); allocate buffers from
|
|
94
92
|
`ui_mem`; compute coefficients in `update()`, called from `@init`, `@slider` and
|
|
95
93
|
`@block: ui_changed() ? update();`.
|
|
96
94
|
- `@gfx` draws the core row(s), then `ui_section("Advanced") ? ( ... )` for the rest.
|
|
@@ -198,7 +196,7 @@ Then Steps 4-8.
|
|
|
198
196
|
- `1e9`-style literals make EEL2 reject the whole plugin and run no code. Write `1000000000`.
|
|
199
197
|
- `local()` is only valid inside a function, never at the top of `@sample`/`@block`.
|
|
200
198
|
- Named sliders (`slider1:g=0<...`) do not keep their value in `sliderN`: always unnamed.
|
|
201
|
-
- Memory below `ui_mem` (
|
|
199
|
+
- Memory below `ui_mem` (1024) belongs to the toolkit: allocate from it.
|
|
202
200
|
- `@init` runs again whenever playback starts (and on a sample-rate change). Anything it assigns
|
|
203
201
|
is reset on Play: keep UI and interaction state out of unguarded `@init` assignments.
|
|
204
202
|
- `rand()` cannot be seeded: use the seeded generator in `examples/mutate-verb.jsfx` when a
|
|
@@ -137,10 +137,9 @@ slider10:0.4<0,1,0.01>Damping
|
|
|
137
137
|
spl1 = (dr * (1 - mix) + wr * 3 * mix) * gain;
|
|
138
138
|
|
|
139
139
|
@gfx 380 250
|
|
140
|
-
ui_header(3, 4); // Mix and Output live in the top right
|
|
141
140
|
ui_begin(1, 2) ? (
|
|
142
|
-
ui_row(
|
|
143
|
-
ui_knob(1, "Mutate", 2); ui_knob(2, "Size", 2);
|
|
141
|
+
ui_row(4);
|
|
142
|
+
ui_knob(1, "Mutate", 2); ui_knob(2, "Size", 2); ui_knob(3, "Mix", 2); ui_knob(4, "Output", 1);
|
|
144
143
|
ui_section("Advanced") ? (
|
|
145
144
|
ui_row(3); ui_knob(5, "Seed", 5); ui_knob(6, "Pitch range", 5); ui_knob(7, "Reverse", 2);
|
|
146
145
|
ui_row(3); ui_knob(8, "Bright", 2); ui_knob(9, "Pre-delay", 4); ui_knob(10, "Damping", 2);
|
|
@@ -76,10 +76,9 @@ slider8:0<0,1,1>2x
|
|
|
76
76
|
spl1 = (spl1 * (1 - mix) + yr * mix) * gain;
|
|
77
77
|
|
|
78
78
|
@gfx 340 250
|
|
79
|
-
ui_header(3, 4); // Mix and Output live in the top right
|
|
80
79
|
ui_begin(1, 1) ? (
|
|
81
|
-
ui_row(
|
|
82
|
-
ui_knob(1, "Drive", 1); ui_knob(2, "Tone", 0);
|
|
80
|
+
ui_row(4);
|
|
81
|
+
ui_knob(1, "Drive", 1); ui_knob(2, "Tone", 0); ui_knob(3, "Mix", 2); ui_knob(4, "Output", 1);
|
|
83
82
|
ui_section("Advanced") ? (
|
|
84
83
|
ui_row(4); ui_knob(5, "Bias", 0); ui_knob(6, "Wow", 2); ui_knob(7, "Flutter", 2); ui_toggle(8, "2x");
|
|
85
84
|
);
|
|
@@ -48,10 +48,9 @@ slider6:0<-12,12,0.1>Side
|
|
|
48
48
|
pk = max(pk, max(abs(spl0), abs(spl1)));
|
|
49
49
|
|
|
50
50
|
@gfx 340 250
|
|
51
|
-
ui_header(0, 3); // Output lives in the top right
|
|
52
51
|
ui_begin(1, 1) ? (
|
|
53
|
-
ui_row(
|
|
54
|
-
ui_knob(1, "Width", 2); ui_knob(2, "Mono below", 3); ui_meter(pk, "Out");
|
|
52
|
+
ui_row(4);
|
|
53
|
+
ui_knob(1, "Width", 2); ui_knob(2, "Mono below", 3); ui_knob(3, "Output", 1); ui_meter(pk, "Out");
|
|
55
54
|
pk = 0;
|
|
56
55
|
ui_section("Advanced") ? (
|
|
57
56
|
ui_row(3); ui_choice(4, "Slope"); ui_knob(5, "Mid", 1); ui_knob(6, "Side", 1);
|
|
@@ -13,4 +13,3 @@ The plugin runs in REAPER's audio thread, once per sample. Check every line of `
|
|
|
13
13
|
9. **Smooth with one-pole filters per sample only where a click would be audible** (gain); everything else can change at block rate in `@block`.
|
|
14
14
|
10. **The UI is free.** `@gfx` runs on another thread and redraws only when something changed; do not put DSP in it. Share values with `@sample` only as scalars (a peak kept with `max()`).
|
|
15
15
|
11. **No scientific notation** (`1e-9`): EEL2 drops the whole plugin. Write `0.000000001`.
|
|
16
|
-
12. **Graphs (`ui_freqgraph` and friends): feed the UI cheaply.** `ui_gfeed` wants one FFT every 2048 samples at most (a ring buffer filled in `@sample`, the `fft` run in `@block`, never per sample); `ui_gr` / `ui_glevel` / `ui_kkey` are scalar writes. Use `ui_boot(2)` so silence stops redrawing. The graph widgets never allocate in `@gfx`.
|
|
@@ -36,27 +36,6 @@ Every widget is one block, label above, control, value below, sized the same acr
|
|
|
36
36
|
| `ui_meter(level, "Label")` | vertical peak meter, -60..+6 dB, holds and falls 30 dB/s | none: pass the peak you kept with `max()` in `@sample`, then set it back to 0 |
|
|
37
37
|
| `ui_section("Label")` | the Advanced drawer (bar when closed, panel over the core when open); returns 1 while visible | none |
|
|
38
38
|
|
|
39
|
-
### Graph widgets (toolkit 1.3)
|
|
40
|
-
|
|
41
|
-
| Call | Draws | Feed / slider |
|
|
42
|
-
|---|---|---|
|
|
43
|
-
| `ui_freqgraph("Label")` | log frequency graph, 20 Hz-20 kHz, gridlines and labels, the fed trace, the selected band; a click between handles selects a band | trace: `ui_gfeed(buf, n)` with `n` FFT magnitudes (linear, low to high) from `@block`, or `ui_gset(i, db)` for a curve point (`i` 0..95) |
|
|
44
|
-
| `ui_gshow(on)` / `ui_gfeed2(buf, n)` | before / after: with `ui_gshow(slider)` on, the graph also draws the input as a second, lighter line labelled Input / Output; feed it with `ui_gfeed2` only while shown (a second FFT costs). Put a `ui_toggle` for it in Advanced | a `<0,1,1{Off,On}>` slider |
|
|
45
|
-
| `ui_fhandle(idx, "Label")` | a draggable band edge on the graph, bound to slider `idx` in Hz; drag, wheel, double-click for a value box, modifier-click resets; stays between its neighbours; automates like a knob | a Hz slider, e.g. `<40,800,1>`; call it after `ui_freqgraph`, in left-to-right order |
|
|
46
|
-
| `ui_fthresh(thr_first, ratio_first, gain_first, n)` | a threshold line across each of `n` bands (the handles + 1) on the graph; hover a band and drag up/down to move its threshold, **Shift**-drag its gain, wheel = its ratio, click selects it | `n` threshold sliders from `thr_first` (dB, -60..0), `n` ratio sliders from `ratio_first`, `n` gain sliders from `gain_first`; call it after the handles |
|
|
47
|
-
| `ui_bandknob(first_idx, n, "Label", fmt)` | a knob on the selected band's slider (`first_idx + ui_fsel`), labelled with the band (Low / Mid / High, else Band N) | `n` sliders from `first_idx`; counts as one widget |
|
|
48
|
-
| `ui_grmeter(n, "Label")` | `n` (1-8) gain-reduction bars hanging from the top, amber from 6 dB, red from 12; a click selects the band | `ui_gr(k, db)` per band from `@block` (db 0 or more) |
|
|
49
|
-
| `ui_transfer(thr_idx, ratio_idx, knee_db)` | a compressor transfer curve that follows the threshold and ratio sliders (the selected band's, `thr_idx + ui_fsel`, with a graph), with a live level dot | `ui_glevel(db)` from `@block` |
|
|
50
|
-
| `ui_keyboard(lo, hi, "Label")` | piano keys `lo`..`hi` (MIDI notes), lit while held | `ui_kkey(note, vel)` on note on, `ui_kkey(note, 0)` on note off |
|
|
51
|
-
| `ui_tall(span)` | the next `ui_row` is `span` times as tall (a graph needs height); knobs in it keep their size | none |
|
|
52
|
-
|
|
53
|
-
Use `ui_boot(2)` in a plugin with these feeds: it redraws only when a feed, a control or the window
|
|
54
|
-
changed, so silence costs nothing (`ui_boot(1)` redraws every frame, `ui_boot(0)` only on change).
|
|
55
|
-
Feeds are rounded to a visible step before they count as change. A graph widget counts as one
|
|
56
|
-
widget for the core limit. The selected band is `ui_fsel` (0-based), which the plugin may read.
|
|
57
|
-
Memory map: 0..1023 core, 1024+ graph data (`ui_fg` trace, `ui_ge` band edges, `ui_grm`, `ui_kb`),
|
|
58
|
-
`ui_mem` (2048) is where your buffers start. `examples/multiband-compressor.jsfx` uses them all.
|
|
59
|
-
|
|
60
39
|
`fmt` for knobs: `0` number (`0.00`), `1` dB, `2` percent of 0..1, `3` Hz or kHz, `4` ms, `5` integer.
|
|
61
40
|
|
|
62
41
|
Interaction (all automatic, the FabFilter/Serum convention): drag up/down (200 px = the full
|
|
@@ -72,10 +51,7 @@ when the user turns on the FX window's **+ > Send all keyboard input to plug-in*
|
|
|
72
51
|
the plugin; then it closes the value box, the About dialog, then the drawer (and the window
|
|
73
52
|
closes with its close button, as every key now goes to the plugin).
|
|
74
53
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
Every plugin also gets, with no code of its own: its name in small spaced capitals at the top-left
|
|
78
|
-
(hidden in a very narrow window), and a small "reaper-mcp" credit at the bottom right
|
|
54
|
+
Every plugin also gets, with no code of its own: a small "reaper-mcp" credit at the bottom right
|
|
79
55
|
(in the drawer bar, or the bottom padding when there is no drawer; hidden in a narrow window).
|
|
80
56
|
A click opens the **About** dialog drawn in the plugin: what reaper-mcp is, the repository
|
|
81
57
|
address as plain text (JSFX cannot open a browser or write the clipboard), and this plugin's
|
|
@@ -107,10 +83,8 @@ restores it with the project.
|
|
|
107
83
|
- No `gmem`, no named sliders, no scientific-notation literals, no `slider33` and up.
|
|
108
84
|
- `max()`/`min()` with exactly two arguments; no `local()` at the top of `@sample`/`@block`.
|
|
109
85
|
- A warning when the plugin assigns `ui_adv_open`.
|
|
110
|
-
- `unknown-ui-call` (a `ui_` function the toolkit does not define) and `ui-arity` (wrong argument
|
|
111
|
-
count) are errors: EEL2 would otherwise fail silently.
|
|
112
86
|
|
|
113
87
|
## Memory
|
|
114
88
|
|
|
115
|
-
Memory below `ui_mem` belongs to the toolkit. Allocate your buffers from it (the examples
|
|
89
|
+
Memory below `ui_mem` (1024) belongs to the toolkit. Allocate your buffers from it (the examples
|
|
116
90
|
use a tiny `alloc(n)`).
|
package/main.js
CHANGED
|
@@ -173,7 +173,6 @@ var ALLOWED_SPAN_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
173
173
|
"reaper.jsfx.sliders",
|
|
174
174
|
"reaper.jsfx.widgets.core",
|
|
175
175
|
"reaper.jsfx.widgets.advanced",
|
|
176
|
-
"reaper.jsfx.graphs",
|
|
177
176
|
"reaper.jsfx.size",
|
|
178
177
|
"reaper.jsfx.version",
|
|
179
178
|
"reaper.jsfx.toolkit_version",
|
|
@@ -8719,72 +8718,6 @@ function readVersion(generated) {
|
|
|
8719
8718
|
|
|
8720
8719
|
// apps/reaper-mcp-server/src/jsfx/lint.ts
|
|
8721
8720
|
var MAX_CHOICE_OPTIONS = 8;
|
|
8722
|
-
var UI_API = {
|
|
8723
|
-
ui_meta: 5,
|
|
8724
|
-
ui_boot: 1,
|
|
8725
|
-
ui_changed: 0,
|
|
8726
|
-
ui_c: 2,
|
|
8727
|
-
ui_mixc: 3,
|
|
8728
|
-
ui_theme: 1,
|
|
8729
|
-
ui_cm: 3,
|
|
8730
|
-
ui_q: 2,
|
|
8731
|
-
ui_set: 2,
|
|
8732
|
-
ui_rrect: 5,
|
|
8733
|
-
ui_ring: 6,
|
|
8734
|
-
ui_caps: 1,
|
|
8735
|
-
ui_ctext: 4,
|
|
8736
|
-
ui_chev: 3,
|
|
8737
|
-
ui_bgbuild: 0,
|
|
8738
|
-
ui_bg: 0,
|
|
8739
|
-
ui_fmted: 2,
|
|
8740
|
-
ui_edopen: 5,
|
|
8741
|
-
ui_edcommit: 0,
|
|
8742
|
-
ui_edkey: 1,
|
|
8743
|
-
ui_keys: 0,
|
|
8744
|
-
ui_namedraw: 0,
|
|
8745
|
-
ui_begin: 2,
|
|
8746
|
-
ui_footer: 2,
|
|
8747
|
-
ui_float: 4,
|
|
8748
|
-
ui_popover: 0,
|
|
8749
|
-
ui_arow: 5,
|
|
8750
|
-
ui_aboutdraw: 0,
|
|
8751
|
-
ui_end: 0,
|
|
8752
|
-
ui_tall: 1,
|
|
8753
|
-
ui_row: 1,
|
|
8754
|
-
ui_cell: 0,
|
|
8755
|
-
ui_label: 2,
|
|
8756
|
-
ui_value: 1,
|
|
8757
|
-
ui_fmtv: 2,
|
|
8758
|
-
ui_reset: 1,
|
|
8759
|
-
ui_ctl: 5,
|
|
8760
|
-
ui_knob: 3,
|
|
8761
|
-
ui_toggle: 2,
|
|
8762
|
-
ui_choice: 2,
|
|
8763
|
-
ui_meter: 2,
|
|
8764
|
-
ui_section: 1,
|
|
8765
|
-
ui_gput: 2,
|
|
8766
|
-
ui_gset: 2,
|
|
8767
|
-
ui_gfeed: 2,
|
|
8768
|
-
ui_gr: 2,
|
|
8769
|
-
ui_glevel: 1,
|
|
8770
|
-
ui_kkey: 2,
|
|
8771
|
-
ui_fxof: 1,
|
|
8772
|
-
ui_fof: 1,
|
|
8773
|
-
ui_gyof: 1,
|
|
8774
|
-
ui_freqgraph: 1,
|
|
8775
|
-
ui_fpill: 2,
|
|
8776
|
-
ui_fhandle: 2,
|
|
8777
|
-
ui_grmeter: 2,
|
|
8778
|
-
ui_tcurve: 4,
|
|
8779
|
-
ui_transfer: 3,
|
|
8780
|
-
ui_keyboard: 3,
|
|
8781
|
-
ui_fthresh: 4,
|
|
8782
|
-
ui_header: 2,
|
|
8783
|
-
ui_hknob: 4,
|
|
8784
|
-
ui_gfeed2: 2,
|
|
8785
|
-
ui_gshow: 1,
|
|
8786
|
-
ui_bandknob: 4
|
|
8787
|
-
};
|
|
8788
8721
|
var MAX_CORE_WIDGETS = 5;
|
|
8789
8722
|
var MAX_ADVANCED_WIDGETS = 8;
|
|
8790
8723
|
var MAX_FILE_BYTES = 64 * 1024;
|
|
@@ -8823,43 +8756,9 @@ function sections2(code) {
|
|
|
8823
8756
|
out2.set(name, { text: buf.join("\n"), line });
|
|
8824
8757
|
return out2;
|
|
8825
8758
|
}
|
|
8826
|
-
var WIDGET = /\bui_(knob|toggle|choice
|
|
8827
|
-
var
|
|
8828
|
-
var
|
|
8829
|
-
var HEADER = /\bui_header\s*\(\s*(\d+)\s*,\s*(\d+)/g;
|
|
8830
|
-
var TRANSFER = /\bui_transfer\s*\(\s*(\d+)\s*,\s*(\d+)/g;
|
|
8831
|
-
var COUNTED = /\bui_(knob|toggle|choice|meter|freqgraph|grmeter|transfer|keyboard|bandknob)\s*\(/g;
|
|
8832
|
-
var GRAPHS = /\bui_(freqgraph|grmeter|transfer|keyboard)\s*\(/g;
|
|
8833
|
-
var countWidgets = (t) => [...t.matchAll(COUNTED)].length;
|
|
8834
|
-
function uiCalls(code) {
|
|
8835
|
-
const out2 = [];
|
|
8836
|
-
for (const m of code.matchAll(/\b(ui_\w+)\s*\(/g)) {
|
|
8837
|
-
const at = m.index ?? 0;
|
|
8838
|
-
if (/\bfunction\s+$/.test(code.slice(Math.max(0, at - 12), at))) continue;
|
|
8839
|
-
let depth = 1;
|
|
8840
|
-
let args = 0;
|
|
8841
|
-
let any = false;
|
|
8842
|
-
let inString = false;
|
|
8843
|
-
for (let i = at + m[0].length; i < code.length && depth > 0; i++) {
|
|
8844
|
-
const ch = code[i];
|
|
8845
|
-
if (inString) {
|
|
8846
|
-
if (ch === '"') inString = false;
|
|
8847
|
-
continue;
|
|
8848
|
-
}
|
|
8849
|
-
if (ch === '"') {
|
|
8850
|
-
inString = true;
|
|
8851
|
-
any = true;
|
|
8852
|
-
} else if (ch === "(") {
|
|
8853
|
-
depth++;
|
|
8854
|
-
any = true;
|
|
8855
|
-
} else if (ch === ")") depth--;
|
|
8856
|
-
else if (ch === "," && depth === 1) args++;
|
|
8857
|
-
else if (/\S/.test(ch)) any = true;
|
|
8858
|
-
}
|
|
8859
|
-
out2.push({ name: m[1], args: any ? args + 1 : 0, at });
|
|
8860
|
-
}
|
|
8861
|
-
return out2;
|
|
8862
|
-
}
|
|
8759
|
+
var WIDGET = /\bui_(knob|toggle|choice)\s*\(\s*(\d+)/g;
|
|
8760
|
+
var METER = /\bui_meter\s*\(/g;
|
|
8761
|
+
var countWidgets = (t) => [...t.matchAll(WIDGET)].length + [...t.matchAll(METER)].length;
|
|
8863
8762
|
function lintJsfx(source) {
|
|
8864
8763
|
const findings = [];
|
|
8865
8764
|
const add2 = (rule, severity, message, line) => findings.push({ rule, severity, message, ...line ? { line } : {} });
|
|
@@ -8905,28 +8804,12 @@ function lintJsfx(source) {
|
|
|
8905
8804
|
used.add(idx);
|
|
8906
8805
|
if (!byIndex.has(idx)) add2("widget-unknown-slider", "error", `ui_${m[1]}(${idx}, ...) points at slider${idx}, which is not declared.`, gfx.line + gfx.text.slice(0, m.index).split("\n").length);
|
|
8907
8806
|
}
|
|
8908
|
-
for (const m of gfx.text.matchAll(TRANSFER)) {
|
|
8909
|
-
for (const idx of [Number(m[1]), Number(m[2])]) {
|
|
8910
|
-
used.add(idx);
|
|
8911
|
-
if (!byIndex.has(idx)) add2("widget-unknown-slider", "error", `ui_transfer(${m[1]}, ${m[2]}, ...) points at slider${idx}, which is not declared.`, gfx.line + gfx.text.slice(0, m.index).split("\n").length);
|
|
8912
|
-
}
|
|
8913
|
-
}
|
|
8914
|
-
const ranges = [];
|
|
8915
|
-
for (const m of gfx.text.matchAll(HEADER)) for (const v of [m[1], m[2]]) if (Number(v) > 0) ranges.push(["ui_header", Number(v), 1]);
|
|
8916
|
-
for (const m of gfx.text.matchAll(BANDKNOB)) ranges.push(["ui_bandknob", Number(m[1]), Number(m[2])]);
|
|
8917
|
-
for (const m of gfx.text.matchAll(FTHRESH)) ranges.push(["ui_fthresh", Number(m[1]), Number(m[4])], ["ui_fthresh", Number(m[2]), Number(m[4])], ["ui_fthresh", Number(m[3]), Number(m[4])]);
|
|
8918
|
-
for (const [fn, first, count] of ranges) {
|
|
8919
|
-
for (let idx = first; idx < first + count; idx++) {
|
|
8920
|
-
used.add(idx);
|
|
8921
|
-
if (!byIndex.has(idx)) add2("widget-unknown-slider", "error", `${fn} covers slider${idx}, which is not declared (it takes ${count} sliders from slider${first}).`, gfx.line);
|
|
8922
|
-
}
|
|
8923
|
-
}
|
|
8924
8807
|
for (const s of sliders) {
|
|
8925
8808
|
if (!s.hidden && !used.has(s.index)) add2("slider-without-widget", "error", `slider${s.index} "${s.name}" has no widget in @gfx. Draw it, or hide it with a leading "-" in its label.`);
|
|
8926
8809
|
}
|
|
8927
8810
|
}
|
|
8928
8811
|
const init2 = secs.get("init")?.text ?? "";
|
|
8929
|
-
if (!/\bui_boot\s*\(/.test(init2)) add2("no-ui-boot", "error", "@init must call ui_boot(animated) after the plugin's own setup (animated = 1 when the UI has a meter
|
|
8812
|
+
if (!/\bui_boot\s*\(/.test(init2)) add2("no-ui-boot", "error", "@init must call ui_boot(animated) after the plugin's own setup (animated = 1 when the UI has a meter).");
|
|
8930
8813
|
if (!/\bui_changed\s*\(/.test(secs.get("block")?.text ?? "") && !/\bui_changed\s*\(/.test(secs.get("sample")?.text ?? "")) {
|
|
8931
8814
|
add2("no-changed", "error", "@block must call ui_changed() ? update(); so a knob moved in @gfx reaches the DSP.");
|
|
8932
8815
|
}
|
|
@@ -8941,15 +8824,6 @@ function lintJsfx(source) {
|
|
|
8941
8824
|
for (const m of code.matchAll(/\bgfx_getchar\s*\(/g)) {
|
|
8942
8825
|
add2("own-key-handling", "warning", "The plugin reads the keyboard (gfx_getchar): the toolkit does that while a value box is open, so typed values would go missing. Leave keyboard and mouse handling to the toolkit.", lineOf(m.index ?? 0));
|
|
8943
8826
|
}
|
|
8944
|
-
const own = new Set([...code.matchAll(/\bfunction\s+(ui_\w+)/g)].map((m) => m[1]));
|
|
8945
|
-
for (const c of uiCalls(code)) {
|
|
8946
|
-
const expected = UI_API[c.name];
|
|
8947
|
-
if (expected === void 0) {
|
|
8948
|
-
if (!own.has(c.name)) add2("unknown-ui-call", "error", `${c.name}() is not a toolkit function: REAPER would compile the call to nothing and the widget would silently not draw. Check the spelling against reference/toolkit.md.`, lineOf(c.at));
|
|
8949
|
-
} else if (c.args !== expected) {
|
|
8950
|
-
add2("ui-arity", "error", `${c.name}() takes ${expected} argument${expected === 1 ? "" : "s"}, this call has ${c.args}: EEL2 would drop the whole plugin or read the wrong values.`, lineOf(c.at));
|
|
8951
|
-
}
|
|
8952
|
-
}
|
|
8953
8827
|
for (const c of wrongMinMaxCalls(code)) {
|
|
8954
8828
|
add2("two-arg-minmax", "error", `max/min take exactly two arguments, this call has ${c.count}: REAPER would fail to compile the whole plugin and pass the audio through. Nest them: max(max(a, b), c).`, lineOf(c.at));
|
|
8955
8829
|
}
|
|
@@ -8960,7 +8834,7 @@ function lintJsfx(source) {
|
|
|
8960
8834
|
if (/\/=?\s*srate\b/.test(sample.text)) add2("sample-divide-srate", "warning", "Dividing by srate per sample: compute the coefficient in update() once.", sample.line);
|
|
8961
8835
|
}
|
|
8962
8836
|
for (const m of code.matchAll(/\b(?:buf|mem|memory)\w*\s*=\s*(\d+)\s*;/g)) {
|
|
8963
|
-
if (Number(m[1]) <
|
|
8837
|
+
if (Number(m[1]) < 1024) add2("low-memory-index", "warning", `A buffer starts at index ${m[1]}: memory below ui_mem (1024) is reserved for the toolkit. Allocate from ui_mem.`, lineOf(m.index ?? 0));
|
|
8964
8838
|
}
|
|
8965
8839
|
return findings;
|
|
8966
8840
|
}
|
|
@@ -8971,10 +8845,6 @@ function widgetCounts(source) {
|
|
|
8971
8845
|
const at = gfx.search(/\bui_section\s*\(/);
|
|
8972
8846
|
return { core: countWidgets(at === -1 ? gfx : gfx.slice(0, at)), advanced: at === -1 ? 0 : countWidgets(gfx.slice(at)) };
|
|
8973
8847
|
}
|
|
8974
|
-
function graphWidgetCount(source) {
|
|
8975
|
-
const gfx = sections2(stripComments(source.replace(/\r\n/g, "\n"))).get("gfx")?.text ?? "";
|
|
8976
|
-
return [...gfx.matchAll(GRAPHS)].length;
|
|
8977
|
-
}
|
|
8978
8848
|
|
|
8979
8849
|
// apps/reaper-mcp-server/src/jsfx/presets.ts
|
|
8980
8850
|
import { existsSync as existsSync4, mkdirSync as mkdirSync5, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "node:fs";
|
|
@@ -9124,7 +8994,6 @@ function shapeAttributes(s) {
|
|
|
9124
8994
|
"reaper.jsfx.overwrite": s.overwrite,
|
|
9125
8995
|
...s.sliders !== void 0 ? { "reaper.jsfx.sliders": cap(s.sliders, MAX_USER_SLIDERS) } : {},
|
|
9126
8996
|
...s.widgets ? { "reaper.jsfx.widgets.core": cap(s.widgets.core, 16), "reaper.jsfx.widgets.advanced": cap(s.widgets.advanced, 16) } : {},
|
|
9127
|
-
...s.graphs !== void 0 ? { "reaper.jsfx.graphs": cap(s.graphs, 8) } : {},
|
|
9128
8997
|
...s.bytes !== void 0 ? { "reaper.jsfx.size": sizeBucket(s.bytes) } : {},
|
|
9129
8998
|
...s.version !== void 0 ? { "reaper.jsfx.version": cap(s.version, MAX_VERSION) } : {},
|
|
9130
8999
|
...s.toolkit ? { "reaper.jsfx.toolkit_version": s.toolkit } : {},
|
|
@@ -9182,7 +9051,7 @@ function writeJsfx(input) {
|
|
|
9182
9051
|
const sliders = parseSliders(args.source).sliders;
|
|
9183
9052
|
const widgets = widgetCounts(args.source);
|
|
9184
9053
|
const toolkit = loadToolkit();
|
|
9185
|
-
const shape2 = { overwrite: overwrite2, sliders: sliders.length, widgets,
|
|
9054
|
+
const shape2 = { overwrite: overwrite2, sliders: sliders.length, widgets, bytes: Buffer.byteLength(args.source), toolkit: toolkitVersion(toolkit), findings, accent: accent.kind };
|
|
9186
9055
|
if (errorsOf(findings).length) {
|
|
9187
9056
|
record({ ...shape2, outcome: "refused_lint" });
|
|
9188
9057
|
emitLog("warn", "write_jsfx refused: lint errors", { "reaper.jsfx.outcome": "refused_lint", "reaper.jsfx.lint.rules": [...new Set(errorsOf(findings).map((f) => f.rule))].join(",") });
|
package/package.json
CHANGED