@grame/faustwasm 0.13.7 → 0.14.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.
Files changed (40) hide show
  1. package/assets/standalone/faustwasm/index.d.ts +3 -0
  2. package/assets/standalone/faustwasm/index.js +29 -6
  3. package/assets/standalone/faustwasm/index.js.map +2 -2
  4. package/dist/cjs/index.d.ts +3 -0
  5. package/dist/cjs/index.js +29 -6
  6. package/dist/cjs/index.js.map +2 -2
  7. package/dist/cjs-bundle/index.d.ts +3 -0
  8. package/dist/cjs-bundle/index.js +29 -6
  9. package/dist/cjs-bundle/index.js.map +2 -2
  10. package/dist/esm/index.d.ts +3 -0
  11. package/dist/esm/index.js +29 -6
  12. package/dist/esm/index.js.map +2 -2
  13. package/dist/esm-bundle/index.d.ts +3 -0
  14. package/dist/esm-bundle/index.js +29 -6
  15. package/dist/esm-bundle/index.js.map +2 -2
  16. package/package.json +1 -1
  17. package/src/FaustAudioWorkletNode.ts +14 -4
  18. package/src/FaustWebAudioDsp.ts +16 -2
  19. package/src/types.ts +2 -0
  20. package/test/faustlive-wasm/faustwasm/index.d.ts +3 -0
  21. package/test/faustlive-wasm/faustwasm/index.js +29 -6
  22. package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
  23. package/test/node/test-param-aliases.js +73 -0
  24. package/test/organ/create-node.js +252 -0
  25. package/test/organ/dsp-meta.json +131 -0
  26. package/test/organ/dsp-module.wasm +0 -0
  27. package/test/organ/faust-pwa.js +344 -0
  28. package/test/organ/faust-ui/index.css +442 -0
  29. package/test/organ/faust-ui/index.css.map +1 -0
  30. package/test/organ/faust-ui/index.d.ts +1 -0
  31. package/test/organ/faust-ui/index.js +3756 -0
  32. package/test/organ/faust-ui/index.js.map +1 -0
  33. package/test/organ/faustwasm/index.d.ts +1730 -0
  34. package/test/organ/faustwasm/index.js +5969 -0
  35. package/test/organ/faustwasm/index.js.map +7 -0
  36. package/test/organ/icon.png +0 -0
  37. package/test/organ/index.html +76 -0
  38. package/test/organ/index.js +69 -0
  39. package/test/organ/manifest.json +17 -0
  40. package/test/organ/service-worker.js +165 -0
@@ -132,6 +132,7 @@ export interface FaustUIInputItem {
132
132
  type: FaustUIInputType;
133
133
  label: string;
134
134
  address: string;
135
+ shortname: string;
135
136
  url: string;
136
137
  index: number;
137
138
  init?: number;
@@ -144,6 +145,7 @@ export interface FaustUIOutputItem {
144
145
  type: FaustUIOutputType;
145
146
  label: string;
146
147
  address: string;
148
+ shortname: string;
147
149
  index: number;
148
150
  min?: number;
149
151
  max?: number;
@@ -1401,6 +1403,7 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
1401
1403
  protected fUICallback: UIHandler;
1402
1404
  protected fDescriptor: FaustUIInputItem[];
1403
1405
  protected fCommunicator: FaustAudioWorkletNodeCommunicator;
1406
+ protected fParamAliases: Record<string, string>;
1404
1407
  constructor(context: BaseAudioContext, name: string, factory: LooseFaustDspFactory, options?: Partial<FaustAudioWorkletNodeOptions<Poly>>);
1405
1408
  protected handleMessageAux: (e: MessageEvent) => void;
1406
1409
  private handleDeviceMotion;
@@ -8360,11 +8360,25 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
8360
8360
  this.fPathTable = {};
8361
8361
  this.fUICallback = (item) => {
8362
8362
  if (item.type === "hbargraph" || item.type === "vbargraph") {
8363
+ const registerPath = (alias) => {
8364
+ if (this.fPathTable[alias] === void 0) {
8365
+ this.fPathTable[alias] = item.index;
8366
+ }
8367
+ };
8363
8368
  this.fOutputsItems.push(item.address);
8364
- this.fPathTable[item.address] = item.index;
8369
+ registerPath(item.address);
8370
+ registerPath(item.shortname);
8371
+ registerPath(item.label);
8365
8372
  } else if (item.type === "vslider" || item.type === "hslider" || item.type === "button" || item.type === "checkbox" || item.type === "nentry") {
8373
+ const registerPath = (alias) => {
8374
+ if (this.fPathTable[alias] === void 0) {
8375
+ this.fPathTable[alias] = item.index;
8376
+ }
8377
+ };
8366
8378
  this.fInputsItems.push(item.address);
8367
- this.fPathTable[item.address] = item.index;
8379
+ registerPath(item.address);
8380
+ registerPath(item.shortname);
8381
+ registerPath(item.label);
8368
8382
  this.fDescriptor.push(item);
8369
8383
  if (!item.meta) return;
8370
8384
  item.meta.forEach((meta) => {
@@ -10569,11 +10583,19 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
10569
10583
  this.fComputeHandler = null;
10570
10584
  this.fPlotHandler = null;
10571
10585
  this.fDescriptor = [];
10586
+ this.fParamAliases = {};
10572
10587
  this.fInputsItems = [];
10573
10588
  this.fUICallback = (item) => {
10574
10589
  if (item.type === "vslider" || item.type === "hslider" || item.type === "button" || item.type === "checkbox" || item.type === "nentry") {
10575
10590
  this.fInputsItems.push(item.address);
10576
10591
  this.fDescriptor.push(item);
10592
+ const registerAlias = (alias) => {
10593
+ if (!this.fParamAliases[alias]) {
10594
+ this.fParamAliases[alias] = item.address;
10595
+ }
10596
+ };
10597
+ registerAlias(item.shortname);
10598
+ registerAlias(item.label);
10577
10599
  if (!item.meta) return;
10578
10600
  item.meta.forEach((meta) => {
10579
10601
  const { midi, acc, gyr } = meta;
@@ -10728,13 +10750,14 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
10728
10750
  });
10729
10751
  }
10730
10752
  setParamValue(path, value) {
10731
- const e = { type: "param", data: { path, value } };
10732
- this.port.postMessage(e);
10733
- const param = this.parameters.get(path);
10753
+ const resolved = this.fParamAliases[path] || path;
10754
+ this.port.postMessage({ type: "param", data: { path: resolved, value } });
10755
+ const param = this.parameters.get(resolved);
10734
10756
  if (param) param.setValueAtTime(value, this.context.currentTime);
10735
10757
  }
10736
10758
  getParamValue(path) {
10737
- const param = this.parameters.get(path);
10759
+ const resolved = this.fParamAliases[path] || path;
10760
+ const param = this.parameters.get(resolved);
10738
10761
  return param ? param.value : 0;
10739
10762
  }
10740
10763
  getParams() {