@grame/faustwasm 0.11.0 → 0.11.2
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/faust-ui/index.js +32 -5
- package/assets/standalone/faust-ui/index.js.map +1 -1
- package/assets/standalone/faustwasm/index.d.ts +1 -34
- package/assets/standalone/faustwasm/index.js +9 -36
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/dist/cjs/index.d.ts +1 -34
- package/dist/cjs/index.js +9 -36
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.d.ts +1 -34
- package/dist/cjs-bundle/index.js +18 -43
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.d.ts +1 -34
- package/dist/esm/index.js +9 -36
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.d.ts +1 -34
- package/dist/esm-bundle/index.js +18 -43
- package/dist/esm-bundle/index.js.map +2 -2
- package/libfaust-wasm/libfaust-wasm.data +0 -0
- package/libfaust-wasm/libfaust-wasm.js +1 -1
- package/libfaust-wasm/libfaust-wasm.wasm +0 -0
- package/package.json +1 -1
- package/src/FaustAudioWorkletNode.ts +1 -1
- package/src/FaustCompiler.ts +3 -3
- package/src/FaustWasmInstantiator.ts +2 -2
- package/src/FaustWebAudioDsp.ts +1 -1
- package/src/instantiateFaustModule.ts +9 -5
- package/src/instantiateFaustModuleFromFile.ts +7 -5
- package/test/faustlive-wasm/faust-ui/index.js +32 -5
- package/test/faustlive-wasm/faust-ui/index.js.map +1 -1
- package/test/faustlive-wasm/faustwasm/index.d.ts +1 -34
- package/test/faustlive-wasm/faustwasm/index.js +9 -36
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
|
@@ -425,17 +425,6 @@ export type SensorEventHandlers = {
|
|
|
425
425
|
y: SensorEventHandler[];
|
|
426
426
|
z: SensorEventHandler[];
|
|
427
427
|
};
|
|
428
|
-
/**
|
|
429
|
-
* Interface for MIDI output handler, used in Faust WebAudio nodes
|
|
430
|
-
* to handle MIDI events like control changes, pitch wheel changes,
|
|
431
|
-
* key on and key off events.
|
|
432
|
-
*/
|
|
433
|
-
export interface MidiOutputHandler {
|
|
434
|
-
ctrlChange(chan: number, ctrl: number, value: number): void;
|
|
435
|
-
pitchWheel(chan: number, value: number): void;
|
|
436
|
-
keyOn(channel: number, pitch: number, velocity: number): void;
|
|
437
|
-
keyOff(channel: number, pitch: number, velocity: number): void;
|
|
438
|
-
}
|
|
439
428
|
/** Definition of the AudioBufferItem type */
|
|
440
429
|
export interface AudioBufferItem {
|
|
441
430
|
pathName: string;
|
|
@@ -578,18 +567,6 @@ export interface IFaustBaseWebAudioDsp {
|
|
|
578
567
|
* @return the current output handler
|
|
579
568
|
*/
|
|
580
569
|
getComputeHandler(): ComputeHandler | null;
|
|
581
|
-
/**
|
|
582
|
-
* Set the MIDI output handler, to be called in the 'compute' method with MIDI messages.
|
|
583
|
-
* @param handler - the MIDI output handler
|
|
584
|
-
* @return void
|
|
585
|
-
*/
|
|
586
|
-
setMidiOutputHandler(handler: MidiOutputHandler | null): void;
|
|
587
|
-
/**
|
|
588
|
-
* Get the MIDI output handler.
|
|
589
|
-
*
|
|
590
|
-
* @return the current MIDI output handler
|
|
591
|
-
*/
|
|
592
|
-
getMidiOutputHandler(): MidiOutputHandler | null;
|
|
593
570
|
/**
|
|
594
571
|
* Set the plot handler, to be called in the 'compute' method with various info (see PlotHandler type).
|
|
595
572
|
*
|
|
@@ -776,7 +753,6 @@ export interface IFaustPolyWebAudioNode extends IFaustPolyWebAudioDsp, AudioNode
|
|
|
776
753
|
export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
777
754
|
protected fOutputHandler: OutputParamHandler | null;
|
|
778
755
|
protected fComputeHandler: ComputeHandler | null;
|
|
779
|
-
protected fMidiOutputHandler: MidiOutputHandler | null;
|
|
780
756
|
protected fPlotHandler: PlotHandler | null;
|
|
781
757
|
protected fCachedEvents: {
|
|
782
758
|
type: string;
|
|
@@ -883,8 +859,6 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
|
883
859
|
callOutputParamHandler(path: string, value: number): void;
|
|
884
860
|
setComputeHandler(handler: ComputeHandler | null): void;
|
|
885
861
|
getComputeHandler(): ComputeHandler | null;
|
|
886
|
-
setMidiOutputHandler(handler: MidiOutputHandler | null): void;
|
|
887
|
-
getMidiOutputHandler(): MidiOutputHandler | null;
|
|
888
862
|
setPlotHandler(handler: PlotHandler | null): void;
|
|
889
863
|
getPlotHandler(): PlotHandler | null;
|
|
890
864
|
getNumInputs(): number;
|
|
@@ -1239,8 +1213,6 @@ export declare class FaustOfflineProcessor<Poly extends boolean = false> {
|
|
|
1239
1213
|
callOutputParamHandler(path: string, value: number): void;
|
|
1240
1214
|
setComputeHandler(handler: ComputeHandler): void;
|
|
1241
1215
|
getComputeHandler(): ComputeHandler | null;
|
|
1242
|
-
setMidiOutputHandler(handler: MidiOutputHandler | null): void;
|
|
1243
|
-
getMidiOutputHandler(): MidiOutputHandler | null;
|
|
1244
1216
|
setPlotHandler(handler: PlotHandler): void;
|
|
1245
1217
|
getPlotHandler(): PlotHandler | null;
|
|
1246
1218
|
getNumInputs(): number;
|
|
@@ -1327,7 +1299,7 @@ export interface WavEncoderOptions {
|
|
|
1327
1299
|
* Code from https://github.com/mohayonao/wav-encoder
|
|
1328
1300
|
*/
|
|
1329
1301
|
export declare class WavEncoder {
|
|
1330
|
-
static encode(audioBuffer: Float32Array[], options: WavEncoderOptions): ArrayBuffer;
|
|
1302
|
+
static encode(audioBuffer: Float32Array[], options: WavEncoderOptions): ArrayBuffer | SharedArrayBuffer;
|
|
1331
1303
|
private static writeHeader;
|
|
1332
1304
|
private static writeData;
|
|
1333
1305
|
}
|
|
@@ -1420,7 +1392,6 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
|
|
|
1420
1392
|
protected fInputsItems: string[];
|
|
1421
1393
|
protected fOutputHandler: OutputParamHandler | null;
|
|
1422
1394
|
protected fComputeHandler: ComputeHandler | null;
|
|
1423
|
-
protected fMidiOutputHandler: MidiOutputHandler | null;
|
|
1424
1395
|
protected fPlotHandler: PlotHandler | null;
|
|
1425
1396
|
protected fUICallback: UIHandler;
|
|
1426
1397
|
protected fDescriptor: FaustUIInputItem[];
|
|
@@ -1437,8 +1408,6 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
|
|
|
1437
1408
|
callOutputParamHandler(path: string, value: number): void;
|
|
1438
1409
|
setComputeHandler(handler: ComputeHandler | null): void;
|
|
1439
1410
|
getComputeHandler(): ComputeHandler | null;
|
|
1440
|
-
setMidiOutputHandler(handler: MidiOutputHandler | null): void;
|
|
1441
|
-
getMidiOutputHandler(): MidiOutputHandler | null;
|
|
1442
1411
|
setPlotHandler(handler: PlotHandler | null): void;
|
|
1443
1412
|
getPlotHandler(): PlotHandler | null;
|
|
1444
1413
|
setupWamEventHandler(): void;
|
|
@@ -1513,8 +1482,6 @@ export declare class FaustScriptProcessorNode<Poly extends boolean = false> exte
|
|
|
1513
1482
|
getComputeHandler(): ComputeHandler | null;
|
|
1514
1483
|
setPlotHandler(handler: PlotHandler): void;
|
|
1515
1484
|
getPlotHandler(): PlotHandler | null;
|
|
1516
|
-
setMidiOutputHandler(handler: MidiOutputHandler | null): void;
|
|
1517
|
-
getMidiOutputHandler(): MidiOutputHandler | null;
|
|
1518
1485
|
getNumInputs(): number;
|
|
1519
1486
|
getNumOutputs(): number;
|
|
1520
1487
|
metadata(handler: MetadataHandler): void;
|
|
@@ -35,7 +35,7 @@ export default ${(_a = jsCode.match(jsCodeHead)) == null ? void 0 : _a[1]};
|
|
|
35
35
|
jsFileMod
|
|
36
36
|
)).default;
|
|
37
37
|
dataBinary = await (await fetch(dataFile)).arrayBuffer();
|
|
38
|
-
wasmBinary =
|
|
38
|
+
wasmBinary = await (await fetch(wasmFile)).arrayBuffer();
|
|
39
39
|
} else {
|
|
40
40
|
const { promises: fs } = await import("fs");
|
|
41
41
|
const { pathToFileURL } = await import("url");
|
|
@@ -61,8 +61,8 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
61
61
|
pathToFileURL(jsFileMod).href
|
|
62
62
|
)).default;
|
|
63
63
|
await fs.unlink(jsFileMod);
|
|
64
|
-
dataBinary = (await fs.readFile(dataFile)).buffer;
|
|
65
|
-
wasmBinary = (await fs.readFile(wasmFile)).buffer;
|
|
64
|
+
dataBinary = new Uint8Array(await fs.readFile(dataFile)).buffer;
|
|
65
|
+
wasmBinary = new Uint8Array(await fs.readFile(wasmFile)).buffer;
|
|
66
66
|
}
|
|
67
67
|
const faustModule = await FaustModule({
|
|
68
68
|
wasmBinary,
|
|
@@ -1183,7 +1183,7 @@ function bufferFromSecret(secret) {
|
|
|
1183
1183
|
}
|
|
1184
1184
|
|
|
1185
1185
|
// src/FaustCompiler.ts
|
|
1186
|
-
var ab2str = (buf) => String.fromCharCode.apply(null, buf);
|
|
1186
|
+
var ab2str = (buf) => String.fromCharCode.apply(null, Array.from(buf));
|
|
1187
1187
|
var str2ab = (str) => {
|
|
1188
1188
|
const buf = new ArrayBuffer(str.length);
|
|
1189
1189
|
const bufView = new Uint8Array(buf);
|
|
@@ -1321,7 +1321,7 @@ var _FaustCompiler = class _FaustCompiler {
|
|
|
1321
1321
|
const path = isDouble ? "/usr/rsrc/mixer64.wasm" : "/usr/rsrc/mixer32.wasm";
|
|
1322
1322
|
const mixerBuffer = this.fs().readFile(path, { encoding: "binary" });
|
|
1323
1323
|
this[bufferKey] = mixerBuffer;
|
|
1324
|
-
const mixerModule = await WebAssembly.compile(mixerBuffer);
|
|
1324
|
+
const mixerModule = await WebAssembly.compile(new Uint8Array(mixerBuffer));
|
|
1325
1325
|
this[moduleKey] = mixerModule;
|
|
1326
1326
|
return { mixerBuffer, mixerModule };
|
|
1327
1327
|
}
|
|
@@ -1333,7 +1333,7 @@ var _FaustCompiler = class _FaustCompiler {
|
|
|
1333
1333
|
const path = isDouble ? "/usr/rsrc/mixer64.wasm" : "/usr/rsrc/mixer32.wasm";
|
|
1334
1334
|
const mixerBuffer = this.fs().readFile(path, { encoding: "binary" });
|
|
1335
1335
|
this[bufferKey] = mixerBuffer;
|
|
1336
|
-
const mixerModule = new WebAssembly.Module(mixerBuffer);
|
|
1336
|
+
const mixerModule = new WebAssembly.Module(new Uint8Array(mixerBuffer));
|
|
1337
1337
|
this[moduleKey] = mixerModule;
|
|
1338
1338
|
return { mixerBuffer, mixerModule };
|
|
1339
1339
|
}
|
|
@@ -1525,7 +1525,7 @@ var FaustWasmInstantiator = class {
|
|
|
1525
1525
|
try {
|
|
1526
1526
|
let mixerBuffer = null;
|
|
1527
1527
|
if (fs) {
|
|
1528
|
-
mixerBuffer = fs.readFile(mixerPath, { encoding: "binary" });
|
|
1528
|
+
mixerBuffer = new Uint8Array(fs.readFile(mixerPath, { encoding: "binary" }));
|
|
1529
1529
|
} else {
|
|
1530
1530
|
const mixerFile = await fetch(mixerPath);
|
|
1531
1531
|
mixerBuffer = await mixerFile.arrayBuffer();
|
|
@@ -2107,7 +2107,6 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
|
|
|
2107
2107
|
constructor(sampleSize, bufferSize, soundfiles) {
|
|
2108
2108
|
this.fOutputHandler = null;
|
|
2109
2109
|
this.fComputeHandler = null;
|
|
2110
|
-
this.fMidiOutputHandler = null;
|
|
2111
2110
|
// To handle MIDI events plot
|
|
2112
2111
|
this.fPlotHandler = null;
|
|
2113
2112
|
this.fCachedEvents = [];
|
|
@@ -2409,7 +2408,7 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
|
|
|
2409
2408
|
if (this.fOutputHandler) {
|
|
2410
2409
|
this.fOutputHandler(path, value);
|
|
2411
2410
|
} else {
|
|
2412
|
-
console.warn("No OutputParamHandler set for this
|
|
2411
|
+
console.warn("No OutputParamHandler set for this Faust node.");
|
|
2413
2412
|
}
|
|
2414
2413
|
}
|
|
2415
2414
|
setComputeHandler(handler) {
|
|
@@ -2418,12 +2417,6 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
|
|
|
2418
2417
|
getComputeHandler() {
|
|
2419
2418
|
return this.fComputeHandler;
|
|
2420
2419
|
}
|
|
2421
|
-
setMidiOutputHandler(handler) {
|
|
2422
|
-
this.fMidiOutputHandler = handler;
|
|
2423
|
-
}
|
|
2424
|
-
getMidiOutputHandler() {
|
|
2425
|
-
return this.fMidiOutputHandler;
|
|
2426
|
-
}
|
|
2427
2420
|
setPlotHandler(handler) {
|
|
2428
2421
|
this.fPlotHandler = handler;
|
|
2429
2422
|
}
|
|
@@ -2562,7 +2555,6 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
|
|
|
2562
2555
|
this.fDestroyed = true;
|
|
2563
2556
|
this.fOutputHandler = null;
|
|
2564
2557
|
this.fComputeHandler = null;
|
|
2565
|
-
this.fMidiOutputHandler = null;
|
|
2566
2558
|
this.fPlotHandler = null;
|
|
2567
2559
|
}
|
|
2568
2560
|
};
|
|
@@ -3128,12 +3120,6 @@ var FaustOfflineProcessor = class {
|
|
|
3128
3120
|
getComputeHandler() {
|
|
3129
3121
|
return this.fDSPCode.getComputeHandler();
|
|
3130
3122
|
}
|
|
3131
|
-
setMidiOutputHandler(handler) {
|
|
3132
|
-
this.fDSPCode.setMidiOutputHandler(handler);
|
|
3133
|
-
}
|
|
3134
|
-
getMidiOutputHandler() {
|
|
3135
|
-
return this.fDSPCode.getMidiOutputHandler();
|
|
3136
|
-
}
|
|
3137
3123
|
setPlotHandler(handler) {
|
|
3138
3124
|
this.fDSPCode.setPlotHandler(handler);
|
|
3139
3125
|
}
|
|
@@ -3976,7 +3962,6 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
|
|
|
3976
3962
|
processorOptions: options.processorOptions,
|
|
3977
3963
|
...options
|
|
3978
3964
|
});
|
|
3979
|
-
this.fMidiOutputHandler = null;
|
|
3980
3965
|
__privateAdd(this, _hasAccInput, false);
|
|
3981
3966
|
__privateAdd(this, _hasGyrInput, false);
|
|
3982
3967
|
this.handleMessageAux = (e) => {
|
|
@@ -4060,7 +4045,7 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
|
|
|
4060
4045
|
if (this.fOutputHandler) {
|
|
4061
4046
|
this.fOutputHandler(path, value);
|
|
4062
4047
|
} else {
|
|
4063
|
-
console.warn("No OutputParamHandler set for this
|
|
4048
|
+
console.warn("No OutputParamHandler set for this Faust node.");
|
|
4064
4049
|
}
|
|
4065
4050
|
}
|
|
4066
4051
|
setComputeHandler(handler) {
|
|
@@ -4069,12 +4054,6 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
|
|
|
4069
4054
|
getComputeHandler() {
|
|
4070
4055
|
return this.fComputeHandler;
|
|
4071
4056
|
}
|
|
4072
|
-
setMidiOutputHandler(handler) {
|
|
4073
|
-
this.fMidiOutputHandler = handler;
|
|
4074
|
-
}
|
|
4075
|
-
getMidiOutputHandler() {
|
|
4076
|
-
return this.fMidiOutputHandler;
|
|
4077
|
-
}
|
|
4078
4057
|
setPlotHandler(handler) {
|
|
4079
4058
|
this.fPlotHandler = handler;
|
|
4080
4059
|
if (this.fPlotHandler) {
|
|
@@ -4345,12 +4324,6 @@ var FaustScriptProcessorNode = class extends (globalThis.ScriptProcessorNode ||
|
|
|
4345
4324
|
getPlotHandler() {
|
|
4346
4325
|
return this.fDSPCode.getPlotHandler();
|
|
4347
4326
|
}
|
|
4348
|
-
setMidiOutputHandler(handler) {
|
|
4349
|
-
this.fDSPCode.setMidiOutputHandler(handler);
|
|
4350
|
-
}
|
|
4351
|
-
getMidiOutputHandler() {
|
|
4352
|
-
return this.fDSPCode.getMidiOutputHandler();
|
|
4353
|
-
}
|
|
4354
4327
|
getNumInputs() {
|
|
4355
4328
|
return this.fDSPCode.getNumInputs();
|
|
4356
4329
|
}
|