@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;
|
|
@@ -1321,6 +1323,12 @@ export declare class WavDecoder {
|
|
|
1321
1323
|
}
|
|
1322
1324
|
/** Read metadata and fetch soundfiles */
|
|
1323
1325
|
export declare class SoundfileReader {
|
|
1326
|
+
/**
|
|
1327
|
+
* Set fallback base URLs used to resolve soundfile paths.
|
|
1328
|
+
*
|
|
1329
|
+
* In Node or other non-browser runtimes, `location` may be undefined;
|
|
1330
|
+
* in that case this returns an empty list to avoid resolution errors.
|
|
1331
|
+
*/
|
|
1324
1332
|
static get fallbackPaths(): string[];
|
|
1325
1333
|
/**
|
|
1326
1334
|
* Extract the parent URL from an URL.
|
|
@@ -1394,6 +1402,7 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
|
|
|
1394
1402
|
protected fUICallback: UIHandler;
|
|
1395
1403
|
protected fDescriptor: FaustUIInputItem[];
|
|
1396
1404
|
protected fCommunicator: FaustAudioWorkletNodeCommunicator;
|
|
1405
|
+
protected fParamAliases: Record<string, string>;
|
|
1397
1406
|
constructor(context: BaseAudioContext, name: string, factory: LooseFaustDspFactory, options?: Partial<FaustAudioWorkletNodeOptions<Poly>>);
|
|
1398
1407
|
protected handleMessageAux: (e: MessageEvent) => void;
|
|
1399
1408
|
private handleDeviceMotion;
|
|
@@ -2526,11 +2526,25 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
|
|
|
2526
2526
|
this.fPathTable = {};
|
|
2527
2527
|
this.fUICallback = (item) => {
|
|
2528
2528
|
if (item.type === "hbargraph" || item.type === "vbargraph") {
|
|
2529
|
+
const registerPath = (alias) => {
|
|
2530
|
+
if (this.fPathTable[alias] === void 0) {
|
|
2531
|
+
this.fPathTable[alias] = item.index;
|
|
2532
|
+
}
|
|
2533
|
+
};
|
|
2529
2534
|
this.fOutputsItems.push(item.address);
|
|
2530
|
-
|
|
2535
|
+
registerPath(item.address);
|
|
2536
|
+
registerPath(item.shortname);
|
|
2537
|
+
registerPath(item.label);
|
|
2531
2538
|
} else if (item.type === "vslider" || item.type === "hslider" || item.type === "button" || item.type === "checkbox" || item.type === "nentry") {
|
|
2539
|
+
const registerPath = (alias) => {
|
|
2540
|
+
if (this.fPathTable[alias] === void 0) {
|
|
2541
|
+
this.fPathTable[alias] = item.index;
|
|
2542
|
+
}
|
|
2543
|
+
};
|
|
2532
2544
|
this.fInputsItems.push(item.address);
|
|
2533
|
-
|
|
2545
|
+
registerPath(item.address);
|
|
2546
|
+
registerPath(item.shortname);
|
|
2547
|
+
registerPath(item.label);
|
|
2534
2548
|
this.fDescriptor.push(item);
|
|
2535
2549
|
if (!item.meta) return;
|
|
2536
2550
|
item.meta.forEach((meta) => {
|
|
@@ -4430,13 +4444,20 @@ var WavDecoder_default = WavDecoder;
|
|
|
4430
4444
|
|
|
4431
4445
|
// src/SoundfileReader.ts
|
|
4432
4446
|
var SoundfileReader = class {
|
|
4433
|
-
|
|
4447
|
+
/**
|
|
4448
|
+
* Set fallback base URLs used to resolve soundfile paths.
|
|
4449
|
+
*
|
|
4450
|
+
* In Node or other non-browser runtimes, `location` may be undefined;
|
|
4451
|
+
* in that case this returns an empty list to avoid resolution errors.
|
|
4452
|
+
*/
|
|
4434
4453
|
static get fallbackPaths() {
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
]
|
|
4454
|
+
const loc = typeof location !== "undefined" ? location : null;
|
|
4455
|
+
const href = loc == null ? void 0 : loc.href;
|
|
4456
|
+
const origin = loc == null ? void 0 : loc.origin;
|
|
4457
|
+
const parent = href ? this.getParentUrl(href) : null;
|
|
4458
|
+
return [href, parent, origin].filter(
|
|
4459
|
+
(value) => typeof value === "string" && value.length > 0
|
|
4460
|
+
);
|
|
4440
4461
|
}
|
|
4441
4462
|
/**
|
|
4442
4463
|
* Extract the parent URL from an URL.
|
|
@@ -4735,11 +4756,19 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
|
|
|
4735
4756
|
this.fComputeHandler = null;
|
|
4736
4757
|
this.fPlotHandler = null;
|
|
4737
4758
|
this.fDescriptor = [];
|
|
4759
|
+
this.fParamAliases = {};
|
|
4738
4760
|
this.fInputsItems = [];
|
|
4739
4761
|
this.fUICallback = (item) => {
|
|
4740
4762
|
if (item.type === "vslider" || item.type === "hslider" || item.type === "button" || item.type === "checkbox" || item.type === "nentry") {
|
|
4741
4763
|
this.fInputsItems.push(item.address);
|
|
4742
4764
|
this.fDescriptor.push(item);
|
|
4765
|
+
const registerAlias = (alias) => {
|
|
4766
|
+
if (!this.fParamAliases[alias]) {
|
|
4767
|
+
this.fParamAliases[alias] = item.address;
|
|
4768
|
+
}
|
|
4769
|
+
};
|
|
4770
|
+
registerAlias(item.shortname);
|
|
4771
|
+
registerAlias(item.label);
|
|
4743
4772
|
if (!item.meta) return;
|
|
4744
4773
|
item.meta.forEach((meta) => {
|
|
4745
4774
|
const { midi, acc, gyr } = meta;
|
|
@@ -4894,13 +4923,14 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
|
|
|
4894
4923
|
});
|
|
4895
4924
|
}
|
|
4896
4925
|
setParamValue(path, value) {
|
|
4897
|
-
const
|
|
4898
|
-
this.port.postMessage(
|
|
4899
|
-
const param = this.parameters.get(
|
|
4926
|
+
const resolved = this.fParamAliases[path] || path;
|
|
4927
|
+
this.port.postMessage({ type: "param", data: { path: resolved, value } });
|
|
4928
|
+
const param = this.parameters.get(resolved);
|
|
4900
4929
|
if (param) param.setValueAtTime(value, this.context.currentTime);
|
|
4901
4930
|
}
|
|
4902
4931
|
getParamValue(path) {
|
|
4903
|
-
const
|
|
4932
|
+
const resolved = this.fParamAliases[path] || path;
|
|
4933
|
+
const param = this.parameters.get(resolved);
|
|
4904
4934
|
return param ? param.value : 0;
|
|
4905
4935
|
}
|
|
4906
4936
|
getParams() {
|