@grame/faustwasm 0.0.30 → 0.0.33

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.
@@ -1174,6 +1174,24 @@ export interface IFaustMonoDspGenerator {
1174
1174
  * @returns the compiled processor or 'null' if failure
1175
1175
  */
1176
1176
  createOfflineProcessor(sampleRate: number, bufferSize: number, factory?: LooseFaustDspFactory, meta?: FaustDspMeta): Promise<IFaustMonoOfflineProcessor | null>;
1177
+ /**
1178
+ * Get DSP JSON description with its UI and metadata as object.
1179
+ *
1180
+ * @return the DSP JSON description as object
1181
+ */
1182
+ getMeta(): FaustDspMeta;
1183
+ /**
1184
+ * Get DSP JSON description with its UI and metadata.
1185
+ *
1186
+ * @return the DSP JSON description
1187
+ */
1188
+ getJSON(): string;
1189
+ /**
1190
+ * Get DSP UI description.
1191
+ *
1192
+ * @return the DSP UI description
1193
+ */
1194
+ getUI(): FaustUIDescriptor;
1177
1195
  }
1178
1196
  export interface IFaustPolyDspGenerator {
1179
1197
  /**
@@ -1215,6 +1233,24 @@ export interface IFaustPolyDspGenerator {
1215
1233
  * @returns the compiled processor or 'null' if failure
1216
1234
  */
1217
1235
  createOfflineProcessor(sampleRate: number, bufferSize: number, voices: number, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null): Promise<IFaustPolyOfflineProcessor | null>;
1236
+ /**
1237
+ * Get DSP JSON description with its UI and metadata as object.
1238
+ *
1239
+ * @return the DSP JSON description as object
1240
+ */
1241
+ getMeta(): FaustDspMeta;
1242
+ /**
1243
+ * Get DSP JSON description with its UI and metadata.
1244
+ *
1245
+ * @return the DSP JSON description
1246
+ */
1247
+ getJSON(): string;
1248
+ /**
1249
+ * Get DSP UI description.
1250
+ *
1251
+ * @return the DSP UI description
1252
+ */
1253
+ getUI(): FaustUIDescriptor;
1218
1254
  }
1219
1255
  export declare class FaustMonoDspGenerator implements IFaustMonoDspGenerator {
1220
1256
  private static gWorkletProcessors;
@@ -1230,6 +1266,9 @@ export declare class FaustMonoDspGenerator implements IFaustMonoDspGenerator {
1230
1266
  parameterDescriptors: AudioParamDescriptor[];
1231
1267
  }>;
1232
1268
  createOfflineProcessor(sampleRate: number, bufferSize: number, factory?: LooseFaustDspFactory): Promise<FaustMonoOfflineProcessor>;
1269
+ getMeta(): any;
1270
+ getJSON(): string;
1271
+ getUI(): any;
1233
1272
  }
1234
1273
  export declare class FaustPolyDspGenerator implements IFaustPolyDspGenerator {
1235
1274
  private static gWorkletProcessors;
@@ -1247,6 +1286,9 @@ export declare class FaustPolyDspGenerator implements IFaustPolyDspGenerator {
1247
1286
  parameterDescriptors: AudioParamDescriptor[];
1248
1287
  }>;
1249
1288
  createOfflineProcessor(sampleRate: number, bufferSize: number, voices: number, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null): Promise<FaustPolyOfflineProcessor>;
1289
+ getMeta(): FaustDspMeta;
1290
+ getJSON(): string;
1291
+ getUI(): FaustUIDescriptor;
1250
1292
  }
1251
1293
 
1252
1294
  export {};
@@ -1748,7 +1748,7 @@ var FaustWasmInstantiator = class {
1748
1748
  _min_f: Math.min,
1749
1749
  _remainderf: (x, y) => x - Math.round(x / y) * y,
1750
1750
  _powf: Math.pow,
1751
- _roundf: Math.fround,
1751
+ _roundf: Math.round,
1752
1752
  _sinf: Math.sin,
1753
1753
  _sqrtf: Math.sqrt,
1754
1754
  _tanf: Math.tan,
@@ -1776,7 +1776,7 @@ var FaustWasmInstantiator = class {
1776
1776
  _min_: Math.min,
1777
1777
  _remainder: (x, y) => x - Math.round(x / y) * y,
1778
1778
  _pow: Math.pow,
1779
- _round: Math.fround,
1779
+ _round: Math.round,
1780
1780
  _sin: Math.sin,
1781
1781
  _sqrt: Math.sqrt,
1782
1782
  _tan: Math.tan,
@@ -3619,6 +3619,15 @@ const dependencies = {
3619
3619
  const monoDsp = new FaustMonoWebAudioDsp(instance, sampleRate, sampleSize, bufferSize);
3620
3620
  return new FaustMonoOfflineProcessor(monoDsp, bufferSize);
3621
3621
  }
3622
+ getMeta() {
3623
+ return JSON.parse(this.factory.json);
3624
+ }
3625
+ getJSON() {
3626
+ return JSON.stringify(this.getMeta());
3627
+ }
3628
+ getUI() {
3629
+ return this.getMeta();
3630
+ }
3622
3631
  };
3623
3632
  var FaustMonoDspGenerator = _FaustMonoDspGenerator;
3624
3633
  FaustMonoDspGenerator.gWorkletProcessors = /* @__PURE__ */ new Map();
@@ -3739,6 +3748,36 @@ const dependencies = {
3739
3748
  const polyDsp = new FaustPolyWebAudioDsp(instance, sampleRate, sampleSize, bufferSize);
3740
3749
  return new FaustPolyOfflineProcessor(polyDsp, bufferSize);
3741
3750
  }
3751
+ getMeta() {
3752
+ const o = this.voiceFactory ? JSON.parse(this.voiceFactory.json) : null;
3753
+ const e = this.effectFactory ? JSON.parse(this.effectFactory.json) : null;
3754
+ const r = { ...o };
3755
+ if (e) {
3756
+ r.ui = [{
3757
+ type: "tgroup",
3758
+ label: "Sequencer",
3759
+ items: [
3760
+ { type: "vgroup", label: "Instrument", items: o.ui },
3761
+ { type: "vgroup", label: "Effect", items: e.ui }
3762
+ ]
3763
+ }];
3764
+ } else {
3765
+ r.ui = [{
3766
+ type: "tgroup",
3767
+ label: "Polyphonic",
3768
+ items: [
3769
+ { type: "vgroup", label: "Voices", items: o.ui }
3770
+ ]
3771
+ }];
3772
+ }
3773
+ return r;
3774
+ }
3775
+ getJSON() {
3776
+ return JSON.stringify(this.getMeta());
3777
+ }
3778
+ getUI() {
3779
+ return this.getMeta().ui;
3780
+ }
3742
3781
  };
3743
3782
  var FaustPolyDspGenerator = _FaustPolyDspGenerator;
3744
3783
  FaustPolyDspGenerator.gWorkletProcessors = /* @__PURE__ */ new Map();