@grame/faustwasm 0.13.2 → 0.13.4
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.
- package/assets/standalone/faustwasm/index.js +18 -34
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/dist/cjs/index.js +18 -34
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.js +18 -34
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.js +18 -34
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.js +18 -34
- package/dist/esm-bundle/index.js.map +2 -2
- package/package.json +1 -1
- package/scripts/faust2sndfile.js +0 -0
- package/scripts/faust2svg.js +0 -0
- package/scripts/faust2wasm.js +0 -0
- package/src/FaustDspGenerator.ts +33 -48
- package/test/faustlive-wasm/faustwasm/index.js +18 -34
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
- package/test/web/create-faust-node.js +4 -3
package/package.json
CHANGED
package/scripts/faust2sndfile.js
CHANGED
|
File without changes
|
package/scripts/faust2svg.js
CHANGED
|
File without changes
|
package/scripts/faust2wasm.js
CHANGED
|
File without changes
|
package/src/FaustDspGenerator.ts
CHANGED
|
@@ -741,7 +741,13 @@ process = adaptorIns(dsp_code.process) : dsp_code.effect : adaptorOuts;
|
|
|
741
741
|
}
|
|
742
742
|
}
|
|
743
743
|
} catch (e) {
|
|
744
|
-
|
|
744
|
+
// Hack to detect 'undefined effect' symbol error, when no effect is defined in the polyphonic code.
|
|
745
|
+
// The error message is not printed to avoid confusing the user.
|
|
746
|
+
const errorMessage =
|
|
747
|
+
e instanceof Error ? e.message : String(e ?? 'unknown error');
|
|
748
|
+
if (!errorMessage.includes('undefined symbol : effect')) {
|
|
749
|
+
console.warn(e);
|
|
750
|
+
}
|
|
745
751
|
this.voiceFactory = await compiler.createPolyDSPFactory(
|
|
746
752
|
name,
|
|
747
753
|
dspCodeAux,
|
|
@@ -1123,53 +1129,32 @@ export class FaustDspGenerator implements IFaustDspGenerator {
|
|
|
1123
1129
|
): Promise<IFaustMonoWebAudioNode | IFaustPolyWebAudioNode | null> {
|
|
1124
1130
|
const getCompiler = async () => {
|
|
1125
1131
|
if (!FaustDspGenerator.compilerPromise) {
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
.src
|
|
1153
|
-
: document.baseURI)
|
|
1154
|
-
: undefined) ||
|
|
1155
|
-
(typeof window !== 'undefined'
|
|
1156
|
-
? window.location.href
|
|
1157
|
-
: undefined);
|
|
1158
|
-
if (!baseURL)
|
|
1159
|
-
throw new Error('Cannot resolve libfaust-wasm location.');
|
|
1160
|
-
const jsURL = new URL(
|
|
1161
|
-
'../libfaust-wasm/libfaust-wasm.js',
|
|
1162
|
-
baseURL
|
|
1163
|
-
).href;
|
|
1164
|
-
const dataURL = jsURL.replace(/c?js$/, 'data');
|
|
1165
|
-
const wasmURL = jsURL.replace(/c?js$/, 'wasm');
|
|
1166
|
-
FaustDspGenerator.compilerPromise =
|
|
1167
|
-
instantiateFaustModuleFromFile(
|
|
1168
|
-
jsURL,
|
|
1169
|
-
dataURL,
|
|
1170
|
-
wasmURL
|
|
1171
|
-
).then((module) => new FaustCompiler(new LibFaust(module)));
|
|
1172
|
-
}
|
|
1132
|
+
// Resolve libfaust-wasm assets relative to current script/page location (works in browser and bundlers).
|
|
1133
|
+
// Falling back to document/baseURI keeps things working when import.meta.url is unavailable (es2019 target).
|
|
1134
|
+
const baseURL =
|
|
1135
|
+
(typeof document !== 'undefined'
|
|
1136
|
+
? ('src' in (document.currentScript || {})
|
|
1137
|
+
? (document.currentScript as HTMLScriptElement)
|
|
1138
|
+
.src
|
|
1139
|
+
: document.baseURI)
|
|
1140
|
+
: undefined) ||
|
|
1141
|
+
(typeof window !== 'undefined'
|
|
1142
|
+
? window.location.href
|
|
1143
|
+
: undefined);
|
|
1144
|
+
if (!baseURL)
|
|
1145
|
+
throw new Error('Cannot resolve libfaust-wasm location.');
|
|
1146
|
+
const jsURL = new URL(
|
|
1147
|
+
'../libfaust-wasm/libfaust-wasm.js',
|
|
1148
|
+
baseURL
|
|
1149
|
+
).href;
|
|
1150
|
+
const dataURL = jsURL.replace(/c?js$/, 'data');
|
|
1151
|
+
const wasmURL = jsURL.replace(/c?js$/, 'wasm');
|
|
1152
|
+
FaustDspGenerator.compilerPromise =
|
|
1153
|
+
instantiateFaustModuleFromFile(
|
|
1154
|
+
jsURL,
|
|
1155
|
+
dataURL,
|
|
1156
|
+
wasmURL
|
|
1157
|
+
).then((module) => new FaustCompiler(new LibFaust(module)));
|
|
1173
1158
|
}
|
|
1174
1159
|
return FaustDspGenerator.compilerPromise;
|
|
1175
1160
|
};
|
|
@@ -5192,7 +5192,6 @@ var FaustPolyScriptProcessorNode = class extends FaustScriptProcessorNode {
|
|
|
5192
5192
|
};
|
|
5193
5193
|
|
|
5194
5194
|
// src/FaustDspGenerator.ts
|
|
5195
|
-
var import_meta = {};
|
|
5196
5195
|
var _FaustMonoDspGenerator = class _FaustMonoDspGenerator {
|
|
5197
5196
|
constructor() {
|
|
5198
5197
|
this.factory = null;
|
|
@@ -5549,7 +5548,10 @@ process = adaptorIns(dsp_code.process) : dsp_code.effect : adaptorOuts;
|
|
|
5549
5548
|
}
|
|
5550
5549
|
}
|
|
5551
5550
|
} catch (e) {
|
|
5552
|
-
|
|
5551
|
+
const errorMessage = e instanceof Error ? e.message : String(e != null ? e : "unknown error");
|
|
5552
|
+
if (!errorMessage.includes("undefined symbol : effect")) {
|
|
5553
|
+
console.warn(e);
|
|
5554
|
+
}
|
|
5553
5555
|
this.voiceFactory = await compiler.createPolyDSPFactory(
|
|
5554
5556
|
name,
|
|
5555
5557
|
dspCodeAux,
|
|
@@ -5841,38 +5843,20 @@ var _FaustDspGenerator = class _FaustDspGenerator {
|
|
|
5841
5843
|
async createFaustNode(context, name, code, sp, bufferSize) {
|
|
5842
5844
|
const getCompiler = async () => {
|
|
5843
5845
|
if (!_FaustDspGenerator.compilerPromise) {
|
|
5844
|
-
const
|
|
5845
|
-
if (
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
wasmURL
|
|
5859
|
-
).then((module) => new FaustCompiler_default(new LibFaust_default(module)));
|
|
5860
|
-
} else {
|
|
5861
|
-
const baseURL = (typeof document !== "undefined" ? "src" in (document.currentScript || {}) ? document.currentScript.src : document.baseURI : void 0) || (typeof window !== "undefined" ? window.location.href : void 0);
|
|
5862
|
-
if (!baseURL)
|
|
5863
|
-
throw new Error("Cannot resolve libfaust-wasm location.");
|
|
5864
|
-
const jsURL = new URL(
|
|
5865
|
-
"../libfaust-wasm/libfaust-wasm.js",
|
|
5866
|
-
baseURL
|
|
5867
|
-
).href;
|
|
5868
|
-
const dataURL = jsURL.replace(/c?js$/, "data");
|
|
5869
|
-
const wasmURL = jsURL.replace(/c?js$/, "wasm");
|
|
5870
|
-
_FaustDspGenerator.compilerPromise = instantiateFaustModuleFromFile_default(
|
|
5871
|
-
jsURL,
|
|
5872
|
-
dataURL,
|
|
5873
|
-
wasmURL
|
|
5874
|
-
).then((module) => new FaustCompiler_default(new LibFaust_default(module)));
|
|
5875
|
-
}
|
|
5846
|
+
const baseURL = (typeof document !== "undefined" ? "src" in (document.currentScript || {}) ? document.currentScript.src : document.baseURI : void 0) || (typeof window !== "undefined" ? window.location.href : void 0);
|
|
5847
|
+
if (!baseURL)
|
|
5848
|
+
throw new Error("Cannot resolve libfaust-wasm location.");
|
|
5849
|
+
const jsURL = new URL(
|
|
5850
|
+
"../libfaust-wasm/libfaust-wasm.js",
|
|
5851
|
+
baseURL
|
|
5852
|
+
).href;
|
|
5853
|
+
const dataURL = jsURL.replace(/c?js$/, "data");
|
|
5854
|
+
const wasmURL = jsURL.replace(/c?js$/, "wasm");
|
|
5855
|
+
_FaustDspGenerator.compilerPromise = instantiateFaustModuleFromFile_default(
|
|
5856
|
+
jsURL,
|
|
5857
|
+
dataURL,
|
|
5858
|
+
wasmURL
|
|
5859
|
+
).then((module) => new FaustCompiler_default(new LibFaust_default(module)));
|
|
5876
5860
|
}
|
|
5877
5861
|
return _FaustDspGenerator.compilerPromise;
|
|
5878
5862
|
};
|