@grame/faustwasm 0.13.7 → 0.14.1
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/assets/standalone/faustwasm/index.d.ts +9 -0
- package/assets/standalone/faustwasm/index.js +42 -12
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/dist/cjs/index.d.ts +9 -0
- package/dist/cjs/index.js +42 -12
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.d.ts +9 -0
- package/dist/cjs-bundle/index.js +42 -12
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.js +42 -12
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.d.ts +9 -0
- package/dist/esm-bundle/index.js +42 -12
- package/dist/esm-bundle/index.js.map +2 -2
- package/package.json +1 -1
- package/src/FaustAudioWorkletNode.ts +14 -4
- package/src/FaustWebAudioDsp.ts +16 -2
- package/src/SoundfileReader.ts +14 -6
- package/src/types.ts +2 -0
- package/test/faustlive-wasm/faustwasm/index.d.ts +9 -0
- package/test/faustlive-wasm/faustwasm/index.js +42 -12
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
- package/test/node/test-param-aliases.js +73 -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;
|
|
@@ -1328,6 +1330,12 @@ export declare class WavDecoder {
|
|
|
1328
1330
|
}
|
|
1329
1331
|
/** Read metadata and fetch soundfiles */
|
|
1330
1332
|
export declare class SoundfileReader {
|
|
1333
|
+
/**
|
|
1334
|
+
* Set fallback base URLs used to resolve soundfile paths.
|
|
1335
|
+
*
|
|
1336
|
+
* In Node or other non-browser runtimes, `location` may be undefined;
|
|
1337
|
+
* in that case this returns an empty list to avoid resolution errors.
|
|
1338
|
+
*/
|
|
1331
1339
|
static get fallbackPaths(): string[];
|
|
1332
1340
|
/**
|
|
1333
1341
|
* Extract the parent URL from an URL.
|
|
@@ -1401,6 +1409,7 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
|
|
|
1401
1409
|
protected fUICallback: UIHandler;
|
|
1402
1410
|
protected fDescriptor: FaustUIInputItem[];
|
|
1403
1411
|
protected fCommunicator: FaustAudioWorkletNodeCommunicator;
|
|
1412
|
+
protected fParamAliases: Record<string, string>;
|
|
1404
1413
|
constructor(context: BaseAudioContext, name: string, factory: LooseFaustDspFactory, options?: Partial<FaustAudioWorkletNodeOptions<Poly>>);
|
|
1405
1414
|
protected handleMessageAux: (e: MessageEvent) => void;
|
|
1406
1415
|
private handleDeviceMotion;
|
package/dist/cjs-bundle/index.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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) => {
|
|
@@ -10264,13 +10278,20 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
10264
10278
|
|
|
10265
10279
|
// src/SoundfileReader.ts
|
|
10266
10280
|
var SoundfileReader = class {
|
|
10267
|
-
|
|
10281
|
+
/**
|
|
10282
|
+
* Set fallback base URLs used to resolve soundfile paths.
|
|
10283
|
+
*
|
|
10284
|
+
* In Node or other non-browser runtimes, `location` may be undefined;
|
|
10285
|
+
* in that case this returns an empty list to avoid resolution errors.
|
|
10286
|
+
*/
|
|
10268
10287
|
static get fallbackPaths() {
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
|
-
]
|
|
10288
|
+
const loc = typeof location !== "undefined" ? location : null;
|
|
10289
|
+
const href = loc == null ? void 0 : loc.href;
|
|
10290
|
+
const origin = loc == null ? void 0 : loc.origin;
|
|
10291
|
+
const parent = href ? this.getParentUrl(href) : null;
|
|
10292
|
+
return [href, parent, origin].filter(
|
|
10293
|
+
(value) => typeof value === "string" && value.length > 0
|
|
10294
|
+
);
|
|
10274
10295
|
}
|
|
10275
10296
|
/**
|
|
10276
10297
|
* Extract the parent URL from an URL.
|
|
@@ -10569,11 +10590,19 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
10569
10590
|
this.fComputeHandler = null;
|
|
10570
10591
|
this.fPlotHandler = null;
|
|
10571
10592
|
this.fDescriptor = [];
|
|
10593
|
+
this.fParamAliases = {};
|
|
10572
10594
|
this.fInputsItems = [];
|
|
10573
10595
|
this.fUICallback = (item) => {
|
|
10574
10596
|
if (item.type === "vslider" || item.type === "hslider" || item.type === "button" || item.type === "checkbox" || item.type === "nentry") {
|
|
10575
10597
|
this.fInputsItems.push(item.address);
|
|
10576
10598
|
this.fDescriptor.push(item);
|
|
10599
|
+
const registerAlias = (alias) => {
|
|
10600
|
+
if (!this.fParamAliases[alias]) {
|
|
10601
|
+
this.fParamAliases[alias] = item.address;
|
|
10602
|
+
}
|
|
10603
|
+
};
|
|
10604
|
+
registerAlias(item.shortname);
|
|
10605
|
+
registerAlias(item.label);
|
|
10577
10606
|
if (!item.meta) return;
|
|
10578
10607
|
item.meta.forEach((meta) => {
|
|
10579
10608
|
const { midi, acc, gyr } = meta;
|
|
@@ -10728,13 +10757,14 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
10728
10757
|
});
|
|
10729
10758
|
}
|
|
10730
10759
|
setParamValue(path, value) {
|
|
10731
|
-
const
|
|
10732
|
-
this.port.postMessage(
|
|
10733
|
-
const param = this.parameters.get(
|
|
10760
|
+
const resolved = this.fParamAliases[path] || path;
|
|
10761
|
+
this.port.postMessage({ type: "param", data: { path: resolved, value } });
|
|
10762
|
+
const param = this.parameters.get(resolved);
|
|
10734
10763
|
if (param) param.setValueAtTime(value, this.context.currentTime);
|
|
10735
10764
|
}
|
|
10736
10765
|
getParamValue(path) {
|
|
10737
|
-
const
|
|
10766
|
+
const resolved = this.fParamAliases[path] || path;
|
|
10767
|
+
const param = this.parameters.get(resolved);
|
|
10738
10768
|
return param ? param.value : 0;
|
|
10739
10769
|
}
|
|
10740
10770
|
getParams() {
|