@grame/faustwasm 0.0.32 → 0.0.34

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 {};
package/dist/cjs/index.js CHANGED
@@ -3627,6 +3627,15 @@ const dependencies = {
3627
3627
  const monoDsp = new FaustMonoWebAudioDsp(instance, sampleRate, sampleSize, bufferSize);
3628
3628
  return new FaustMonoOfflineProcessor(monoDsp, bufferSize);
3629
3629
  }
3630
+ getMeta() {
3631
+ return JSON.parse(this.factory.json);
3632
+ }
3633
+ getJSON() {
3634
+ return JSON.stringify(this.getMeta());
3635
+ }
3636
+ getUI() {
3637
+ return this.getMeta().ui;
3638
+ }
3630
3639
  };
3631
3640
  var FaustMonoDspGenerator = _FaustMonoDspGenerator;
3632
3641
  FaustMonoDspGenerator.gWorkletProcessors = /* @__PURE__ */ new Map();
@@ -3747,6 +3756,36 @@ const dependencies = {
3747
3756
  const polyDsp = new FaustPolyWebAudioDsp(instance, sampleRate, sampleSize, bufferSize);
3748
3757
  return new FaustPolyOfflineProcessor(polyDsp, bufferSize);
3749
3758
  }
3759
+ getMeta() {
3760
+ const o = this.voiceFactory ? JSON.parse(this.voiceFactory.json) : null;
3761
+ const e = this.effectFactory ? JSON.parse(this.effectFactory.json) : null;
3762
+ const r = { ...o };
3763
+ if (e) {
3764
+ r.ui = [{
3765
+ type: "tgroup",
3766
+ label: "Sequencer",
3767
+ items: [
3768
+ { type: "vgroup", label: "Instrument", items: o.ui },
3769
+ { type: "vgroup", label: "Effect", items: e.ui }
3770
+ ]
3771
+ }];
3772
+ } else {
3773
+ r.ui = [{
3774
+ type: "tgroup",
3775
+ label: "Polyphonic",
3776
+ items: [
3777
+ { type: "vgroup", label: "Voices", items: o.ui }
3778
+ ]
3779
+ }];
3780
+ }
3781
+ return r;
3782
+ }
3783
+ getJSON() {
3784
+ return JSON.stringify(this.getMeta());
3785
+ }
3786
+ getUI() {
3787
+ return this.getMeta().ui;
3788
+ }
3750
3789
  };
3751
3790
  var FaustPolyDspGenerator = _FaustPolyDspGenerator;
3752
3791
  FaustPolyDspGenerator.gWorkletProcessors = /* @__PURE__ */ new Map();