@grame/faustwasm 0.16.6 → 0.16.7

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.
@@ -5969,13 +5969,27 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
5969
5969
  }
5970
5970
  static get parameterDescriptors() {
5971
5971
  const params = [];
5972
- const callback = (item) => {
5972
+ const origin = /* @__PURE__ */ new Map();
5973
+ const collect = (side) => (item) => {
5973
5974
  const param = analysePolyParameters(item);
5974
- if (param) params.push(param);
5975
+ if (!param) return;
5976
+ const previous = origin.get(param.name);
5977
+ if (previous === side) {
5978
+ throw new Error(
5979
+ `Faust: control "${param.name}" is declared twice in the ${side}. Two widgets resolved to the same path, so one of them would be unreachable. Give them distinct labels or groups.`
5980
+ );
5981
+ }
5982
+ if (previous !== void 0) {
5983
+ throw new Error(
5984
+ `Faust: control "${param.name}" is declared both in the ${previous} and in the ${side}. A polyphonic DSP cannot share a control path between \`process\` and \`effect\`: setParamValue routes a path to one side only, so the other would keep its default. Declare it under a distinct path on each side and have the host write both.`
5985
+ );
5986
+ }
5987
+ origin.set(param.name, side);
5988
+ params.push(param);
5975
5989
  };
5976
- FaustBaseWebAudioDsp2.parseUI(dspMeta.ui, callback);
5990
+ FaustBaseWebAudioDsp2.parseUI(dspMeta.ui, collect("voice"));
5977
5991
  if (effectMeta)
5978
- FaustBaseWebAudioDsp2.parseUI(effectMeta.ui, callback);
5992
+ FaustBaseWebAudioDsp2.parseUI(effectMeta.ui, collect("effect"));
5979
5993
  return params;
5980
5994
  }
5981
5995
  setupWamEventHandler() {
@@ -6233,13 +6247,14 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
6233
6247
  }
6234
6248
  const Processor = poly ? FaustPolyAudioWorkletProcessor : FaustMonoAudioWorkletProcessor;
6235
6249
  if (register) {
6236
- try {
6237
- registerProcessor(
6238
- processorName || dspName || (poly ? "mydsp_poly" : "mydsp"),
6239
- Processor
6240
- );
6241
- } catch (error) {
6242
- console.warn(error);
6250
+ const name = processorName || dspName || (poly ? "mydsp_poly" : "mydsp");
6251
+ const scope = globalThis;
6252
+ if (!scope.__faustRegisteredProcessors) {
6253
+ scope.__faustRegisteredProcessors = /* @__PURE__ */ new Set();
6254
+ }
6255
+ if (!scope.__faustRegisteredProcessors.has(name)) {
6256
+ registerProcessor(name, Processor);
6257
+ scope.__faustRegisteredProcessors.add(name);
6243
6258
  }
6244
6259
  }
6245
6260
  return poly ? FaustPolyAudioWorkletProcessor : FaustMonoAudioWorkletProcessor;
@@ -6780,13 +6795,14 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
6780
6795
  }
6781
6796
  const Processor = FaustFFTAudioWorkletProcessor;
6782
6797
  if (register) {
6783
- try {
6784
- registerProcessor(
6785
- processorName || dspName || "myfftdsp",
6786
- Processor
6787
- );
6788
- } catch (error) {
6789
- console.warn(error);
6798
+ const name = processorName || dspName || "myfftdsp";
6799
+ const scope = globalThis;
6800
+ if (!scope.__faustRegisteredProcessors) {
6801
+ scope.__faustRegisteredProcessors = /* @__PURE__ */ new Set();
6802
+ }
6803
+ if (!scope.__faustRegisteredProcessors.has(name)) {
6804
+ registerProcessor(name, Processor);
6805
+ scope.__faustRegisteredProcessors.add(name);
6790
6806
  }
6791
6807
  }
6792
6808
  return FaustFFTAudioWorkletProcessor;
@@ -11776,17 +11792,24 @@ const dependencies = {
11776
11792
  throw e;
11777
11793
  }
11778
11794
  }
11779
- const node = new FaustPolyAudioWorkletNode(context, {
11780
- processorOptions: {
11781
- name: processorName,
11782
- voiceFactory,
11783
- mixerModule,
11784
- voices,
11785
- sampleSize,
11786
- effectFactory: effectFactory || void 0,
11787
- ...processorOptions
11788
- }
11789
- });
11795
+ let node;
11796
+ try {
11797
+ node = new FaustPolyAudioWorkletNode(context, {
11798
+ processorOptions: {
11799
+ name: processorName,
11800
+ voiceFactory,
11801
+ mixerModule,
11802
+ voices,
11803
+ sampleSize,
11804
+ effectFactory: effectFactory || void 0,
11805
+ ...processorOptions
11806
+ }
11807
+ });
11808
+ } catch (error) {
11809
+ throw new Error(
11810
+ `Faust: the AudioWorkletProcessor "${processorName}" did not register. The module loaded, so the failure happened inside registerProcessor \u2014 its error is reported in the AudioWorklet scope and appears in the browser console above this one. A duplicate control path shared between \`process\` and \`effect\` is the usual cause. Original error: ${error instanceof Error ? error.message : String(error)}`
11811
+ );
11812
+ }
11790
11813
  return node;
11791
11814
  }
11792
11815
  }