@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;
package/dist/cjs/index.js CHANGED
@@ -2306,7 +2306,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
2306
2306
  for (const soundfileId of soundfileIdList) {
2307
2307
  let chan = 0;
2308
2308
  let len = 0;
2309
- const audioData = soundfiles[soundfileId];
2309
+ const audioData = soundfiles == null ? void 0 : soundfiles[soundfileId];
2310
2310
  if (audioData) {
2311
2311
  chan = audioData.audioBuffer.length;
2312
2312
  len = audioData.audioBuffer[0].length;
@@ -2322,7 +2322,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
2322
2322
  let offset = 0;
2323
2323
  for (let part = 0; part < soundfileIdList.length; part++) {
2324
2324
  const soundfileId = soundfileIdList[part];
2325
- const audioData = soundfiles[soundfileId];
2325
+ const audioData = soundfiles == null ? void 0 : soundfiles[soundfileId];
2326
2326
  if (audioData) {
2327
2327
  soundfile.copyToOut(part, maxChan, offset, audioData);
2328
2328
  offset += audioData.audioBuffer[0].length;
@@ -3722,7 +3722,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
3722
3722
  * @param audioCtx : the audio context
3723
3723
  */
3724
3724
  static async loadSoundfile(filename, metaUrls, soundfiles, audioCtx) {
3725
- if (soundfiles[filename]) return;
3725
+ if (soundfiles == null ? void 0 : soundfiles[filename]) return;
3726
3726
  const urlsToCheck = [filename, ...[...metaUrls, ...this.fallbackPaths].map((path) => new URL(filename, path.endsWith("/") ? path : `${path}/`).href)];
3727
3727
  const checkResults = await Promise.all(urlsToCheck.map((url) => this.checkFileExists(url)));
3728
3728
  const successIndex = checkResults.findIndex((r) => !!r);
@@ -3741,7 +3741,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
3741
3741
  const metaUrls = FaustBaseWebAudioDsp.extractUrlsFromMeta(dspMeta);
3742
3742
  const soundfiles = this.findSoundfilesFromMeta(dspMeta);
3743
3743
  for (const id in soundfiles) {
3744
- if (soundfilesIn[id]) {
3744
+ if (soundfilesIn == null ? void 0 : soundfilesIn[id]) {
3745
3745
  soundfiles[id] = soundfilesIn[id];
3746
3746
  continue;
3747
3747
  }
@@ -4343,6 +4343,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
4343
4343
  if (!this.factory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
4344
4344
  const meta = JSON.parse(this.factory.json);
4345
4345
  const map = SoundfileReader_default.findSoundfilesFromMeta(meta);
4346
+ if (!map) return [];
4346
4347
  return Object.keys(map);
4347
4348
  }
4348
4349
  async createNode(context, name = this.name, factory = this.factory, sp = false, bufferSize = 1024, processorName = (factory == null ? void 0 : factory.shaKey) || name, processorOptions = {}) {
@@ -4613,6 +4614,7 @@ process = adaptorIns(dsp_code.process) : dsp_code.effect : adaptorOuts;
4613
4614
  if (!this.voiceFactory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
4614
4615
  const meta = JSON.parse(this.voiceFactory.json);
4615
4616
  const map = SoundfileReader_default.findSoundfilesFromMeta(meta);
4617
+ if (!map) return [];
4616
4618
  if (!this.effectFactory) return Object.keys(map);
4617
4619
  const effectMeta = JSON.parse(this.effectFactory.json);
4618
4620
  const effectMap = SoundfileReader_default.findSoundfilesFromMeta(effectMeta);