@grame/faustwasm 0.2.3 → 0.3.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 +41 -0
- package/assets/standalone/faustwasm/index.js +538 -15
- package/assets/standalone/faustwasm/index.js.map +3 -3
- package/assets/standalone/index.js +17 -11
- package/dist/cjs/index.d.ts +41 -0
- package/dist/cjs/index.js +537 -15
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs-bundle/index.d.ts +41 -0
- package/dist/cjs-bundle/index.js +537 -15
- package/dist/cjs-bundle/index.js.map +3 -3
- package/dist/esm/index.d.ts +41 -0
- package/dist/esm/index.js +538 -15
- package/dist/esm/index.js.map +3 -3
- package/dist/esm-bundle/index.d.ts +41 -0
- package/dist/esm-bundle/index.js +537 -15
- package/dist/esm-bundle/index.js.map +3 -3
- package/package.json +1 -1
- package/src/FaustAudioWorkletNode.ts +73 -0
- package/src/FaustAudioWorkletProcessor.ts +33 -4
- package/src/FaustDspGenerator.ts +14 -2
- package/src/FaustOfflineProcessor.ts +10 -0
- package/src/FaustScriptProcessorNode.ts +61 -1
- package/src/FaustSensors.ts +370 -0
- package/src/FaustWebAudioDsp.ts +109 -10
- package/test/faustlive-wasm/faustwasm/index.d.ts +41 -0
- package/test/faustlive-wasm/faustwasm/index.js +538 -15
- package/test/faustlive-wasm/faustwasm/index.js.map +3 -3
- package/test/faustlive-wasm/index.js +2 -0
- package/test/osc.dsp +4 -2
- package/LIB.dsp +0 -1
|
@@ -376,6 +376,12 @@ export type PlotHandler = (plotted: Float32Array[] | Float64Array[], index: numb
|
|
|
376
376
|
}[]) => void;
|
|
377
377
|
export type MetadataHandler = (key: string, value: string) => void;
|
|
378
378
|
export type UIHandler = (item: FaustUIItem) => void;
|
|
379
|
+
export type SensorEventHandler = (val: number) => void;
|
|
380
|
+
export type SensorEventHandlers = {
|
|
381
|
+
x: SensorEventHandler[];
|
|
382
|
+
y: SensorEventHandler[];
|
|
383
|
+
z: SensorEventHandler[];
|
|
384
|
+
};
|
|
379
385
|
/** Definition of the AudioBufferItem type */
|
|
380
386
|
export interface AudioBufferItem {
|
|
381
387
|
pathName: string;
|
|
@@ -626,6 +632,14 @@ export interface IFaustBaseWebAudioDsp {
|
|
|
626
632
|
* Destroy the DSP.
|
|
627
633
|
*/
|
|
628
634
|
destroy(): void;
|
|
635
|
+
/** Indicating if the DSP handles the accelerometer */
|
|
636
|
+
readonly hasAccInput: boolean;
|
|
637
|
+
/** Accelerometer handling */
|
|
638
|
+
propagateAcc(accelerationIncludingGravity: NonNullable<DeviceMotionEvent["accelerationIncludingGravity"]>): void;
|
|
639
|
+
/** Indicating if the DSP handles the gyroscope */
|
|
640
|
+
readonly hasGyrInput: boolean;
|
|
641
|
+
/** Gyroscope handling */
|
|
642
|
+
propagateGyr(event: Pick<DeviceOrientationEvent, "alpha" | "beta" | "gamma">): void;
|
|
629
643
|
}
|
|
630
644
|
export interface IFaustMonoWebAudioDsp extends IFaustBaseWebAudioDsp {
|
|
631
645
|
}
|
|
@@ -676,6 +690,8 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
|
676
690
|
protected fSoundfileBuffers: LooseFaustDspFactory["soundfiles"];
|
|
677
691
|
/** Keep the end of memory offset before soundfiles */
|
|
678
692
|
protected fEndMemory: number;
|
|
693
|
+
protected fAcc: SensorEventHandlers;
|
|
694
|
+
protected fGyr: SensorEventHandlers;
|
|
679
695
|
protected fAudioInputs: number;
|
|
680
696
|
protected fAudioOutputs: number;
|
|
681
697
|
protected fBufferSize: number;
|
|
@@ -707,6 +723,14 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
|
707
723
|
static parseItem(item: FaustUIItem, callback: (item: FaustUIItem) => any): void;
|
|
708
724
|
/** Split the soundfile names and return an array of names */
|
|
709
725
|
static splitSoundfileNames(input: string): string[];
|
|
726
|
+
get hasAccInput(): boolean;
|
|
727
|
+
propagateAcc(accelerationIncludingGravity: NonNullable<DeviceMotionEvent["accelerationIncludingGravity"]>): void;
|
|
728
|
+
get hasGyrInput(): boolean;
|
|
729
|
+
propagateGyr(event: Pick<DeviceOrientationEvent, "alpha" | "beta" | "gamma">): void;
|
|
730
|
+
/** Build the accelerometer handler */
|
|
731
|
+
private setupAccHandler;
|
|
732
|
+
/** Build the gyroscope handler */
|
|
733
|
+
private setupGyrHandler;
|
|
710
734
|
static extractUrlsFromMeta(dspMeta: FaustDspMeta): string[];
|
|
711
735
|
/**
|
|
712
736
|
* Load a soundfile possibly containing several parts in the DSP struct.
|
|
@@ -1098,6 +1122,10 @@ export declare class FaustOfflineProcessor<Poly extends boolean = false> {
|
|
|
1098
1122
|
start(): void;
|
|
1099
1123
|
stop(): void;
|
|
1100
1124
|
destroy(): void;
|
|
1125
|
+
get hasAccInput(): boolean;
|
|
1126
|
+
propagateAcc(accelerationIncludingGravity: NonNullable<DeviceMotionEvent["accelerationIncludingGravity"]>): void;
|
|
1127
|
+
get hasGyrInput(): boolean;
|
|
1128
|
+
propagateGyr(event: Pick<DeviceOrientationEvent, "alpha" | "beta" | "gamma">): void;
|
|
1101
1129
|
/**
|
|
1102
1130
|
* Render frames in an array.
|
|
1103
1131
|
*
|
|
@@ -1239,6 +1267,7 @@ declare const FaustAudioWorkletNode_base: {
|
|
|
1239
1267
|
* Base class for Monophonic and Polyphonic AudioWorkletNode
|
|
1240
1268
|
*/
|
|
1241
1269
|
export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends FaustAudioWorkletNode_base {
|
|
1270
|
+
#private;
|
|
1242
1271
|
protected fJSONDsp: FaustDspMeta;
|
|
1243
1272
|
protected fJSON: string;
|
|
1244
1273
|
protected fInputsItems: string[];
|
|
@@ -1248,6 +1277,8 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
|
|
|
1248
1277
|
protected fUICallback: UIHandler;
|
|
1249
1278
|
protected fDescriptor: FaustUIInputItem[];
|
|
1250
1279
|
constructor(context: BaseAudioContext, name: string, factory: LooseFaustDspFactory, options: FaustAudioWorkletNodeOptions<Poly>["processorOptions"], nodeOptions?: Partial<FaustAudioWorkletNodeOptions>);
|
|
1280
|
+
/** Setup accelerometer and gyroscope handlers */
|
|
1281
|
+
listenMotion(): Promise<void>;
|
|
1251
1282
|
setOutputParamHandler(handler: OutputParamHandler | null): void;
|
|
1252
1283
|
getOutputParamHandler(): OutputParamHandler | null;
|
|
1253
1284
|
setComputeHandler(handler: ComputeHandler | null): void;
|
|
@@ -1261,6 +1292,10 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
|
|
|
1261
1292
|
midiMessage(data: number[] | Uint8Array): void;
|
|
1262
1293
|
ctrlChange(channel: number, ctrl: number, value: number): void;
|
|
1263
1294
|
pitchWheel(channel: number, wheel: number): void;
|
|
1295
|
+
get hasAccInput(): boolean;
|
|
1296
|
+
propagateAcc(accelerationIncludingGravity: NonNullable<DeviceMotionEvent["accelerationIncludingGravity"]>): void;
|
|
1297
|
+
get hasGyrInput(): boolean;
|
|
1298
|
+
propagateGyr(event: Pick<DeviceOrientationEvent, "alpha" | "beta" | "gamma">): void;
|
|
1264
1299
|
setParamValue(path: string, value: number): void;
|
|
1265
1300
|
getParamValue(path: string): number;
|
|
1266
1301
|
getParams(): string[];
|
|
@@ -1305,6 +1340,8 @@ export declare class FaustScriptProcessorNode<Poly extends boolean = false> exte
|
|
|
1305
1340
|
protected fInputs: Float32Array[];
|
|
1306
1341
|
protected fOutputs: Float32Array[];
|
|
1307
1342
|
init(instance: Poly extends true ? FaustPolyWebAudioDsp : FaustMonoWebAudioDsp): void;
|
|
1343
|
+
/** Setup accelerometer and gyroscope handlers */
|
|
1344
|
+
listenMotion(): Promise<void>;
|
|
1308
1345
|
compute(input: Float32Array[], output: Float32Array[]): boolean;
|
|
1309
1346
|
setOutputParamHandler(handler: OutputParamHandler): void;
|
|
1310
1347
|
getOutputParamHandler(): OutputParamHandler | null;
|
|
@@ -1328,6 +1365,10 @@ export declare class FaustScriptProcessorNode<Poly extends boolean = false> exte
|
|
|
1328
1365
|
start(): void;
|
|
1329
1366
|
stop(): void;
|
|
1330
1367
|
destroy(): void;
|
|
1368
|
+
get hasAccInput(): boolean;
|
|
1369
|
+
propagateAcc(accelerationIncludingGravity: NonNullable<DeviceMotionEvent["accelerationIncludingGravity"]>): void;
|
|
1370
|
+
get hasGyrInput(): boolean;
|
|
1371
|
+
propagateGyr(event: Pick<DeviceOrientationEvent, "alpha" | "beta" | "gamma">): void;
|
|
1331
1372
|
}
|
|
1332
1373
|
export declare class FaustMonoScriptProcessorNode extends FaustScriptProcessorNode<false> implements IFaustMonoWebAudioDsp {
|
|
1333
1374
|
}
|