@m4l-jweb/build 1.1.0 → 1.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l-jweb/build",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "m4l-jweb: the CLI that builds and packages a device repo into installable Max for Live devices.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,6 +34,6 @@
34
34
  "archiver": "^7.0.1",
35
35
  "esbuild": "^0.25.0",
36
36
  "typescript": "^5.7.0",
37
- "@m4l-jweb/wrapper": "1.1.0"
37
+ "@m4l-jweb/wrapper": "1.2.0"
38
38
  }
39
39
  }
package/src/surface.mjs CHANGED
@@ -612,7 +612,10 @@ function audioWindowBoxes(id, spec) {
612
612
  numinlets: 1,
613
613
  numoutlets: 3,
614
614
  outlettype: ["signal", "signal", ""],
615
- rendermode: 1,
615
+ rendermode: spec.rendermode ?? 1,
616
+ // The ring buffer between Chromium's audio thread and MSP. Unset keeps the
617
+ // object's default; the surface spec documents the documented range.
618
+ ...(spec.latency != null ? { latency: spec.latency } : {}),
616
619
  // On the PATCHING canvas at the origin, filling the window. See FITTED
617
620
  // WINDOWS below for why this one is not in presentation like the others.
618
621
  patching_rect: [0, 0, spec.width, spec.height],
@@ -658,7 +661,7 @@ const HELPER_Y = -260;
658
661
  * `[pcontrol]`'s `close` is the same message the app sends, so nothing special
659
662
  * needs to be true about the window afterwards.
660
663
  */
661
- function mixAudioWindow(ctx, id, subpatcherId, pcontrolId) {
664
+ function mixAudioWindow(ctx, id, subpatcherId, pcontrolId, spec = {}) {
662
665
  const { boxes, lines, device } = ctx;
663
666
 
664
667
  // openAudio() leaves ctx.audioIn throwing on a MIDI device, but its message talks
@@ -687,11 +690,12 @@ function mixAudioWindow(ctx, id, subpatcherId, pcontrolId) {
687
690
  // the last report, which is what a meter wants and costs a float per channel per
688
691
  // interval rather than a stream of samples.
689
692
  const tap = (suffix) => `obj-window-${id}-peak-${suffix}`;
690
- // 10 ms - fast enough that the trace reads as the shape of the sound rather than a
691
- // meter twitching. It is still an ENVELOPE and not a waveform: what crosses is one
692
- // float per channel per report, not samples, because no page can be handed audio.
693
- boxes.push(box(tap("l"), "peakamp~ 10", { numinlets: 1, numoutlets: 1, outlettype: ["float"] }));
694
- boxes.push(box(tap("r"), "peakamp~ 10", { numinlets: 1, numoutlets: 1, outlettype: ["float"] }));
693
+ // Default 10 ms - fast enough that the trace reads as the shape of the sound rather
694
+ // than a meter twitching. It is still an ENVELOPE and not a waveform: what crosses is
695
+ // one float per channel per report, not samples, because no page can be handed audio.
696
+ const levelMs = spec.levelInterval ?? 10;
697
+ boxes.push(box(tap("l"), `peakamp~ ${levelMs}`, { numinlets: 1, numoutlets: 1, outlettype: ["float"] }));
698
+ boxes.push(box(tap("r"), `peakamp~ ${levelMs}`, { numinlets: 1, numoutlets: 1, outlettype: ["float"] }));
695
699
  // `pak` and not `pack`: both inlets hot, so a change on either channel reports
696
700
  // rather than waiting for the left one to move.
697
701
  boxes.push(box(tap("pak"), "pak f f", { numinlets: 2, numoutlets: 1, outlettype: [""] }));
@@ -883,7 +887,7 @@ export function applyWindows(ctx) {
883
887
  },
884
888
  });
885
889
 
886
- if (audio) mixAudioWindow(ctx, id, subpatcherId, pcontrolId);
890
+ if (audio) mixAudioWindow(ctx, id, subpatcherId, pcontrolId, spec);
887
891
  });
888
892
  }
889
893
 
@@ -17,13 +17,13 @@
17
17
  "format": "prettier --write \"src/**/*.{ts,tsx,css}\" \"scripts/*.mjs\" \"patcher/*.mjs\""
18
18
  },
19
19
  "dependencies": {
20
- "@m4l-jweb/bridge": "^1.1.0",
21
- "@m4l-jweb/surface": "^1.1.0",
20
+ "@m4l-jweb/bridge": "^1.2.0",
21
+ "@m4l-jweb/surface": "^1.2.0",
22
22
  "react": "^19.0.0",
23
23
  "react-dom": "^19.0.0"
24
24
  },
25
25
  "devDependencies": {
26
- "@m4l-jweb/build": "^1.1.0",
26
+ "@m4l-jweb/build": "^1.2.0",
27
27
  "@types/node": "^22.0.0",
28
28
  "@types/react": "^19.0.0",
29
29
  "@types/react-dom": "^19.0.0",