@grame/faustwasm 0.10.2 → 0.11.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/assets/standalone/faustwasm/index.d.ts +44 -1
- package/assets/standalone/faustwasm/index.js +47 -1
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/dist/cjs/index.d.ts +44 -1
- package/dist/cjs/index.js +47 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.d.ts +44 -1
- package/dist/cjs-bundle/index.js +47 -1
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.d.ts +44 -1
- package/dist/esm/index.js +47 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.d.ts +44 -1
- package/dist/esm-bundle/index.js +47 -1
- package/dist/esm-bundle/index.js.map +2 -2
- package/package.json +1 -1
- package/src/FaustAudioWorkletNode.ts +7 -0
- package/src/FaustOfflineProcessor.ts +3 -0
- package/src/FaustScriptProcessorNode.ts +3 -0
- package/src/FaustWebAudioDsp.ts +16 -0
- package/test/faustlive-wasm/faustwasm/index.d.ts +44 -1
- package/test/faustlive-wasm/faustwasm/index.js +47 -1
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
|
@@ -432,6 +432,17 @@ export type SensorEventHandlers = {
|
|
|
432
432
|
y: SensorEventHandler[];
|
|
433
433
|
z: SensorEventHandler[];
|
|
434
434
|
};
|
|
435
|
+
/**
|
|
436
|
+
* Interface for MIDI output handler, used in Faust WebAudio nodes
|
|
437
|
+
* to handle MIDI events like control changes, pitch wheel changes,
|
|
438
|
+
* key on and key off events.
|
|
439
|
+
*/
|
|
440
|
+
export interface MidiOutputHandler {
|
|
441
|
+
ctrlChange(chan: number, ctrl: number, value: number): void;
|
|
442
|
+
pitchWheel(chan: number, value: number): void;
|
|
443
|
+
keyOn(channel: number, pitch: number, velocity: number): void;
|
|
444
|
+
keyOff(channel: number, pitch: number, velocity: number): void;
|
|
445
|
+
}
|
|
435
446
|
/** Definition of the AudioBufferItem type */
|
|
436
447
|
export interface AudioBufferItem {
|
|
437
448
|
pathName: string;
|
|
@@ -555,6 +566,13 @@ export interface IFaustBaseWebAudioDsp {
|
|
|
555
566
|
* @return the current output handler
|
|
556
567
|
*/
|
|
557
568
|
getOutputParamHandler(): OutputParamHandler | null;
|
|
569
|
+
/**
|
|
570
|
+
* Call the output parameter handler with a path and value.
|
|
571
|
+
*
|
|
572
|
+
* @param path - the path to the wanted parameter (retrieved using 'getParams' method)
|
|
573
|
+
* @param value - the float value for the wanted control
|
|
574
|
+
*/
|
|
575
|
+
callOutputParamHandler(path: string, value: number): void;
|
|
558
576
|
/**
|
|
559
577
|
* Set the compute handler, to be called in the 'compute' method with buffer size.
|
|
560
578
|
*
|
|
@@ -567,6 +585,18 @@ export interface IFaustBaseWebAudioDsp {
|
|
|
567
585
|
* @return the current output handler
|
|
568
586
|
*/
|
|
569
587
|
getComputeHandler(): ComputeHandler | null;
|
|
588
|
+
/**
|
|
589
|
+
* Set the MIDI output handler, to be called in the 'compute' method with MIDI messages.
|
|
590
|
+
* @param handler - the MIDI output handler
|
|
591
|
+
* @return void
|
|
592
|
+
*/
|
|
593
|
+
setMidiOutputHandler(handler: MidiOutputHandler | null): void;
|
|
594
|
+
/**
|
|
595
|
+
* Get the MIDI output handler.
|
|
596
|
+
*
|
|
597
|
+
* @return the current MIDI output handler
|
|
598
|
+
*/
|
|
599
|
+
getMidiOutputHandler(): MidiOutputHandler | null;
|
|
570
600
|
/**
|
|
571
601
|
* Set the plot handler, to be called in the 'compute' method with various info (see PlotHandler type).
|
|
572
602
|
*
|
|
@@ -753,6 +783,7 @@ export interface IFaustPolyWebAudioNode extends IFaustPolyWebAudioDsp, AudioNode
|
|
|
753
783
|
export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
754
784
|
protected fOutputHandler: OutputParamHandler | null;
|
|
755
785
|
protected fComputeHandler: ComputeHandler | null;
|
|
786
|
+
protected fMidiOutputHandler: MidiOutputHandler | null;
|
|
756
787
|
protected fPlotHandler: PlotHandler | null;
|
|
757
788
|
protected fCachedEvents: {
|
|
758
789
|
type: string;
|
|
@@ -848,7 +879,6 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
|
848
879
|
* Init soundfiles memory.
|
|
849
880
|
*
|
|
850
881
|
* @param allocator : the wasm memory allocator
|
|
851
|
-
* @param sfReader : the soundfile reader
|
|
852
882
|
* @param baseDSP : the DSP struct (either a monophonic DSP of polyphonic voice) base DSP in the wasm memory
|
|
853
883
|
*/
|
|
854
884
|
protected initSoundfileMemory(allocator: WasmAllocator, baseDSP: number): void;
|
|
@@ -857,8 +887,11 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
|
857
887
|
compute(input: Float32Array[], output: Float32Array[]): boolean;
|
|
858
888
|
setOutputParamHandler(handler: OutputParamHandler | null): void;
|
|
859
889
|
getOutputParamHandler(): OutputParamHandler | null;
|
|
890
|
+
callOutputParamHandler(path: string, value: number): void;
|
|
860
891
|
setComputeHandler(handler: ComputeHandler | null): void;
|
|
861
892
|
getComputeHandler(): ComputeHandler | null;
|
|
893
|
+
setMidiOutputHandler(handler: MidiOutputHandler | null): void;
|
|
894
|
+
getMidiOutputHandler(): MidiOutputHandler | null;
|
|
862
895
|
setPlotHandler(handler: PlotHandler | null): void;
|
|
863
896
|
getPlotHandler(): PlotHandler | null;
|
|
864
897
|
getNumInputs(): number;
|
|
@@ -1210,8 +1243,11 @@ export declare class FaustOfflineProcessor<Poly extends boolean = false> {
|
|
|
1210
1243
|
compute(input: Float32Array[], output: Float32Array[]): boolean;
|
|
1211
1244
|
setOutputParamHandler(handler: OutputParamHandler): void;
|
|
1212
1245
|
getOutputParamHandler(): OutputParamHandler | null;
|
|
1246
|
+
callOutputParamHandler(path: string, value: number): void;
|
|
1213
1247
|
setComputeHandler(handler: ComputeHandler): void;
|
|
1214
1248
|
getComputeHandler(): ComputeHandler | null;
|
|
1249
|
+
setMidiOutputHandler(handler: MidiOutputHandler | null): void;
|
|
1250
|
+
getMidiOutputHandler(): MidiOutputHandler | null;
|
|
1215
1251
|
setPlotHandler(handler: PlotHandler): void;
|
|
1216
1252
|
getPlotHandler(): PlotHandler | null;
|
|
1217
1253
|
getNumInputs(): number;
|
|
@@ -1391,6 +1427,7 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
|
|
|
1391
1427
|
protected fInputsItems: string[];
|
|
1392
1428
|
protected fOutputHandler: OutputParamHandler | null;
|
|
1393
1429
|
protected fComputeHandler: ComputeHandler | null;
|
|
1430
|
+
protected fMidiOutputHandler: MidiOutputHandler | null;
|
|
1394
1431
|
protected fPlotHandler: PlotHandler | null;
|
|
1395
1432
|
protected fUICallback: UIHandler;
|
|
1396
1433
|
protected fDescriptor: FaustUIInputItem[];
|
|
@@ -1404,8 +1441,11 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
|
|
|
1404
1441
|
stopSensors(): void;
|
|
1405
1442
|
setOutputParamHandler(handler: OutputParamHandler | null): void;
|
|
1406
1443
|
getOutputParamHandler(): OutputParamHandler | null;
|
|
1444
|
+
callOutputParamHandler(path: string, value: number): void;
|
|
1407
1445
|
setComputeHandler(handler: ComputeHandler | null): void;
|
|
1408
1446
|
getComputeHandler(): ComputeHandler | null;
|
|
1447
|
+
setMidiOutputHandler(handler: MidiOutputHandler | null): void;
|
|
1448
|
+
getMidiOutputHandler(): MidiOutputHandler | null;
|
|
1409
1449
|
setPlotHandler(handler: PlotHandler | null): void;
|
|
1410
1450
|
getPlotHandler(): PlotHandler | null;
|
|
1411
1451
|
setupWamEventHandler(): void;
|
|
@@ -1475,10 +1515,13 @@ export declare class FaustScriptProcessorNode<Poly extends boolean = false> exte
|
|
|
1475
1515
|
compute(input: Float32Array[], output: Float32Array[]): boolean;
|
|
1476
1516
|
setOutputParamHandler(handler: OutputParamHandler): void;
|
|
1477
1517
|
getOutputParamHandler(): OutputParamHandler | null;
|
|
1518
|
+
callOutputParamHandler(path: string, value: number): void;
|
|
1478
1519
|
setComputeHandler(handler: ComputeHandler): void;
|
|
1479
1520
|
getComputeHandler(): ComputeHandler | null;
|
|
1480
1521
|
setPlotHandler(handler: PlotHandler): void;
|
|
1481
1522
|
getPlotHandler(): PlotHandler | null;
|
|
1523
|
+
setMidiOutputHandler(handler: MidiOutputHandler | null): void;
|
|
1524
|
+
getMidiOutputHandler(): MidiOutputHandler | null;
|
|
1482
1525
|
getNumInputs(): number;
|
|
1483
1526
|
getNumOutputs(): number;
|
|
1484
1527
|
metadata(handler: MetadataHandler): void;
|
package/dist/cjs-bundle/index.js
CHANGED
|
@@ -8106,6 +8106,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8106
8106
|
constructor(sampleSize, bufferSize, soundfiles) {
|
|
8107
8107
|
this.fOutputHandler = null;
|
|
8108
8108
|
this.fComputeHandler = null;
|
|
8109
|
+
this.fMidiOutputHandler = null;
|
|
8109
8110
|
// To handle MIDI events plot
|
|
8110
8111
|
this.fPlotHandler = null;
|
|
8111
8112
|
this.fCachedEvents = [];
|
|
@@ -8371,7 +8372,6 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8371
8372
|
* Init soundfiles memory.
|
|
8372
8373
|
*
|
|
8373
8374
|
* @param allocator : the wasm memory allocator
|
|
8374
|
-
* @param sfReader : the soundfile reader
|
|
8375
8375
|
* @param baseDSP : the DSP struct (either a monophonic DSP of polyphonic voice) base DSP in the wasm memory
|
|
8376
8376
|
*/
|
|
8377
8377
|
initSoundfileMemory(allocator, baseDSP) {
|
|
@@ -8404,12 +8404,25 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8404
8404
|
getOutputParamHandler() {
|
|
8405
8405
|
return this.fOutputHandler;
|
|
8406
8406
|
}
|
|
8407
|
+
callOutputParamHandler(path, value) {
|
|
8408
|
+
if (this.fOutputHandler) {
|
|
8409
|
+
this.fOutputHandler(path, value);
|
|
8410
|
+
} else {
|
|
8411
|
+
console.warn("No OutputParamHandler set for this FaustAudioWorkletNode.");
|
|
8412
|
+
}
|
|
8413
|
+
}
|
|
8407
8414
|
setComputeHandler(handler) {
|
|
8408
8415
|
this.fComputeHandler = handler;
|
|
8409
8416
|
}
|
|
8410
8417
|
getComputeHandler() {
|
|
8411
8418
|
return this.fComputeHandler;
|
|
8412
8419
|
}
|
|
8420
|
+
setMidiOutputHandler(handler) {
|
|
8421
|
+
this.fMidiOutputHandler = handler;
|
|
8422
|
+
}
|
|
8423
|
+
getMidiOutputHandler() {
|
|
8424
|
+
return this.fMidiOutputHandler;
|
|
8425
|
+
}
|
|
8413
8426
|
setPlotHandler(handler) {
|
|
8414
8427
|
this.fPlotHandler = handler;
|
|
8415
8428
|
}
|
|
@@ -8548,6 +8561,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8548
8561
|
this.fDestroyed = true;
|
|
8549
8562
|
this.fOutputHandler = null;
|
|
8550
8563
|
this.fComputeHandler = null;
|
|
8564
|
+
this.fMidiOutputHandler = null;
|
|
8551
8565
|
this.fPlotHandler = null;
|
|
8552
8566
|
}
|
|
8553
8567
|
};
|
|
@@ -9104,12 +9118,21 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9104
9118
|
getOutputParamHandler() {
|
|
9105
9119
|
return this.fDSPCode.getOutputParamHandler();
|
|
9106
9120
|
}
|
|
9121
|
+
callOutputParamHandler(path, value) {
|
|
9122
|
+
this.fDSPCode.callOutputParamHandler(path, value);
|
|
9123
|
+
}
|
|
9107
9124
|
setComputeHandler(handler) {
|
|
9108
9125
|
this.fDSPCode.setComputeHandler(handler);
|
|
9109
9126
|
}
|
|
9110
9127
|
getComputeHandler() {
|
|
9111
9128
|
return this.fDSPCode.getComputeHandler();
|
|
9112
9129
|
}
|
|
9130
|
+
setMidiOutputHandler(handler) {
|
|
9131
|
+
this.fDSPCode.setMidiOutputHandler(handler);
|
|
9132
|
+
}
|
|
9133
|
+
getMidiOutputHandler() {
|
|
9134
|
+
return this.fDSPCode.getMidiOutputHandler();
|
|
9135
|
+
}
|
|
9113
9136
|
setPlotHandler(handler) {
|
|
9114
9137
|
this.fDSPCode.setPlotHandler(handler);
|
|
9115
9138
|
}
|
|
@@ -9952,6 +9975,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9952
9975
|
processorOptions: options.processorOptions,
|
|
9953
9976
|
...options
|
|
9954
9977
|
});
|
|
9978
|
+
this.fMidiOutputHandler = null;
|
|
9955
9979
|
__privateAdd(this, _hasAccInput, false);
|
|
9956
9980
|
__privateAdd(this, _hasGyrInput, false);
|
|
9957
9981
|
this.handleMessageAux = (e) => {
|
|
@@ -10031,12 +10055,25 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
10031
10055
|
getOutputParamHandler() {
|
|
10032
10056
|
return this.fOutputHandler;
|
|
10033
10057
|
}
|
|
10058
|
+
callOutputParamHandler(path, value) {
|
|
10059
|
+
if (this.fOutputHandler) {
|
|
10060
|
+
this.fOutputHandler(path, value);
|
|
10061
|
+
} else {
|
|
10062
|
+
console.warn("No OutputParamHandler set for this FaustAudioWorkletNode.");
|
|
10063
|
+
}
|
|
10064
|
+
}
|
|
10034
10065
|
setComputeHandler(handler) {
|
|
10035
10066
|
this.fComputeHandler = handler;
|
|
10036
10067
|
}
|
|
10037
10068
|
getComputeHandler() {
|
|
10038
10069
|
return this.fComputeHandler;
|
|
10039
10070
|
}
|
|
10071
|
+
setMidiOutputHandler(handler) {
|
|
10072
|
+
this.fMidiOutputHandler = handler;
|
|
10073
|
+
}
|
|
10074
|
+
getMidiOutputHandler() {
|
|
10075
|
+
return this.fMidiOutputHandler;
|
|
10076
|
+
}
|
|
10040
10077
|
setPlotHandler(handler) {
|
|
10041
10078
|
this.fPlotHandler = handler;
|
|
10042
10079
|
if (this.fPlotHandler) {
|
|
@@ -10292,6 +10329,9 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
10292
10329
|
getOutputParamHandler() {
|
|
10293
10330
|
return this.fDSPCode.getOutputParamHandler();
|
|
10294
10331
|
}
|
|
10332
|
+
callOutputParamHandler(path, value) {
|
|
10333
|
+
this.fDSPCode.callOutputParamHandler(path, value);
|
|
10334
|
+
}
|
|
10295
10335
|
setComputeHandler(handler) {
|
|
10296
10336
|
this.fDSPCode.setComputeHandler(handler);
|
|
10297
10337
|
}
|
|
@@ -10304,6 +10344,12 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
10304
10344
|
getPlotHandler() {
|
|
10305
10345
|
return this.fDSPCode.getPlotHandler();
|
|
10306
10346
|
}
|
|
10347
|
+
setMidiOutputHandler(handler) {
|
|
10348
|
+
this.fDSPCode.setMidiOutputHandler(handler);
|
|
10349
|
+
}
|
|
10350
|
+
getMidiOutputHandler() {
|
|
10351
|
+
return this.fDSPCode.getMidiOutputHandler();
|
|
10352
|
+
}
|
|
10307
10353
|
getNumInputs() {
|
|
10308
10354
|
return this.fDSPCode.getNumInputs();
|
|
10309
10355
|
}
|