@grame/faustwasm 0.0.26 → 0.0.28

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.
@@ -3,7 +3,7 @@
3
3
  /// <reference types="emscripten" />
4
4
  /// <reference types="node" />
5
5
 
6
- export declare type FaustModuleFactory = EmscriptenModuleFactory<FaustModule>;
6
+ export type FaustModuleFactory = EmscriptenModuleFactory<FaustModule>;
7
7
  export interface FaustModule extends EmscriptenModule {
8
8
  ccall: typeof ccall;
9
9
  cwrap: typeof cwrap;
@@ -22,7 +22,7 @@ export interface FaustModule extends EmscriptenModule {
22
22
  FS: typeof FS;
23
23
  libFaustWasm: new () => LibFaustWasm;
24
24
  }
25
- export declare type FaustInfoType = "help" | "version" | "libdir" | "includedir" | "archdir" | "dspdir" | "pathslist";
25
+ export type FaustInfoType = "help" | "version" | "libdir" | "includedir" | "archdir" | "dspdir" | "pathslist";
26
26
  export interface IntVector {
27
27
  size(): number;
28
28
  get(i: number): number;
@@ -125,8 +125,8 @@ export interface FaustDspMeta {
125
125
  }[];
126
126
  ui: FaustUIDescriptor;
127
127
  }
128
- export declare type FaustUIDescriptor = FaustUIGroup[];
129
- export declare type FaustUIItem = FaustUIInputItem | FaustUIOutputItem | FaustUIGroup;
128
+ export type FaustUIDescriptor = FaustUIGroup[];
129
+ export type FaustUIItem = FaustUIInputItem | FaustUIOutputItem | FaustUIGroup;
130
130
  export interface FaustUIInputItem {
131
131
  type: FaustUIInputType;
132
132
  label: string;
@@ -156,15 +156,15 @@ export interface FaustUIMeta {
156
156
  hidden?: string;
157
157
  [key: string]: string | undefined;
158
158
  }
159
- export declare type FaustUIGroupType = "vgroup" | "hgroup" | "tgroup";
160
- export declare type FaustUIOutputType = "hbargraph" | "vbargraph";
161
- export declare type FaustUIInputType = "vslider" | "hslider" | "button" | "checkbox" | "nentry";
159
+ export type FaustUIGroupType = "vgroup" | "hgroup" | "tgroup";
160
+ export type FaustUIOutputType = "hbargraph" | "vbargraph";
161
+ export type FaustUIInputType = "vslider" | "hslider" | "button" | "checkbox" | "nentry";
162
162
  export interface FaustUIGroup {
163
163
  type: FaustUIGroupType;
164
164
  label: string;
165
165
  items: FaustUIItem[];
166
166
  }
167
- export declare type FaustUIType = FaustUIGroupType | FaustUIOutputType | FaustUIInputType;
167
+ export type FaustUIType = FaustUIGroupType | FaustUIOutputType | FaustUIInputType;
168
168
  export interface AudioParamDescriptor {
169
169
  automationRate?: AutomationRate;
170
170
  defaultValue?: number;
@@ -198,12 +198,12 @@ export interface InterfaceFFT {
198
198
  export declare const InterfaceFFT: {
199
199
  new (size: number): InterfaceFFT;
200
200
  };
201
- export declare type TWindowFunction = (index: number, length: number, ...args: any[]) => number;
202
- export declare type Writeable<T> = {
201
+ export type TWindowFunction = (index: number, length: number, ...args: any[]) => number;
202
+ export type Writeable<T> = {
203
203
  -readonly [P in keyof T]: T[P];
204
204
  };
205
- export declare type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
206
- export declare type TypedArrayConstructor = typeof Int8Array | typeof Uint8Array | typeof Int16Array | typeof Uint16Array | typeof Int32Array | typeof Uint32Array | typeof Uint8ClampedArray | typeof Float32Array | typeof Float64Array;
205
+ export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
206
+ export type TypedArrayConstructor = typeof Int8Array | typeof Uint8Array | typeof Int16Array | typeof Uint16Array | typeof Int32Array | typeof Uint32Array | typeof Uint8ClampedArray | typeof Float32Array | typeof Float64Array;
207
207
  export declare const FFTUtils: {
208
208
  /** Inject window functions as array, no need to add rectangular (no windowing) */
209
209
  windowFunctions?: TWindowFunction[];
@@ -359,14 +359,14 @@ export declare class FaustWasmInstantiator {
359
359
  static createAsyncPolyDSPInstance(voiceFactory: LooseFaustDspFactory, mixerModule: WebAssembly.Module, voices: number, effectFactory?: LooseFaustDspFactory): Promise<FaustPolyDspInstance>;
360
360
  static createSyncPolyDSPInstance(voiceFactory: LooseFaustDspFactory, mixerModule: WebAssembly.Module, voices: number, effectFactory?: LooseFaustDspFactory): FaustPolyDspInstance;
361
361
  }
362
- export declare type OutputParamHandler = (path: string, value: number) => void;
363
- export declare type ComputeHandler = (buffer_size: number) => void;
364
- export declare type PlotHandler = (plotted: Float32Array[] | Float64Array[], index: number, events?: {
362
+ export type OutputParamHandler = (path: string, value: number) => void;
363
+ export type ComputeHandler = (buffer_size: number) => void;
364
+ export type PlotHandler = (plotted: Float32Array[] | Float64Array[], index: number, events?: {
365
365
  type: string;
366
366
  data: any;
367
367
  }[]) => void;
368
- export declare type MetadataHandler = (key: string, value: string) => void;
369
- export declare type UIHandler = (item: FaustUIItem) => void;
368
+ export type MetadataHandler = (key: string, value: string) => void;
369
+ export type UIHandler = (item: FaustUIItem) => void;
370
370
  /**
371
371
  * DSP implementation: mimic the C++ 'dsp' class:
372
372
  * - adding MIDI control: metadata are decoded and incoming MIDI messages will control the associated controllers
package/dist/cjs/index.js CHANGED
@@ -23,7 +23,10 @@
23
23
  }
24
24
  return to;
25
25
  };
26
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
27
30
 
28
31
  // node_modules/tslib/tslib.js
29
32
  var require_tslib = __commonJS({
@@ -854,8 +857,8 @@
854
857
  return this.hash.digest();
855
858
  };
856
859
  Sha2563.prototype.digest = function() {
857
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function() {
858
- return (0, tslib_1.__generator)(this, function(_a) {
860
+ return tslib_1.__awaiter(this, void 0, void 0, function() {
861
+ return tslib_1.__generator(this, function(_a) {
859
862
  return [2, this.digestSync()];
860
863
  });
861
864
  });
@@ -883,7 +886,7 @@
883
886
  "use strict";
884
887
  Object.defineProperty(exports, "__esModule", { value: true });
885
888
  var tslib_1 = require_tslib();
886
- (0, tslib_1.__exportStar)(require_jsSha256(), exports);
889
+ tslib_1.__exportStar(require_jsSha256(), exports);
887
890
  }
888
891
  });
889
892
 
@@ -1810,7 +1813,9 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
1810
1813
  return n;
1811
1814
  };
1812
1815
  const effectSize = effectMeta ? effectMeta.size : 0;
1813
- let memorySize = pow2limit(effectSize + dspMeta.size * voices + (dspMeta.inputs + dspMeta.outputs * 2) * (ptrSize + bufferSize * sampleSize)) / 65536;
1816
+ let memorySize = pow2limit(
1817
+ effectSize + dspMeta.size * voices + (dspMeta.inputs + dspMeta.outputs * 2) * (ptrSize + bufferSize * sampleSize)
1818
+ ) / 65536;
1814
1819
  memorySize = Math.max(2, memorySize);
1815
1820
  return new WebAssembly.Memory({ initial: memorySize, maximum: memorySize });
1816
1821
  }
@@ -2324,7 +2329,13 @@ this.fDSP: ${this.fDSP}`;
2324
2329
  this.initMemory();
2325
2330
  this.fVoiceTable = [];
2326
2331
  for (let voice = 0; voice < this.fInstance.voices; voice++) {
2327
- this.fVoiceTable.push(new FaustWebAudioDspVoice(this.fJSONDsp.size * voice, this.fInstance.voiceAPI, this.fInputsItems, this.fPathTable, sampleRate));
2332
+ this.fVoiceTable.push(new FaustWebAudioDspVoice(
2333
+ this.fJSONDsp.size * voice,
2334
+ this.fInstance.voiceAPI,
2335
+ this.fInputsItems,
2336
+ this.fPathTable,
2337
+ sampleRate
2338
+ ));
2328
2339
  }
2329
2340
  if (this.fInstance.effectAPI)
2330
2341
  this.fInstance.effectAPI.init(this.fEffect, sampleRate);
@@ -3291,14 +3302,20 @@ this.fAudioMixingHalf: ${this.fAudioMixingHalf}`;
3291
3302
  };
3292
3303
  var FaustPolyAudioWorkletNode = class extends FaustAudioWorkletNode {
3293
3304
  constructor(context, name, voiceFactory, mixerModule, voices, sampleSize, effectFactory, nodeOptions = {}) {
3294
- super(context, name, voiceFactory, {
3305
+ super(
3306
+ context,
3295
3307
  name,
3296
3308
  voiceFactory,
3297
- mixerModule,
3298
- voices,
3299
- sampleSize,
3300
- effectFactory
3301
- }, nodeOptions);
3309
+ {
3310
+ name,
3311
+ voiceFactory,
3312
+ mixerModule,
3313
+ voices,
3314
+ sampleSize,
3315
+ effectFactory
3316
+ },
3317
+ nodeOptions
3318
+ );
3302
3319
  this.onprocessorerror = (e) => {
3303
3320
  throw e;
3304
3321
  };