@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;
@@ -8065,7 +8065,7 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8065
8065
  for (const soundfileId of soundfileIdList) {
8066
8066
  let chan = 0;
8067
8067
  let len = 0;
8068
- const audioData = soundfiles[soundfileId];
8068
+ const audioData = soundfiles == null ? void 0 : soundfiles[soundfileId];
8069
8069
  if (audioData) {
8070
8070
  chan = audioData.audioBuffer.length;
8071
8071
  len = audioData.audioBuffer[0].length;
@@ -8081,7 +8081,7 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8081
8081
  let offset = 0;
8082
8082
  for (let part = 0; part < soundfileIdList.length; part++) {
8083
8083
  const soundfileId = soundfileIdList[part];
8084
- const audioData = soundfiles[soundfileId];
8084
+ const audioData = soundfiles == null ? void 0 : soundfiles[soundfileId];
8085
8085
  if (audioData) {
8086
8086
  soundfile.copyToOut(part, maxChan, offset, audioData);
8087
8087
  offset += audioData.audioBuffer[0].length;
@@ -9481,7 +9481,7 @@ var SoundfileReader = class {
9481
9481
  * @param audioCtx : the audio context
9482
9482
  */
9483
9483
  static async loadSoundfile(filename, metaUrls, soundfiles, audioCtx) {
9484
- if (soundfiles[filename]) return;
9484
+ if (soundfiles == null ? void 0 : soundfiles[filename]) return;
9485
9485
  const urlsToCheck = [filename, ...[...metaUrls, ...this.fallbackPaths].map((path) => new URL(filename, path.endsWith("/") ? path : `${path}/`).href)];
9486
9486
  const checkResults = await Promise.all(urlsToCheck.map((url) => this.checkFileExists(url)));
9487
9487
  const successIndex = checkResults.findIndex((r) => !!r);
@@ -9500,7 +9500,7 @@ var SoundfileReader = class {
9500
9500
  const metaUrls = FaustBaseWebAudioDsp.extractUrlsFromMeta(dspMeta);
9501
9501
  const soundfiles = this.findSoundfilesFromMeta(dspMeta);
9502
9502
  for (const id in soundfiles) {
9503
- if (soundfilesIn[id]) {
9503
+ if (soundfilesIn == null ? void 0 : soundfilesIn[id]) {
9504
9504
  soundfiles[id] = soundfilesIn[id];
9505
9505
  continue;
9506
9506
  }
@@ -10102,6 +10102,7 @@ var _FaustMonoDspGenerator = class _FaustMonoDspGenerator {
10102
10102
  if (!this.factory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10103
10103
  const meta = JSON.parse(this.factory.json);
10104
10104
  const map = SoundfileReader_default.findSoundfilesFromMeta(meta);
10105
+ if (!map) return [];
10105
10106
  return Object.keys(map);
10106
10107
  }
10107
10108
  async createNode(context, name = this.name, factory = this.factory, sp = false, bufferSize = 1024, processorName = (factory == null ? void 0 : factory.shaKey) || name, processorOptions = {}) {
@@ -10372,6 +10373,7 @@ process = adaptorIns(dsp_code.process) : dsp_code.effect : adaptorOuts;
10372
10373
  if (!this.voiceFactory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10373
10374
  const meta = JSON.parse(this.voiceFactory.json);
10374
10375
  const map = SoundfileReader_default.findSoundfilesFromMeta(meta);
10376
+ if (!map) return [];
10375
10377
  if (!this.effectFactory) return Object.keys(map);
10376
10378
  const effectMeta = JSON.parse(this.effectFactory.json);
10377
10379
  const effectMap = SoundfileReader_default.findSoundfilesFromMeta(effectMeta);