@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;
@@ -2277,7 +2277,7 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
2277
2277
  for (const soundfileId of soundfileIdList) {
2278
2278
  let chan = 0;
2279
2279
  let len = 0;
2280
- const audioData = soundfiles[soundfileId];
2280
+ const audioData = soundfiles == null ? void 0 : soundfiles[soundfileId];
2281
2281
  if (audioData) {
2282
2282
  chan = audioData.audioBuffer.length;
2283
2283
  len = audioData.audioBuffer[0].length;
@@ -2293,7 +2293,7 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
2293
2293
  let offset = 0;
2294
2294
  for (let part = 0; part < soundfileIdList.length; part++) {
2295
2295
  const soundfileId = soundfileIdList[part];
2296
- const audioData = soundfiles[soundfileId];
2296
+ const audioData = soundfiles == null ? void 0 : soundfiles[soundfileId];
2297
2297
  if (audioData) {
2298
2298
  soundfile.copyToOut(part, maxChan, offset, audioData);
2299
2299
  offset += audioData.audioBuffer[0].length;
@@ -3693,7 +3693,7 @@ var SoundfileReader = class {
3693
3693
  * @param audioCtx : the audio context
3694
3694
  */
3695
3695
  static async loadSoundfile(filename, metaUrls, soundfiles, audioCtx) {
3696
- if (soundfiles[filename]) return;
3696
+ if (soundfiles == null ? void 0 : soundfiles[filename]) return;
3697
3697
  const urlsToCheck = [filename, ...[...metaUrls, ...this.fallbackPaths].map((path) => new URL(filename, path.endsWith("/") ? path : `${path}/`).href)];
3698
3698
  const checkResults = await Promise.all(urlsToCheck.map((url) => this.checkFileExists(url)));
3699
3699
  const successIndex = checkResults.findIndex((r) => !!r);
@@ -3712,7 +3712,7 @@ var SoundfileReader = class {
3712
3712
  const metaUrls = FaustBaseWebAudioDsp.extractUrlsFromMeta(dspMeta);
3713
3713
  const soundfiles = this.findSoundfilesFromMeta(dspMeta);
3714
3714
  for (const id in soundfiles) {
3715
- if (soundfilesIn[id]) {
3715
+ if (soundfilesIn == null ? void 0 : soundfilesIn[id]) {
3716
3716
  soundfiles[id] = soundfilesIn[id];
3717
3717
  continue;
3718
3718
  }
@@ -4314,6 +4314,7 @@ var _FaustMonoDspGenerator = class _FaustMonoDspGenerator {
4314
4314
  if (!this.factory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
4315
4315
  const meta = JSON.parse(this.factory.json);
4316
4316
  const map = SoundfileReader_default.findSoundfilesFromMeta(meta);
4317
+ if (!map) return [];
4317
4318
  return Object.keys(map);
4318
4319
  }
4319
4320
  async createNode(context, name = this.name, factory = this.factory, sp = false, bufferSize = 1024, processorName = (factory == null ? void 0 : factory.shaKey) || name, processorOptions = {}) {
@@ -4584,6 +4585,7 @@ process = adaptorIns(dsp_code.process) : dsp_code.effect : adaptorOuts;
4584
4585
  if (!this.voiceFactory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
4585
4586
  const meta = JSON.parse(this.voiceFactory.json);
4586
4587
  const map = SoundfileReader_default.findSoundfilesFromMeta(meta);
4588
+ if (!map) return [];
4587
4589
  if (!this.effectFactory) return Object.keys(map);
4588
4590
  const effectMeta = JSON.parse(this.effectFactory.json);
4589
4591
  const effectMap = SoundfileReader_default.findSoundfilesFromMeta(effectMeta);