@grame/faustwasm 0.0.57 → 0.0.59
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/0001-Rework-polyphonic-effect-mode.patch +122 -0
- package/assets/standalone/faustwasm/index.d.ts +1 -1
- package/assets/standalone/faustwasm/index.js +63 -21
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/assets/standalone/index-poly.js +2 -1
- package/assets/standalone/index.js +2 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +63 -21
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.d.ts +1 -1
- package/dist/cjs-bundle/index.js +63 -21
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +63 -21
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.d.ts +1 -1
- package/dist/esm-bundle/index.js +63 -21
- package/dist/esm-bundle/index.js.map +2 -2
- package/package.json +1 -1
- package/src/FaustDspGenerator.ts +70 -23
- package/src/faust2wasmFiles.js +1 -1
- package/test/bug/bug.html +84 -0
- package/test/bug/bug.js +216 -0
- package/test/bug/bug.json +124 -0
- package/test/bug/bug.wasm +0 -0
- package/test/bug/bug_effect.json +95 -0
- package/test/bug/bug_effect.wasm +0 -0
- package/test/bug/faust-ui/index.css +416 -0
- package/test/bug/faust-ui/index.css.map +1 -0
- package/test/bug/faust-ui/index.d.ts +1 -0
- package/test/bug/faust-ui/index.js +3476 -0
- package/test/bug/faust-ui/index.js.map +1 -0
- package/test/bug/faustwasm/index.d.ts +1294 -0
- package/test/bug/faustwasm/index.js +3874 -0
- package/test/bug/faustwasm/index.js.map +7 -0
- package/test/bug/mixerModule.wasm +0 -0
- package/test/bug.dsp +22 -0
- package/test/clarinet.dsp +2 -1
- package/test/{p-dj.dsp → djembe.dsp} +0 -2
- package/test/faustlive-wasm/faustwasm/index.d.ts +1 -1
- package/test/faustlive-wasm/faustwasm/index.js +63 -21
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
- package/test/gain.dsp +2 -0
- package/test/guitar.dsp +2 -1
- package/test/guitar1.dsp +2 -1
- package/test/libfaust-in-worklet/index.js +33 -33
- package/test/midi.dsp +0 -1
- package/test/web/index.js +217 -217
- package/test/Sinusoide.dsp +0 -60
- package/test/t1.dsp +0 -1
|
@@ -1285,7 +1285,7 @@ export declare class FaustPolyDspGenerator implements IFaustPolyDspGenerator {
|
|
|
1285
1285
|
mixerBuffer: Uint8Array;
|
|
1286
1286
|
mixerModule: WebAssembly.Module;
|
|
1287
1287
|
constructor();
|
|
1288
|
-
compile(compiler: IFaustCompiler, name: string,
|
|
1288
|
+
compile(compiler: IFaustCompiler, name: string, dspCodeAux: string, args: string, effectCodeAux?: string): Promise<this | null>;
|
|
1289
1289
|
createNode<SP extends boolean = false>(context: BaseAudioContext, voices: number, name?: string, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null, sp?: SP, bufferSize?: number, processorName?: string): Promise<SP extends true ? FaustPolyScriptProcessorNode | null : FaustPolyAudioWorkletNode | null>;
|
|
1290
1290
|
createAudioWorkletProcessor(name?: string, voiceFactory?: LooseFaustDspFactory, effectFactory?: LooseFaustDspFactory | null, processorName?: string): Promise<{
|
|
1291
1291
|
new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
|
package/dist/esm-bundle/index.js
CHANGED
|
@@ -9624,31 +9624,73 @@ var _FaustPolyDspGenerator = class {
|
|
|
9624
9624
|
this.voiceFactory = null;
|
|
9625
9625
|
this.effectFactory = null;
|
|
9626
9626
|
}
|
|
9627
|
-
async compile(compiler, name,
|
|
9628
|
-
|
|
9629
|
-
adapt(2,2) = _,_;
|
|
9630
|
-
adapt(1,2) = _ <: _,_;
|
|
9631
|
-
adapt(2,1) = _,_ :> _;
|
|
9632
|
-
adaptor(F,G) = adapt(outputs(F),inputs(G));
|
|
9633
|
-
dsp_code = environment{
|
|
9634
|
-
${dspCode}
|
|
9627
|
+
async compile(compiler, name, dspCodeAux, args, effectCodeAux = `dsp_code = environment{
|
|
9628
|
+
${dspCodeAux}
|
|
9635
9629
|
};
|
|
9636
|
-
process =
|
|
9637
|
-
this.voiceFactory = await compiler.createPolyDSPFactory(name, dspCode, args);
|
|
9638
|
-
if (!this.voiceFactory)
|
|
9639
|
-
return null;
|
|
9630
|
+
process = dsp_code.effect;`) {
|
|
9640
9631
|
try {
|
|
9641
|
-
this.effectFactory = await compiler.createPolyDSPFactory(name,
|
|
9632
|
+
this.effectFactory = await compiler.createPolyDSPFactory(name, effectCodeAux, args);
|
|
9633
|
+
if (this.effectFactory) {
|
|
9634
|
+
const effectJSON = JSON.parse(this.effectFactory.json);
|
|
9635
|
+
const dspCode = `
|
|
9636
|
+
// Voice output is forced to 2, when DSP is stereo or effect has 2 ins or 2 outs,
|
|
9637
|
+
// so that the effect can process the 2 channels of the voice
|
|
9638
|
+
adaptOut(1,1,1) = _;
|
|
9639
|
+
adaptOut(1,1,2) = _ <: _,_;
|
|
9640
|
+
adaptOut(1,2,1) = _ <: _,_;
|
|
9641
|
+
adaptOut(1,2,2) = _ <: _,_;
|
|
9642
|
+
adaptOut(2,1,1) = _,_;
|
|
9643
|
+
adaptOut(2,1,2) = _,_;
|
|
9644
|
+
adaptOut(2,2,1) = _,_;
|
|
9645
|
+
adaptOut(2,2,2) = _,_;
|
|
9646
|
+
adaptor(F) = adaptOut(outputs(F),${effectJSON.inputs},${effectJSON.outputs});
|
|
9647
|
+
dsp_code = environment{
|
|
9648
|
+
${dspCodeAux}
|
|
9649
|
+
};
|
|
9650
|
+
process = dsp_code.process : adaptor(dsp_code.process);`;
|
|
9651
|
+
const effectCode = `
|
|
9652
|
+
// Inputs
|
|
9653
|
+
adaptIn(1,1,1) = _;
|
|
9654
|
+
adaptIn(1,1,2) = _,*(0) :> _; // The voice output was duplicated, so only one channel has to be kept
|
|
9655
|
+
adaptIn(1,2,1) = _,_;
|
|
9656
|
+
adaptIn(1,2,2) = _,_;
|
|
9657
|
+
adaptIn(2,1,1) = _,_ :> _;
|
|
9658
|
+
adaptIn(2,1,2) = _,_ :> _;
|
|
9659
|
+
adaptIn(2,2,1) = _,_;
|
|
9660
|
+
adaptIn(2,2,2) = _,_;
|
|
9661
|
+
// Outputs
|
|
9662
|
+
adaptOut(1,1) = _ <: _,*(0); // The left channel is kept, but the right one has to be cleared
|
|
9663
|
+
adaptOut(1,2) = _,_;
|
|
9664
|
+
adaptOut(2,1) = _ <: _,*(0); // The left channel is kept, but the right one has to be cleared
|
|
9665
|
+
adaptOut(2,2) = _,_;
|
|
9666
|
+
adaptorIns(F) = adaptIn(outputs(F),${effectJSON.inputs},${effectJSON.outputs});
|
|
9667
|
+
adaptorOuts = adaptOut(${effectJSON.inputs},${effectJSON.outputs});
|
|
9668
|
+
dsp_code = environment{
|
|
9669
|
+
${dspCodeAux}
|
|
9670
|
+
};
|
|
9671
|
+
process = adaptorIns(dsp_code.process) : dsp_code.effect : adaptorOuts;`;
|
|
9672
|
+
this.voiceFactory = await compiler.createPolyDSPFactory(name, dspCode, args);
|
|
9673
|
+
try {
|
|
9674
|
+
this.effectFactory = await compiler.createPolyDSPFactory(name, effectCode, args + " -inpl");
|
|
9675
|
+
} catch (e) {
|
|
9676
|
+
console.log(e);
|
|
9677
|
+
}
|
|
9678
|
+
}
|
|
9642
9679
|
} catch (e) {
|
|
9643
|
-
console.
|
|
9680
|
+
console.log(e);
|
|
9681
|
+
this.voiceFactory = await compiler.createPolyDSPFactory(name, dspCodeAux, args);
|
|
9682
|
+
}
|
|
9683
|
+
if (this.voiceFactory) {
|
|
9684
|
+
this.name = name;
|
|
9685
|
+
const voiceMeta = JSON.parse(this.voiceFactory.json);
|
|
9686
|
+
const isDouble = voiceMeta.compile_options.match("-double");
|
|
9687
|
+
const { mixerBuffer, mixerModule } = await compiler.getAsyncInternalMixerModule(!!isDouble);
|
|
9688
|
+
this.mixerBuffer = mixerBuffer;
|
|
9689
|
+
this.mixerModule = mixerModule;
|
|
9690
|
+
return this;
|
|
9691
|
+
} else {
|
|
9692
|
+
return null;
|
|
9644
9693
|
}
|
|
9645
|
-
this.name = name;
|
|
9646
|
-
const voiceMeta = JSON.parse(this.voiceFactory.json);
|
|
9647
|
-
const isDouble = voiceMeta.compile_options.match("-double");
|
|
9648
|
-
const { mixerBuffer, mixerModule } = await compiler.getAsyncInternalMixerModule(!!isDouble);
|
|
9649
|
-
this.mixerBuffer = mixerBuffer;
|
|
9650
|
-
this.mixerModule = mixerModule;
|
|
9651
|
-
return this;
|
|
9652
9694
|
}
|
|
9653
9695
|
async createNode(context, voices, name = this.name, voiceFactory = this.voiceFactory, mixerModule = this.mixerModule, effectFactory = this.effectFactory, sp = false, bufferSize = 1024, processorName = ((voiceFactory == null ? void 0 : voiceFactory.shaKey) || "") + ((effectFactory == null ? void 0 : effectFactory.shaKey) || "") || `${name}_poly`) {
|
|
9654
9696
|
var _a, _b;
|