@grame/faustwasm 0.12.1 → 0.12.2

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.
Files changed (40) hide show
  1. package/assets/standalone/faustwasm/index.d.ts +1 -1
  2. package/assets/standalone/faustwasm/index.js +6 -4
  3. package/assets/standalone/faustwasm/index.js.map +2 -2
  4. package/dist/cjs/index.d.ts +1 -1
  5. package/dist/cjs/index.js +6 -4
  6. package/dist/cjs/index.js.map +2 -2
  7. package/dist/cjs-bundle/index.d.ts +1 -1
  8. package/dist/cjs-bundle/index.js +6 -4
  9. package/dist/cjs-bundle/index.js.map +2 -2
  10. package/dist/esm/index.d.ts +1 -1
  11. package/dist/esm/index.js +6 -4
  12. package/dist/esm/index.js.map +2 -2
  13. package/dist/esm-bundle/index.d.ts +1 -1
  14. package/dist/esm-bundle/index.js +6 -4
  15. package/dist/esm-bundle/index.js.map +2 -2
  16. package/package.json +1 -1
  17. package/src/FaustDspGenerator.ts +2 -1
  18. package/src/FaustWebAudioDsp.ts +2 -2
  19. package/src/SoundfileReader.ts +3 -3
  20. package/src/types.ts +1 -1
  21. package/test/faustlive-wasm/faustwasm/index.d.ts +1 -1
  22. package/test/faustlive-wasm/faustwasm/index.js +6 -4
  23. package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
  24. package/test/organ/create-node.js +252 -0
  25. package/test/organ/dsp-meta.json +131 -0
  26. package/test/organ/dsp-module.wasm +0 -0
  27. package/test/organ/faust-pwa.js +344 -0
  28. package/test/organ/faust-ui/index.css +442 -0
  29. package/test/organ/faust-ui/index.css.map +1 -0
  30. package/test/organ/faust-ui/index.d.ts +1 -0
  31. package/test/organ/faust-ui/index.js +3756 -0
  32. package/test/organ/faust-ui/index.js.map +1 -0
  33. package/test/organ/faustwasm/index.d.ts +1705 -0
  34. package/test/organ/faustwasm/index.js +4773 -0
  35. package/test/organ/faustwasm/index.js.map +7 -0
  36. package/test/organ/icon.png +0 -0
  37. package/test/organ/index.html +76 -0
  38. package/test/organ/index.js +69 -0
  39. package/test/organ/manifest.json +17 -0
  40. package/test/organ/service-worker.js +165 -0
@@ -110,7 +110,7 @@ export interface LooseFaustDspFactory {
110
110
  /** a unique identifier */
111
111
  shaKey?: string;
112
112
  /** a map of transferable audio buffers for the `soundfile` function */
113
- soundfiles: Record<string, (AudioData$1 | null)>;
113
+ soundfiles?: Record<string, AudioData$1 | null>;
114
114
  }
115
115
  export interface FaustDspMeta {
116
116
  name: string;
@@ -8110,7 +8110,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
8110
8110
  for (const soundfileId of soundfileIdList) {
8111
8111
  let chan = 0;
8112
8112
  let len = 0;
8113
- const audioData = soundfiles[soundfileId];
8113
+ const audioData = soundfiles == null ? void 0 : soundfiles[soundfileId];
8114
8114
  if (audioData) {
8115
8115
  chan = audioData.audioBuffer.length;
8116
8116
  len = audioData.audioBuffer[0].length;
@@ -8126,7 +8126,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
8126
8126
  let offset = 0;
8127
8127
  for (let part = 0; part < soundfileIdList.length; part++) {
8128
8128
  const soundfileId = soundfileIdList[part];
8129
- const audioData = soundfiles[soundfileId];
8129
+ const audioData = soundfiles == null ? void 0 : soundfiles[soundfileId];
8130
8130
  if (audioData) {
8131
8131
  soundfile.copyToOut(part, maxChan, offset, audioData);
8132
8132
  offset += audioData.audioBuffer[0].length;
@@ -9526,7 +9526,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
9526
9526
  * @param audioCtx : the audio context
9527
9527
  */
9528
9528
  static async loadSoundfile(filename, metaUrls, soundfiles, audioCtx) {
9529
- if (soundfiles[filename]) return;
9529
+ if (soundfiles == null ? void 0 : soundfiles[filename]) return;
9530
9530
  const urlsToCheck = [filename, ...[...metaUrls, ...this.fallbackPaths].map((path) => new URL(filename, path.endsWith("/") ? path : `${path}/`).href)];
9531
9531
  const checkResults = await Promise.all(urlsToCheck.map((url) => this.checkFileExists(url)));
9532
9532
  const successIndex = checkResults.findIndex((r) => !!r);
@@ -9545,7 +9545,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
9545
9545
  const metaUrls = FaustBaseWebAudioDsp.extractUrlsFromMeta(dspMeta);
9546
9546
  const soundfiles = this.findSoundfilesFromMeta(dspMeta);
9547
9547
  for (const id in soundfiles) {
9548
- if (soundfilesIn[id]) {
9548
+ if (soundfilesIn == null ? void 0 : soundfilesIn[id]) {
9549
9549
  soundfiles[id] = soundfilesIn[id];
9550
9550
  continue;
9551
9551
  }
@@ -10147,6 +10147,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
10147
10147
  if (!this.factory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10148
10148
  const meta = JSON.parse(this.factory.json);
10149
10149
  const map = SoundfileReader_default.findSoundfilesFromMeta(meta);
10150
+ if (!map) return [];
10150
10151
  return Object.keys(map);
10151
10152
  }
10152
10153
  async createNode(context, name = this.name, factory = this.factory, sp = false, bufferSize = 1024, processorName = (factory == null ? void 0 : factory.shaKey) || name, processorOptions = {}) {
@@ -10417,6 +10418,7 @@ process = adaptorIns(dsp_code.process) : dsp_code.effect : adaptorOuts;
10417
10418
  if (!this.voiceFactory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10418
10419
  const meta = JSON.parse(this.voiceFactory.json);
10419
10420
  const map = SoundfileReader_default.findSoundfilesFromMeta(meta);
10421
+ if (!map) return [];
10420
10422
  if (!this.effectFactory) return Object.keys(map);
10421
10423
  const effectMeta = JSON.parse(this.effectFactory.json);
10422
10424
  const effectMap = SoundfileReader_default.findSoundfilesFromMeta(effectMeta);